aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_basic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r--test/sparse_basic.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 993f7840c..e8ebd7000 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -434,6 +434,20 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
SparseMatrixType m1(rows, rows);
m1.setIdentity();
VERIFY_IS_APPROX(m1, refMat1);
+ for(int k=0; k<rows*rows/4; ++k)
+ {
+ Index i = internal::random<Index>(0,rows-1);
+ Index j = internal::random<Index>(0,rows-1);
+ Index v = internal::random<Scalar>();
+ m1.coeffRef(i,j) = v;
+ refMat1.coeffRef(i,j) = v;
+ VERIFY_IS_APPROX(m1, refMat1);
+ if(internal::random<Index>(0,10)<2)
+ m1.makeCompressed();
+ }
+ m1.setIdentity();
+ refMat1.setIdentity();
+ VERIFY_IS_APPROX(m1, refMat1);
}
}