diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-06-24 17:55:00 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-06-24 17:55:00 +0200 |
commit | 62f21e2d11b3c34d4e3bc94fe11e59f57489084a (patch) | |
tree | 1231af0cf51badb2c72dca5c9631b0f1b3b1b22a /test/sparse_basic.cpp | |
parent | 763c833637d3918c32dc9c7ce5c9fcf647c7479b (diff) |
Add support for sparse = diagonal
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r-- | test/sparse_basic.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 75f29a2b4..2ebf4d420 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -365,6 +365,18 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re VERIFY_IS_APPROX(m2, refMat2); } + // test diagonal to sparse + { + DenseVector d = DenseVector::Random(rows); + DenseMatrix refMat2 = d.asDiagonal(); + SparseMatrixType m2(rows, rows); + m2 = d.asDiagonal(); + VERIFY_IS_APPROX(m2, refMat2); + refMat2 += d.asDiagonal(); + m2 += d.asDiagonal(); + VERIFY_IS_APPROX(m2, refMat2); + } + // test conservative resize { std::vector< std::pair<StorageIndex,StorageIndex> > inc; |