aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_vector.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-01-14 14:24:10 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-01-14 14:24:10 +0000
commitc4c70669d165afefe0c68e7bb194ee81b9fba0b5 (patch)
tree37793f68813b629ecc0a3067dc0609d6ea873738 /test/sparse_vector.cpp
parentee87f5ee49f23179a07c8486cc9c0ebcf6e947d6 (diff)
Big rewrite in the Sparse module: SparseMatrixBase no longer inherits MatrixBase.
That means a lot of features which were available for sparse matrices via the dense (and super slow) implemention are no longer available. All features which make sense for sparse matrices (aka can be implemented efficiently) will be implemented soon, but don't expect to see an API as rich as for the dense path. Other changes: * no block(), row(), col() anymore. * instead use .innerVector() to get a col or row vector of a matrix. * .segment(), start(), end() will be back soon, not sure for block() * faster cwise product
Diffstat (limited to 'test/sparse_vector.cpp')
-rw-r--r--test/sparse_vector.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/sparse_vector.cpp b/test/sparse_vector.cpp
index 0a25884ca..18ef74833 100644
--- a/test/sparse_vector.cpp
+++ b/test/sparse_vector.cpp
@@ -62,7 +62,8 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
for (typename SparseVectorType::InnerIterator it(v1); it; ++it,++j)
{
VERIFY(nonzerocoords[j]==it.index());
- VERIFY(it.value()==v1[it.index()]);
+ VERIFY(it.value()==v1.coeff(it.index()));
+ VERIFY(it.value()==refV1.coeff(it.index()));
}
}
VERIFY_IS_APPROX(v1, refV1);
@@ -76,7 +77,7 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
VERIFY_IS_APPROX(v1*s1-v2, refV1*s1-refV2);
- std::cerr << v1.dot(v2) << " == " << refV1.dot(refV2) << "\n";
+// std::cerr << v1.dot(v2) << " == " << refV1.dot(refV2) << "\n";
VERIFY_IS_APPROX(v1.dot(v2), refV1.dot(refV2));
}
@@ -85,7 +86,7 @@ void test_sparse_vector()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( sparse_vector<double>(8, 8) );
-// CALL_SUBTEST( sparse_vector<std::complex<double> >(16, 16) );
+ CALL_SUBTEST( sparse_vector<std::complex<double> >(16, 16) );
CALL_SUBTEST( sparse_vector<double>(299, 535) );
}
}