From e8986ba38266fe1f0d271ca5da0053813b49eebe Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 16 Jun 2020 18:18:27 -0500 Subject: [PATCH] move Eigen format definition to Matrix.h --- gtsam/base/Matrix.cpp | 10 ---------- gtsam/base/Matrix.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index e2d8f71d1..1c34a71d4 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -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; } diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index fa70e5b00..61cbf3e2a 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -76,6 +76,18 @@ GTSAM_MAKE_MATRIX_DEFS(9); typedef Eigen::Block SubMatrix; typedef Eigen::Block 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 */