aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/sparse_product.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-01-20 16:50:47 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-01-20 16:50:47 +0000
commitf645d1f911fe31ed9a1203681956fd87bc49fcf3 (patch)
treeb28c5d95d9a372b3f16637d7f916ca81a888f102 /bench/sparse_product.cpp
parent8973d12cdae503e0996edd52f8c78879274c0e70 (diff)
* complete the support of QVector via a QtAlignedMalloc header
* add a unit test for QVector which shows the issue with QVector::fill
Diffstat (limited to 'bench/sparse_product.cpp')
-rw-r--r--bench/sparse_product.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/bench/sparse_product.cpp b/bench/sparse_product.cpp
index dfb4b4335..61eb213e6 100644
--- a/bench/sparse_product.cpp
+++ b/bench/sparse_product.cpp
@@ -137,6 +137,44 @@ int main(int argc, char *argv[])
// timer.stop();
std::cout << " a * b' :\t" << timer.value() << endl;
}
+
+ // eigen dyn-sparse matrices
+ {
+ DynamicSparseMatrix<Scalar> m1(sm1), m2(sm2), m3(sm3);
+ std::cout << "Eigen dyn-sparse\t" << m1.nonZeros()/float(m1.rows()*m1.cols())*100 << "% * "
+ << m2.nonZeros()/float(m2.rows()*m2.cols())*100 << "%\n";
+
+// timer.reset();
+// timer.start();
+ BENCH(for (int k=0; k<REPEAT; ++k) m3 = m1 * m2;)
+// timer.stop();
+ std::cout << " a * b:\t" << timer.value() << endl;
+// std::cout << sm3 << "\n";
+
+ timer.reset();
+ timer.start();
+// std::cerr << "transpose...\n";
+// EigenSparseMatrix sm4 = sm1.transpose();
+// std::cout << sm4.nonZeros() << " == " << sm1.nonZeros() << "\n";
+// exit(1);
+// std::cerr << "transpose OK\n";
+// std::cout << sm1 << "\n\n" << sm1.transpose() << "\n\n" << sm4.transpose() << "\n\n";
+ BENCH(for (int k=0; k<REPEAT; ++k) m3 = m1.transpose() * m2;)
+// timer.stop();
+ std::cout << " a' * b:\t" << timer.value() << endl;
+
+// timer.reset();
+// timer.start();
+ BENCH( for (int k=0; k<REPEAT; ++k) m3 = m1.transpose() * m2.transpose(); )
+// timer.stop();
+ std::cout << " a' * b':\t" << timer.value() << endl;
+
+// timer.reset();
+// timer.start();
+ BENCH( for (int k=0; k<REPEAT; ++k) m3 = m1 * m2.transpose(); )
+// timer.stop();
+ std::cout << " a * b' :\t" << timer.value() << endl;
+ }
// CSparse
#ifdef CSPARSE