From 77b256825171c8b2dc12ab176c4752f21c587dfa Mon Sep 17 00:00:00 2001 From: corentinberge <33965571+corentinberge@users.noreply.github.com> Date: Mon, 12 Aug 2019 12:29:00 +0200 Subject: [PATCH] Update signal-cast-registerer.cpp Make the code easier to read by importing the matrix m in OS instead of importing elements 1 by 1 --- tests/signal-cast-registerer.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/signal-cast-registerer.cpp b/tests/signal-cast-registerer.cpp index ac39bc1..006f0e6 100644 --- a/tests/signal-cast-registerer.cpp +++ b/tests/signal-cast-registerer.cpp @@ -88,31 +88,13 @@ struct EigenCastRegisterer_M : public dynamicgraph::SignalCastRegisterer static void dispMatrix (const boost::any& object, std::ostream& os) { const bnuMatrix& m = boost::any_cast<bnuMatrix> (object); - os << "[ "; - for (int i = 0; i < m.rows(); ++i){ - os << "[ "; - for (int j = 0; j < m.cols(); ++j) { - os << m(i, j) << " "; - } - if (i != m.rows()-1){ - os << "]; "; - } - else{ - os << "] "; - } - } - os << " ];" << std::endl; + os << m << std::endl; } static void traceMatrix (const boost::any& object, std::ostream& os) { const bnuMatrix& m = boost::any_cast<bnuMatrix> (object); - for (int i = 0; i < m.rows(); ++i){ - for (int j = 0; j < m.cols(); ++j){ - os << m(i,j) << " "; - } - } - os << std::endl; + os << m << std::endl; } }; -- GitLab