From 0bcd4b60e7be4266ec637f76dd3f8423b0d4253f Mon Sep 17 00:00:00 2001 From: Rene Milk <rene.milk@uni-muenster.de> Date: Fri, 14 Jan 2011 22:32:27 +0100 Subject: [PATCH] fix sp-mat output Conflicts: stuff/matrix.hh --- stuff/printing.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stuff/printing.hh b/stuff/printing.hh index 84f3d2a15..acc4132f7 100644 --- a/stuff/printing.hh +++ b/stuff/printing.hh @@ -88,7 +88,7 @@ void printSparseRowMatrixMatlabStyle(const T& arg, const std::string name, strea out << boost::format("\n%s =sparse( %d, %d );") % name % I % J << std::endl; for (int row = 0; row < arg.rows(); row++) { for (int col = 0; col < arg.cols(); col++) { - if (arg(row, col) > eps) + if (std::fabs(arg(row, col)) > eps) out << name << "(" << row + 1 << "," << col + 1 << ")=" << std::setprecision(12) << arg(row, col) << ";\n"; } } -- GitLab