aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_product.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-04-05 16:30:10 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-04-05 16:30:10 +0000
commit5b1d0cebc5c30975f6f392d6f7d49d35e2a3508f (patch)
tree7d5f81092e84ef67bb68b14dcef4a2d2a862a1d2 /test/sparse_product.cpp
parent5a628567b0d55730875220e6ed005c30f289e230 (diff)
sparse module: new API proposal for triangular solves and experimental
solver support with a sparse matrix as the rhs.
Diffstat (limited to 'test/sparse_product.cpp')
-rw-r--r--test/sparse_product.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp
index 3a0356f00..00b5a3ed5 100644
--- a/test/sparse_product.cpp
+++ b/test/sparse_product.cpp
@@ -40,6 +40,7 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);
DenseMatrix refMat3 = DenseMatrix::Zero(rows, rows);
DenseMatrix refMat4 = DenseMatrix::Zero(rows, rows);
+ DenseMatrix refMat5 = DenseMatrix::Random(rows, rows);
DenseMatrix dm4 = DenseMatrix::Zero(rows, rows);
SparseMatrixType m2(rows, rows);
SparseMatrixType m3(rows, rows);
@@ -57,7 +58,10 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
VERIFY_IS_APPROX(dm4=m2*refMat3.transpose(), refMat4=refMat2*refMat3.transpose());
VERIFY_IS_APPROX(dm4=m2.transpose()*refMat3, refMat4=refMat2.transpose()*refMat3);
VERIFY_IS_APPROX(dm4=m2.transpose()*refMat3.transpose(), refMat4=refMat2.transpose()*refMat3.transpose());
-
+
+ VERIFY_IS_APPROX(dm4=m2*(refMat3+refMat3), refMat4=refMat2*(refMat3+refMat3));
+ VERIFY_IS_APPROX(dm4=m2.transpose()*(refMat3+refMat5)*0.5, refMat4=refMat2.transpose()*(refMat3+refMat5)*0.5);
+
// dense * sparse
VERIFY_IS_APPROX(dm4=refMat2*m3, refMat4=refMat2*refMat3);
VERIFY_IS_APPROX(dm4=refMat2*m3.transpose(), refMat4=refMat2*refMat3.transpose());