From b0cba2d988de3f4535e0b7ac9799b19700e09b7c Mon Sep 17 00:00:00 2001 From: Desire NUENTSA Date: Wed, 18 Jul 2012 16:59:00 +0200 Subject: Add a draft (not clean ) version of the COLAMD ordering implementation --- bench/spbench/test_sparseLU.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'bench/spbench') 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 #include #include +#include using namespace std; using namespace Eigen; @@ -17,10 +18,12 @@ int main(int argc, char **args) typedef Matrix DenseMatrix; typedef Matrix DenseRhs; VectorXd b, x, tmp; - SparseLU, AMDOrdering > solver; +// SparseLU, AMDOrdering > solver; + SparseLU, COLAMDOrdering > 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 -- cgit v1.2.3