use key_formatter in print function
parent
4ed069e7a6
commit
addbfe8234
|
@ -141,7 +141,7 @@ namespace gtsam {
|
||||||
for (const auto& key_value : v)
|
for (const auto& key_value : v)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
os << " " << key_value.first << ": " << key_value.second.transpose()
|
os << " " << StreamedKey(key_value.first) << ": " << key_value.second.transpose()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
|
@ -151,7 +151,7 @@ namespace gtsam {
|
||||||
void VectorValues::print(const string& str,
|
void VectorValues::print(const string& str,
|
||||||
const KeyFormatter& formatter) const {
|
const KeyFormatter& formatter) const {
|
||||||
cout << str << ": " << size() << " elements\n";
|
cout << str << ": " << size() << " elements\n";
|
||||||
cout << *this;
|
cout << key_formatter(formatter) << *this;
|
||||||
cout.flush();
|
cout.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <gtsam/base/Testable.h>
|
#include <gtsam/base/Testable.h>
|
||||||
#include <gtsam/linear/VectorValues.h>
|
#include <gtsam/linear/VectorValues.h>
|
||||||
|
#include <gtsam/inference/LabeledSymbol.h>
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
|
||||||
|
@ -239,7 +240,6 @@ TEST(VectorValues, print)
|
||||||
vv.insert(2, Vector2(4, 5));
|
vv.insert(2, Vector2(4, 5));
|
||||||
vv.insert(5, Vector2(6, 7));
|
vv.insert(5, Vector2(6, 7));
|
||||||
vv.insert(7, Vector2(8, 9));
|
vv.insert(7, Vector2(8, 9));
|
||||||
vv.print();
|
|
||||||
|
|
||||||
string expected =
|
string expected =
|
||||||
" 0: 1\n 1: 2 3\n 2: 4 5\n 5: 6 7\n 7: 8 9\n";
|
" 0: 1\n 1: 2 3\n 2: 4 5\n 5: 6 7\n 7: 8 9\n";
|
||||||
|
|
Loading…
Reference in New Issue