aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/sparse_product.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-10-13 15:53:27 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-10-13 15:53:27 +0000
commit765219aa5180c40be86a380524db691a0fd5861b (patch)
treeb3d2cab1eb2c43780a8da9a2e418e1adfd0e7cc3 /bench/sparse_product.cpp
parente2bd8623f88c3e7aa1c4a2eaa5dc7ab351219a33 (diff)
Big API change in Cholesky module:
* rename Cholesky to LLT * rename CholeskyWithoutSquareRoot to LDLT * rename MatrixBase::cholesky() to llt() * rename MatrixBase::choleskyNoSqrt() to ldlt() * make {LLT,LDLT}::solve() API consistent with other modules Note that we are going to keep a source compatibility untill the next beta release. E.g., the "old" Cholesky* classes, etc are still available for some time. To be clear, Eigen beta2 should be (hopefully) source compatible with beta1, and so beta2 will contain all the deprecated API of beta1. Those features marked as deprecated will be removed in beta3 (or in the final 2.0 if there is no beta 3 !). Also includes various updated in sparse Cholesky.
Diffstat (limited to 'bench/sparse_product.cpp')
-rw-r--r--bench/sparse_product.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/bench/sparse_product.cpp b/bench/sparse_product.cpp
index 846301fa5..edeb08c5d 100644
--- a/bench/sparse_product.cpp
+++ b/bench/sparse_product.cpp
@@ -21,6 +21,18 @@
#define MINDENSITY 0.0004
#endif
+#ifndef NBTRIES
+#define NBTRIES 10
+#endif
+
+#define BENCH(X) \
+ timer.reset(); \
+ for (int _j=0; _j<NBTRIES; ++_j) { \
+ timer.start(); \
+ for (int _k=0; _k<REPEAT; ++_k) { \
+ X \
+ } timer.stop(); }
+
int main(int argc, char *argv[])
{
int rows = SIZE;
@@ -77,32 +89,34 @@ int main(int argc, char *argv[])
{
std::cout << "Eigen sparse\t" << density*100 << "%\n";
- timer.reset();
- timer.start();
- for (int k=0; k<REPEAT; ++k)
- sm3 = sm1 * sm2;
- timer.stop();
+// timer.reset();
+// timer.start();
+ BENCH(for (int k=0; k<REPEAT; ++k) sm3 = sm1 * sm2;)
+// timer.stop();
std::cout << " a * b:\t" << timer.value() << endl;
timer.reset();
timer.start();
- for (int k=0; k<REPEAT; ++k)
- sm3 = sm1.transpose() * sm2;
- timer.stop();
+// 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) sm3 = sm1.transpose() * sm2;)
+// timer.stop();
std::cout << " a' * b:\t" << timer.value() << endl;
- timer.reset();
- timer.start();
- for (int k=0; k<REPEAT; ++k)
- sm3 = sm1.transpose() * sm2.transpose();
- timer.stop();
+// timer.reset();
+// timer.start();
+ BENCH( for (int k=0; k<REPEAT; ++k) sm3 = sm1.transpose() * sm2.transpose(); )
+// timer.stop();
std::cout << " a' * b':\t" << timer.value() << endl;
- timer.reset();
- timer.start();
- for (int k=0; k<REPEAT; ++k)
- sm3 = sm1 * sm2.transpose();
- timer.stop();
+// timer.reset();
+// timer.start();
+ BENCH( for (int k=0; k<REPEAT; ++k) sm3 = sm1 * sm2.transpose(); )
+// timer.stop();
std::cout << " a * b' :\t" << timer.value() << endl;
}