aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/spbench
diff options
context:
space:
mode:
authorGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2012-07-18 16:59:00 +0200
committerGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2012-07-18 16:59:00 +0200
commitb0cba2d988de3f4535e0b7ac9799b19700e09b7c (patch)
tree3a388b78a6c8eeb79827c44ea15ce8aeb9c21854 /bench/spbench
parent773804691a9203af41c06109f79372a048a584df (diff)
Add a draft (not clean ) version of the COLAMD ordering implementation
Diffstat (limited to 'bench/spbench')
-rw-r--r--bench/spbench/test_sparseLU.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/bench/spbench/test_sparseLU.cpp b/bench/spbench/test_sparseLU.cpp
index 841011f30..6fbf03454 100644
--- a/bench/spbench/test_sparseLU.cpp
+++ b/bench/spbench/test_sparseLU.cpp
@@ -6,6 +6,7 @@
#include <iomanip>
#include <unsupported/Eigen/SparseExtra>
#include <Eigen/SparseLU>
+#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
@@ -17,10 +18,12 @@ int main(int argc, char **args)
typedef Matrix<double, Dynamic, Dynamic> DenseMatrix;
typedef Matrix<double, Dynamic, 1> DenseRhs;
VectorXd b, x, tmp;
- SparseLU<SparseMatrix<double, ColMajor>, AMDOrdering<int> > solver;
+// SparseLU<SparseMatrix<double, ColMajor>, AMDOrdering<int> > solver;
+ SparseLU<SparseMatrix<double, ColMajor>, COLAMDOrdering<int> > solver;
ifstream matrix_file;
string line;
int n;
+ BenchTimer timer;
// Set parameters
/* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */
@@ -53,13 +56,26 @@ int main(int argc, char **args)
/* Compute the factorization */
// solver.isSymmetric(true);
- solver.compute(A);
-
+ timer.start();
+// solver.compute(A);
+ solver.analyzePattern(A);
+ timer.stop();
+ cout << "Time to analyze " << timer.value() << std::endl;
+ timer.reset();
+ timer.start();
+ solver.factorize(A);
+ timer.stop();
+ cout << "Factorize Time " << timer.value() << std::endl;
+ timer.reset();
+ timer.start();
solver._solve(b, x);
+ timer.stop();
+ cout << "solve time " << timer.value() << std::endl;
/* Check the accuracy */
VectorXd tmp2 = b - A*x;
double tempNorm = tmp2.norm()/b.norm();
cout << "Relative norm of the computed solution : " << tempNorm <<"\n";
+ cout << "Number of nonzeros in the factor : " << solver.nnzL() + solver.nnzU() << std::endl;
return 0;
} \ No newline at end of file