Fix spacing in DecisionTree::print

release/4.3a0
Varun Agrawal 2023-07-18 10:21:56 -04:00
parent 103641c51a
commit cb084b3c16
5 changed files with 15 additions and 15 deletions

View File

@ -93,7 +93,7 @@ namespace gtsam {
/// print /// print
void print(const std::string& s, const LabelFormatter& labelFormatter, void print(const std::string& s, const LabelFormatter& labelFormatter,
const ValueFormatter& valueFormatter) const override { const ValueFormatter& valueFormatter) const override {
std::cout << s << " Leaf [" << nrAssignments() << "]" std::cout << s << " Leaf [" << nrAssignments() << "] "
<< valueFormatter(constant_) << std::endl; << valueFormatter(constant_) << std::endl;
} }

View File

@ -108,7 +108,7 @@ TEST(GaussianMixtureFactor, Printing) {
std::string expected = std::string expected =
R"(Hybrid [x1 x2; 1]{ R"(Hybrid [x1 x2; 1]{
Choice(1) Choice(1)
0 Leaf [1]: 0 Leaf [1] :
A[x1] = [ A[x1] = [
0; 0;
0 0
@ -120,7 +120,7 @@ TEST(GaussianMixtureFactor, Printing) {
b = [ 0 0 ] b = [ 0 0 ]
No noise model No noise model
1 Leaf [1]: 1 Leaf [1] :
A[x1] = [ A[x1] = [
0; 0;
0 0

View File

@ -492,7 +492,7 @@ factor 0:
factor 1: factor 1:
Hybrid [x0 x1; m0]{ Hybrid [x0 x1; m0]{
Choice(m0) Choice(m0)
0 Leaf [1]: 0 Leaf [1] :
A[x0] = [ A[x0] = [
-1 -1
] ]
@ -502,7 +502,7 @@ Hybrid [x0 x1; m0]{
b = [ -1 ] b = [ -1 ]
No noise model No noise model
1 Leaf [1]: 1 Leaf [1] :
A[x0] = [ A[x0] = [
-1 -1
] ]
@ -516,7 +516,7 @@ Hybrid [x0 x1; m0]{
factor 2: factor 2:
Hybrid [x1 x2; m1]{ Hybrid [x1 x2; m1]{
Choice(m1) Choice(m1)
0 Leaf [1]: 0 Leaf [1] :
A[x1] = [ A[x1] = [
-1 -1
] ]
@ -526,7 +526,7 @@ Hybrid [x1 x2; m1]{
b = [ -1 ] b = [ -1 ]
No noise model No noise model
1 Leaf [1]: 1 Leaf [1] :
A[x1] = [ A[x1] = [
-1 -1
] ]
@ -555,10 +555,10 @@ factor 5: P( m0 ):
factor 6: P( m1 | m0 ): factor 6: P( m1 | m0 ):
Choice(m1) Choice(m1)
0 Choice(m0) 0 Choice(m0)
0 0 Leaf [1]0.33333333 0 0 Leaf [1] 0.33333333
0 1 Leaf [1] 0.6 0 1 Leaf [1] 0.6
1 Choice(m0) 1 Choice(m0)
1 0 Leaf [1]0.66666667 1 0 Leaf [1] 0.66666667
1 1 Leaf [1] 0.4 1 1 Leaf [1] 0.4
)"; )";

View File

@ -63,8 +63,8 @@ TEST(MixtureFactor, Printing) {
R"(Hybrid [x1 x2; 1] R"(Hybrid [x1 x2; 1]
MixtureFactor MixtureFactor
Choice(1) Choice(1)
0 Leaf [1]Nonlinear factor on 2 keys 0 Leaf [1] Nonlinear factor on 2 keys
1 Leaf [1]Nonlinear factor on 2 keys 1 Leaf [1] Nonlinear factor on 2 keys
)"; )";
EXPECT(assert_print_equal(expected, mixtureFactor)); EXPECT(assert_print_equal(expected, mixtureFactor));
} }

View File

@ -99,7 +99,7 @@ namespace gtsam {
/* ************************************************************************ */ /* ************************************************************************ */
void GaussianConditional::print(const string &s, const KeyFormatter& formatter) const { void GaussianConditional::print(const string &s, const KeyFormatter& formatter) const {
cout << s << " p("; cout << (s.empty() ? "" : s + " ") << "p(";
for (const_iterator it = beginFrontals(); it != endFrontals(); ++it) { for (const_iterator it = beginFrontals(); it != endFrontals(); ++it) {
cout << formatter(*it) << (nrFrontals() > 1 ? " " : ""); cout << formatter(*it) << (nrFrontals() > 1 ? " " : "");
} }