Skip to content

Commit

Permalink
Merge pull request #1030 from borglab/fix/minor-fg-print-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal authored Jan 12, 2022
2 parents 6244910 + b79c59a commit 7cc3eb8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions gtsam/nonlinear/NonlinearFactorGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ void NonlinearFactorGraph::print(const std::string& str, const KeyFormatter& key
for (size_t i = 0; i < factors_.size(); i++) {
stringstream ss;
ss << "Factor " << i << ": ";
if (factors_[i] != nullptr) factors_[i]->print(ss.str(), keyFormatter);
cout << endl;
if (factors_[i] != nullptr) {
factors_[i]->print(ss.str(), keyFormatter);
cout << "\n";
} else {
cout << ss.str() << "nullptr\n";
}
}
std::cout.flush();
}

/* ************************************************************************* */
Expand All @@ -80,8 +85,9 @@ void NonlinearFactorGraph::printErrors(const Values& values, const std::string&
factor->print(ss.str(), keyFormatter);
cout << "error = " << errorValue << "\n";
}
cout << endl; // only one "endl" at end might be faster, \n for each factor
cout << "\n";
}
std::cout.flush();
}

/* ************************************************************************* */
Expand Down

0 comments on commit 7cc3eb8

Please sign in to comment.