7 #include <Eigen/Jacobi> 8 #include <Eigen/Householder> 9 #include <Eigen/IterativeLinearSolvers> 11 #include <unsupported/Eigen/SparseExtra> 13 #include <Eigen/SuperLUSupport> 16 #include <unsupported/Eigen/IterativeSolvers> 18 using namespace Eigen;
37 if (argc < 2) assert(
false &&
"please, give the matrix market file ");
42 cout <<
"End charging matrix " << endl;
43 bool iscomplex=
false, isvector=
false;
46 if (iscomplex) { cout<<
" Not for complex matrices \n";
return -1; }
47 if (isvector) { cout <<
"The provided file is not a matrix file\n";
return -1;}
71 cout<<
"Time to load the matrix " << timer.
value() <<endl;
82 for (
int i = 0;
i <
n;
i++) tmp(
i) =
i;
90 cout<<
"Starting the factorization "<< endl;
93 cout<<
"Size of Input Matrix "<< b.size()<<
"\n\n";
94 cout<<
"Rows and columns "<< A.
rows() <<
" " <<A.
cols() <<
"\n";
99 std::cout<<
"The solver failed \n";
103 float time_comp = timer.
value();
104 cout <<
" Compute Time " << time_comp<< endl;
111 float time_solve = timer.
value();
112 cout<<
" Time to solve " << time_solve << endl;
115 VectorXd tmp2 = b - A*
x;
116 double tempNorm = tmp2.norm()/b.norm();
117 cout <<
"Relative norm of the computed solution : " << tempNorm <<
"\n";
121 cout <<
"Total time " << totaltime.
value() <<
"\n";
ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView() const
Matrix< Scalar, Dynamic, Dynamic > DenseMatrix
bool loadMarketVector(VectorType &vec, const std::string &filename)
A versatible sparse matrix representation.
Modified Incomplete Cholesky with dual threshold.
const Solve< ConjugateGradient< _MatrixType, _UpLo, _Preconditioner >, Rhs > solve(const MatrixBase< Rhs > &b) const
Namespace containing all symbols from the Eigen library.
A conjugate gradient solver for sparse (or dense) self-adjoint problems.
BiCGSTAB< SparseMatrix< double > > solver
bool getMarketHeader(const std::string &filename, int &sym, bool &iscomplex, bool &isvector)
int main(int argc, char **args)
ConjugateGradient< _MatrixType, _UpLo, _Preconditioner > & compute(const EigenBase< MatrixDerived > &A)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
ComputationInfo info() const
double value(int TIMER=CPU_TIMER) const
bool loadMarket(SparseMatrixType &mat, const std::string &filename)
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x