aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-01-27 22:48:17 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-01-27 22:48:17 +0000
commit8ce45034947d1858fe68803d3c82d1c62c15eacd (patch)
tree9f72e0b9502339d8819cf6c55844cd9b25c3b6fe /test
parentd3846717939ac11ef925d8f8ee36b95ed1170846 (diff)
add support for read/write sub sets of inner vectors (sparse module)
Diffstat (limited to 'test')
-rw-r--r--test/sparse_basic.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 439458128..08f19d7e4 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -254,6 +254,24 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
int j1 = ei_random(0,rows-1);
VERIFY_IS_APPROX(m2.innerVector(j0), refMat2.col(j0));
VERIFY_IS_APPROX(m2.innerVector(j0)+m2.innerVector(j1), refMat2.col(j0)+refMat2.col(j1));
+ //m2.innerVector(j0) = 2*m2.innerVector(j1);
+ //refMat2.col(j0) = 2*refMat2.col(j1);
+ //VERIFY_IS_APPROX(m2, refMat2);
+ }
+
+ // test innerVectors()
+ {
+ DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);
+ SparseMatrixType m2(rows, rows);
+ initSparse<Scalar>(density, refMat2, m2);
+ int j0 = ei_random(0,rows-2);
+ int j1 = ei_random(0,rows-2);
+ int n0 = ei_random<int>(1,rows-std::max(j0,j1));
+ VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(0,j0,rows,n0));
+ VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),
+ refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));
+ //m2.innerVectors(j0,n0) = m2.innerVectors(j0,n0) + m2.innerVectors(j1,n0);
+ //refMat2.block(0,j0,rows,n0) = refMat2.block(0,j0,rows,n0) + refMat2.block(0,j1,rows,n0);
}
// test transpose