From 43f7bc8cdff4929496dbfd698ffb8ecea74ef2d2 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 11 Nov 2016 18:16:30 -0500 Subject: [PATCH] [Numerics] Remove trailing commas when printing Array2D and BandMatrix --- include/cantera/base/Array.h | 5 +++-- src/numerics/BandMatrix.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/cantera/base/Array.h b/include/cantera/base/Array.h index 52c4f020bc..26fd75bd74 100644 --- a/include/cantera/base/Array.h +++ b/include/cantera/base/Array.h @@ -350,8 +350,9 @@ inline std::ostream& operator<<(std::ostream& s, const Array2D& m) size_t nr = m.nRows(); size_t nc = m.nColumns(); for (size_t i = 0; i < nr; i++) { - for (size_t j = 0; j < nc; j++) { - s << m(i,j) << ", "; + s << m(i,0); + for (size_t j = 1; j < nc; j++) { + s << ", " << m(i,j); } s << std::endl; } diff --git a/src/numerics/BandMatrix.cpp b/src/numerics/BandMatrix.cpp index 8f281a00e5..4830d257bf 100644 --- a/src/numerics/BandMatrix.cpp +++ b/src/numerics/BandMatrix.cpp @@ -321,8 +321,9 @@ vector_fp::const_iterator BandMatrix::end() const ostream& operator<<(ostream& s, const BandMatrix& m) { for (size_t i = 0; i < m.nRows(); i++) { - for (size_t j = 0; j < m.nColumns(); j++) { - s << m(i,j) << ", "; + s << m(i, 0); + for (size_t j = 1; j < m.nColumns(); j++) { + s << ", " << m(i,j); } s << endl; }