diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-08-29 12:06:37 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-08-29 12:06:37 +0200 |
commit | 7e029d1d6ec0eba495a31c72a328ee8160338e44 (patch) | |
tree | ebbaae9b73c903102c94ab1ef6ee01882ddcac0c /test/sparse_basic.cpp | |
parent | a93e354d9282cc76de899db412c79f730ff58345 (diff) |
bug #1271: add SparseMatrix::coeffs() methods returning a 1D view of the non zero coefficients.
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r-- | test/sparse_basic.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 10309b3a9..7b5f3eb38 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -207,6 +207,16 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re VERIFY_IS_APPROX((m1 = m1.transpose()), (refM1 = refM1.transpose().eval())); VERIFY_IS_APPROX((m1 = -m1.transpose()), (refM1 = -refM1.transpose().eval())); VERIFY_IS_APPROX((m1 += -m1), (refM1 += -refM1)); + + if(m1.isCompressed()) + { + VERIFY_IS_APPROX(m1.coeffs().sum(), m1.sum()); + m1.coeffs() += s1; + for(Index j = 0; j<m1.outerSize(); ++j) + for(typename SparseMatrixType::InnerIterator it(m1,j); it; ++it) + refM1(it.row(), it.col()) += s1; + VERIFY_IS_APPROX(m1, refM1); + } } // test transpose |