Fix markdown names (that somehow reverted)

release/4.3a0
Frank Dellaert 2021-12-25 10:46:49 -05:00
parent 1683b00184
commit 38f0a40fbc
12 changed files with 17 additions and 17 deletions

View File

@ -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();
}
/* ************************************************************************* */

View File

@ -102,7 +102,7 @@ namespace gtsam {
/// @{
/// Render as markdown table.
std::string _repr_markdown_(
std::string markdown(
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/// @}

View File

@ -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;

View File

@ -93,7 +93,7 @@ class GTSAM_EXPORT DiscreteBayesTree
/// @{
/// Render as markdown table.
std::string _repr_markdown_(
std::string markdown(
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/// @}

View File

@ -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();
}

View File

@ -93,7 +93,7 @@ public:
/// @{
/// Render as markdown table.
virtual std::string _repr_markdown_(
virtual std::string markdown(
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0;
/// @}

View File

@ -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();
}

View File

@ -158,7 +158,7 @@ public:
/// @{
/// Render as markdown table.
std::string _repr_markdown_(
std::string markdown(
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/// @}

View File

@ -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;
};

View File

@ -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);
}

View File

@ -411,7 +411,7 @@ TEST(DiscreteFactorGraph, markdown) {
"|1|1|0.6|\n\n";
vector<string> 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.

View File

@ -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();
}