aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_product.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-10-24 11:44:53 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-10-24 11:44:53 +0200
commit1ddf88060b6475d3ee6b681bb0ed7b55d311ffa5 (patch)
tree6f735d581bf12849a71f8e4baf1a0c57722769f0 /test/sparse_product.cpp
parenta997dacc6728157e143e772545a47bac5e920e49 (diff)
update sparse*sparse product: the default is now a conservative algorithm preserving symbolic non zeros. The previous with auto pruning of the small value is avaible doing: (A*B).pruned() or (A*B).pruned(ref) or (A*B).pruned(ref,eps)
Diffstat (limited to 'test/sparse_product.cpp')
-rw-r--r--test/sparse_product.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp
index ac1dac5f5..ce7480471 100644
--- a/test/sparse_product.cpp
+++ b/test/sparse_product.cpp
@@ -94,6 +94,7 @@ template<typename SparseMatrixType> void sparse_product()
// int c = internal::random<int>(0,depth-1);
+ // sparse * sparse
VERIFY_IS_APPROX(m4=m2*m3, refMat4=refMat2*refMat3);
VERIFY_IS_APPROX(m4=m2t.transpose()*m3, refMat4=refMat2t.transpose()*refMat3);
VERIFY_IS_APPROX(m4=m2t.transpose()*m3t.transpose(), refMat4=refMat2t.transpose()*refMat3t.transpose());
@@ -103,6 +104,11 @@ template<typename SparseMatrixType> void sparse_product()
VERIFY_IS_APPROX(m4 = m2*m3*s1, refMat4 = refMat2*refMat3*s1);
VERIFY_IS_APPROX(m4 = s2*m2*m3*s1, refMat4 = s2*refMat2*refMat3*s1);
+ VERIFY_IS_APPROX(m4=(m2*m3).pruned(0), refMat4=refMat2*refMat3);
+ VERIFY_IS_APPROX(m4=(m2t.transpose()*m3).pruned(0), refMat4=refMat2t.transpose()*refMat3);
+ VERIFY_IS_APPROX(m4=(m2t.transpose()*m3t.transpose()).pruned(0), refMat4=refMat2t.transpose()*refMat3t.transpose());
+ VERIFY_IS_APPROX(m4=(m2*m3t.transpose()).pruned(0), refMat4=refMat2*refMat3t.transpose());
+
// sparse * dense
VERIFY_IS_APPROX(dm4=m2*refMat3, refMat4=refMat2*refMat3);
VERIFY_IS_APPROX(dm4=m2*refMat3t.transpose(), refMat4=refMat2*refMat3t.transpose());