From f0238cfb6997c4acfc2bd200de7295f3fa36968f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Mar 2019 21:09:10 +0100 Subject: don't index Eigen --- eigen/bench/sparse_lu.cpp | 132 ---------------------------------------------- 1 file changed, 132 deletions(-) delete mode 100644 eigen/bench/sparse_lu.cpp (limited to 'eigen/bench/sparse_lu.cpp') diff --git a/eigen/bench/sparse_lu.cpp b/eigen/bench/sparse_lu.cpp deleted file mode 100644 index 5c75001..0000000 --- a/eigen/bench/sparse_lu.cpp +++ /dev/null @@ -1,132 +0,0 @@ - -// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out - -#define EIGEN_SUPERLU_SUPPORT -#define EIGEN_UMFPACK_SUPPORT -#include - -#define NOGMM -#define NOMTL - -#ifndef SIZE -#define SIZE 10 -#endif - -#ifndef DENSITY -#define DENSITY 0.01 -#endif - -#ifndef REPEAT -#define REPEAT 1 -#endif - -#include "BenchSparseUtil.h" - -#ifndef MINDENSITY -#define MINDENSITY 0.0004 -#endif - -#ifndef NBTRIES -#define NBTRIES 10 -#endif - -#define BENCH(X) \ - timer.reset(); \ - for (int _j=0; _j VectorX; - -#include - -template -void doEigen(const char* name, const EigenSparseMatrix& sm1, const VectorX& b, VectorX& x, int flags = 0) -{ - std::cout << name << "..." << std::flush; - BenchTimer timer; timer.start(); - SparseLU lu(sm1, flags); - timer.stop(); - if (lu.succeeded()) - std::cout << ":\t" << timer.value() << endl; - else - { - std::cout << ":\t FAILED" << endl; - return; - } - - bool ok; - timer.reset(); timer.start(); - ok = lu.solve(b,&x); - timer.stop(); - if (ok) - std::cout << " solve:\t" << timer.value() << endl; - else - std::cout << " solve:\t" << " FAILED" << endl; - - //std::cout << x.transpose() << "\n"; -} - -int main(int argc, char *argv[]) -{ - int rows = SIZE; - int cols = SIZE; - float density = DENSITY; - BenchTimer timer; - - VectorX b = VectorX::Random(cols); - VectorX x = VectorX::Random(cols); - - bool densedone = false; - - //for (float density = DENSITY; density>=MINDENSITY; density*=0.5) -// float density = 0.5; - { - EigenSparseMatrix sm1(rows, cols); - fillMatrix(density, rows, cols, sm1); - - // dense matrices - #ifdef DENSEMATRIX - if (!densedone) - { - densedone = true; - std::cout << "Eigen Dense\t" << density*100 << "%\n"; - DenseMatrix m1(rows,cols); - eiToDense(sm1, m1); - - BenchTimer timer; - timer.start(); - FullPivLU lu(m1); - timer.stop(); - std::cout << "Eigen/dense:\t" << timer.value() << endl; - - timer.reset(); - timer.start(); - lu.solve(b,&x); - timer.stop(); - std::cout << " solve:\t" << timer.value() << endl; -// std::cout << b.transpose() << "\n"; -// std::cout << x.transpose() << "\n"; - } - #endif - - #ifdef EIGEN_UMFPACK_SUPPORT - x.setZero(); - doEigen("Eigen/UmfPack (auto)", sm1, b, x, 0); - #endif - - #ifdef EIGEN_SUPERLU_SUPPORT - x.setZero(); - doEigen("Eigen/SuperLU (nat)", sm1, b, x, Eigen::NaturalOrdering); -// doEigen("Eigen/SuperLU (MD AT+A)", sm1, b, x, Eigen::MinimumDegree_AT_PLUS_A); -// doEigen("Eigen/SuperLU (MD ATA)", sm1, b, x, Eigen::MinimumDegree_ATA); - doEigen("Eigen/SuperLU (COLAMD)", sm1, b, x, Eigen::ColApproxMinimumDegree); - #endif - - } - - return 0; -} - -- cgit v1.2.3