From 38f0a40fbcd43d2b35767c9313e6ab8d5b488c05 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 25 Dec 2021 10:46:49 -0500 Subject: [PATCH] Fix markdown names (that somehow reverted) --- gtsam/discrete/DiscreteBayesNet.cpp | 4 ++-- gtsam/discrete/DiscreteBayesNet.h | 2 +- gtsam/discrete/DiscreteBayesTree.cpp | 4 ++-- gtsam/discrete/DiscreteBayesTree.h | 2 +- gtsam/discrete/DiscreteConditional.cpp | 2 +- gtsam/discrete/DiscreteFactor.h | 2 +- gtsam/discrete/DiscreteFactorGraph.cpp | 4 ++-- gtsam/discrete/DiscreteFactorGraph.h | 2 +- gtsam/discrete/discrete.i | 6 +++--- gtsam/discrete/tests/testDiscreteBayesNet.cpp | 2 +- gtsam/discrete/tests/testDiscreteFactorGraph.cpp | 2 +- gtsam_unstable/discrete/Constraint.h | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gtsam/discrete/DiscreteBayesNet.cpp b/gtsam/discrete/DiscreteBayesNet.cpp index e50f4586f..d9fba630e 100644 --- a/gtsam/discrete/DiscreteBayesNet.cpp +++ b/gtsam/discrete/DiscreteBayesNet.cpp @@ -62,13 +62,13 @@ namespace gtsam { } /* ************************************************************************* */ - std::string DiscreteBayesNet::_repr_markdown_( + std::string DiscreteBayesNet::markdown( const KeyFormatter& keyFormatter) const { using std::endl; std::stringstream ss; ss << "`DiscreteBayesNet` of size " << size() << endl << endl; for(const DiscreteConditional::shared_ptr& conditional: *this) - ss << conditional->_repr_markdown_(keyFormatter) << endl; + ss << conditional->markdown(keyFormatter) << endl; return ss.str(); } /* ************************************************************************* */ diff --git a/gtsam/discrete/DiscreteBayesNet.h b/gtsam/discrete/DiscreteBayesNet.h index 5eb656b3b..d78eed08f 100644 --- a/gtsam/discrete/DiscreteBayesNet.h +++ b/gtsam/discrete/DiscreteBayesNet.h @@ -102,7 +102,7 @@ namespace gtsam { /// @{ /// Render as markdown table. - std::string _repr_markdown_( + std::string markdown( const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; /// @} diff --git a/gtsam/discrete/DiscreteBayesTree.cpp b/gtsam/discrete/DiscreteBayesTree.cpp index 09a1f47aa..8a9186d05 100644 --- a/gtsam/discrete/DiscreteBayesTree.cpp +++ b/gtsam/discrete/DiscreteBayesTree.cpp @@ -56,14 +56,14 @@ namespace gtsam { } /* **************************************************************************/ - std::string DiscreteBayesTree::_repr_markdown_( + std::string DiscreteBayesTree::markdown( const KeyFormatter& keyFormatter) const { using std::endl; std::stringstream ss; ss << "`DiscreteBayesTree` of size " << nodes_.size() << endl << endl; auto visitor = [&](const DiscreteBayesTreeClique::shared_ptr& clique, size_t& indent) { - ss << "\n" << clique->conditional()->_repr_markdown_(keyFormatter); + ss << "\n" << clique->conditional()->markdown(keyFormatter); return indent + 1; }; size_t indent; diff --git a/gtsam/discrete/DiscreteBayesTree.h b/gtsam/discrete/DiscreteBayesTree.h index 675b951ed..12d6017cc 100644 --- a/gtsam/discrete/DiscreteBayesTree.h +++ b/gtsam/discrete/DiscreteBayesTree.h @@ -93,7 +93,7 @@ class GTSAM_EXPORT DiscreteBayesTree /// @{ /// Render as markdown table. - std::string _repr_markdown_( + std::string markdown( const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; /// @} diff --git a/gtsam/discrete/DiscreteConditional.cpp b/gtsam/discrete/DiscreteConditional.cpp index dc5b52e5e..49a615452 100644 --- a/gtsam/discrete/DiscreteConditional.cpp +++ b/gtsam/discrete/DiscreteConditional.cpp @@ -238,7 +238,7 @@ std::string DiscreteConditional::markdown( if (nrParents() == 0) { // We have no parents, call factor method. ss << ")$:" << std::endl; - ss << DecisionTreeFactor::_repr_markdown_(); + ss << DecisionTreeFactor::markdown(); return ss.str(); } diff --git a/gtsam/discrete/DiscreteFactor.h b/gtsam/discrete/DiscreteFactor.h index f046e5e44..d7deca383 100644 --- a/gtsam/discrete/DiscreteFactor.h +++ b/gtsam/discrete/DiscreteFactor.h @@ -93,7 +93,7 @@ public: /// @{ /// Render as markdown table. - virtual std::string _repr_markdown_( + virtual std::string markdown( const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0; /// @} diff --git a/gtsam/discrete/DiscreteFactorGraph.cpp b/gtsam/discrete/DiscreteFactorGraph.cpp index 129ab4dae..bd84e1364 100644 --- a/gtsam/discrete/DiscreteFactorGraph.cpp +++ b/gtsam/discrete/DiscreteFactorGraph.cpp @@ -130,14 +130,14 @@ namespace gtsam { } /* ************************************************************************* */ - std::string DiscreteFactorGraph::_repr_markdown_( + std::string DiscreteFactorGraph::markdown( const KeyFormatter& keyFormatter) const { using std::endl; std::stringstream ss; ss << "`DiscreteFactorGraph` of size " << size() << endl << endl; for (size_t i = 0; i < factors_.size(); i++) { ss << "factor " << i << ":\n"; - ss << factors_[i]->_repr_markdown_(keyFormatter) << endl; + ss << factors_[i]->markdown(keyFormatter) << endl; } return ss.str(); } diff --git a/gtsam/discrete/DiscreteFactorGraph.h b/gtsam/discrete/DiscreteFactorGraph.h index 616d7c7d2..38091829f 100644 --- a/gtsam/discrete/DiscreteFactorGraph.h +++ b/gtsam/discrete/DiscreteFactorGraph.h @@ -158,7 +158,7 @@ public: /// @{ /// Render as markdown table. - std::string _repr_markdown_( + std::string markdown( const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; /// @} diff --git a/gtsam/discrete/discrete.i b/gtsam/discrete/discrete.i index 2bdd0af2c..40569ebbf 100644 --- a/gtsam/discrete/discrete.i +++ b/gtsam/discrete/discrete.i @@ -93,7 +93,7 @@ class DiscreteBayesNet { double operator()(const gtsam::DiscreteValues& values) const; gtsam::DiscreteValues optimize() const; gtsam::DiscreteValues sample() const; - string _repr_markdown_(const gtsam::KeyFormatter& keyFormatter = + string markdown(const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter) const; }; @@ -127,7 +127,7 @@ class DiscreteBayesTree { gtsam::DefaultKeyFormatter) const; double operator()(const gtsam::DiscreteValues& values) const; - string _repr_markdown_(const gtsam::KeyFormatter& keyFormatter = + string markdown(const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter) const; }; @@ -170,7 +170,7 @@ class DiscreteFactorGraph { gtsam::DiscreteBayesTree eliminateMultifrontal(); gtsam::DiscreteBayesTree eliminateMultifrontal(const gtsam::Ordering& ordering); - string _repr_markdown_(const gtsam::KeyFormatter& keyFormatter = + string markdown(const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter) const; }; diff --git a/gtsam/discrete/tests/testDiscreteBayesNet.cpp b/gtsam/discrete/tests/testDiscreteBayesNet.cpp index 827b7d248..33c7b7011 100644 --- a/gtsam/discrete/tests/testDiscreteBayesNet.cpp +++ b/gtsam/discrete/tests/testDiscreteBayesNet.cpp @@ -192,7 +192,7 @@ TEST(DiscreteBayesNet, markdown) { "|0|0.8|0.2|\n" "|1|0.7|0.3|\n\n"; auto formatter = [](Key key) { return key == 0 ? "Asia" : "Smoking"; }; - string actual = fragment._repr_markdown_(formatter); + string actual = fragment.markdown(formatter); EXPECT(actual == expected); } diff --git a/gtsam/discrete/tests/testDiscreteFactorGraph.cpp b/gtsam/discrete/tests/testDiscreteFactorGraph.cpp index f1fd26af4..b6172382a 100644 --- a/gtsam/discrete/tests/testDiscreteFactorGraph.cpp +++ b/gtsam/discrete/tests/testDiscreteFactorGraph.cpp @@ -411,7 +411,7 @@ TEST(DiscreteFactorGraph, markdown) { "|1|1|0.6|\n\n"; vector names{"C", "A", "B"}; auto formatter = [names](Key key) { return names[key]; }; - string actual = graph._repr_markdown_(formatter); + string actual = graph.markdown(formatter); EXPECT(actual == expected); // Make sure values are correctly displayed. diff --git a/gtsam_unstable/discrete/Constraint.h b/gtsam_unstable/discrete/Constraint.h index e772c54df..5c21028a0 100644 --- a/gtsam_unstable/discrete/Constraint.h +++ b/gtsam_unstable/discrete/Constraint.h @@ -86,7 +86,7 @@ class GTSAM_EXPORT Constraint : public DiscreteFactor { /// @{ /// Render as markdown table. - std::string _repr_markdown_( + std::string markdown( const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override { return (boost::format("`Constraint` on %1% variables\n") % (size())).str(); }