move Eigen format definition to Matrix.h

release/4.3a0
Varun Agrawal 2020-06-16 18:18:27 -05:00
parent ac69115e34
commit e8986ba382
2 changed files with 12 additions and 10 deletions

View File

@ -139,16 +139,6 @@ Vector operator^(const Matrix& A, const Vector & v) {
/* ************************************************************************* */
//3 argument call
void print(const Matrix& A, const string &s, ostream& stream) {
static const Eigen::IOFormat matlab(
Eigen::StreamPrecision, // precision
0, // flags
", ", // coeffSeparator
";\n", // rowSeparator
"\t", // rowPrefix
"", // rowSuffix
"[\n", // matPrefix
"\n]" // matSuffix
);
cout << s << A.format(matlab) << endl;
}

View File

@ -76,6 +76,18 @@ GTSAM_MAKE_MATRIX_DEFS(9);
typedef Eigen::Block<Matrix> SubMatrix;
typedef Eigen::Block<const Matrix> ConstSubMatrix;
// Matrix formatting arguments when printing. Akin to Matlab style.
const Eigen::IOFormat matlab(
Eigen::StreamPrecision, // precision
0, // flags
", ", // coeffSeparator
";\n", // rowSeparator
"\t", // rowPrefix
"", // rowSuffix
"[\n", // matPrefix
"\n]" // matSuffix
);
/**
* equals with a tolerance
*/