From 8cff599b81b705fd79b20f8d939423f90efbf11c Mon Sep 17 00:00:00 2001
From: Rohan Budhiraja <budhiraja@laas.fr>
Date: Wed, 6 Apr 2016 12:22:18 +0200
Subject: [PATCH] [c++] update the ostream output format for MatrixHomogeneous
 to [M,N]((,,,),(,,,),(,,,))

---
 include/dynamic-graph/eigen-io.h       | 14 +++++++++++++-
 include/dynamic-graph/linear-algebra.h |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/dynamic-graph/eigen-io.h b/include/dynamic-graph/eigen-io.h
index 60eab3f..89d8f33 100644
--- a/include/dynamic-graph/eigen-io.h
+++ b/include/dynamic-graph/eigen-io.h
@@ -138,9 +138,21 @@ namespace Eigen {
   
   
   
+
+  /* \brief Eigen Homogeneous Matrix output
+   *
+   * Matrix format: [M,N]((val11,val12,val13,...,val1N),...,(valM1,valM2,...,valMN))
+   * e.g. [2,5]((1 23 32.2 12.12 32),(2 32 23 92.01 19.2))
+   */
+
   inline std::ostream& operator << (std::ostream &os, 
 				    Transform<double,3,Affine> MH) {
-    os << MH.matrix();      return os;   }
+    IOFormat boostFmt(StreamPrecision, DontAlignCols,
+		      ",", ",",
+		      "(",")",
+		      "(",")");
+    
+    os << "[4,4]"<< MH.matrix().format(boostFmt);      return os;   }
   
   
   inline std::ostream& operator << (std::ostream &os, 
diff --git a/include/dynamic-graph/linear-algebra.h b/include/dynamic-graph/linear-algebra.h
index 7605815..4b566fb 100644
--- a/include/dynamic-graph/linear-algebra.h
+++ b/include/dynamic-graph/linear-algebra.h
@@ -18,6 +18,7 @@
 #ifndef DYNAMIC_GRAPH_LINEAR_ALGEBRA_H
 #define DYNAMIC_GRAPH_LINEAR_ALGEBRA_H
 #include <Eigen/Core>
+#include <Eigen/Geometry>
 
 namespace dynamicgraph {
   typedef Eigen::MatrixXd Matrix;
-- 
GitLab