23#define ICNTL(I) icntl[(I)-1]
26#define USE_COMM_WORLD -987654
39template <
class Scalar>
45 void printMatrixInfo()
49 const char *s =
"UNKNOWN";
54 std::cout <<
"MUMPS" <<
" solver, n=" << n <<
", nnz=" << N <<
", matrix is " << s <<
'\n';
70 std::vector<MUMPS_INT>& ridx,
71 std::vector<MUMPS_INT>& cidx,
72 std::vector<Scalar>& values,
76 assert(cidx.size()==N && values.size()==N);
85 for (MUMPS_INT i=0; i<N; ++i)
86 if (cidx[i] > ridx[i])
97 mumps_par.ICNTL(3) = 0;
98 callMumps(&mumps_par);
109 switch (this->
options.matrixProperty)
125 callMumps(&mumps_par);
126 if (this->
options.verbosity < 1)
127 mumps_par.ICNTL(3) = 0;
128 mumps_par.ICNTL(14) += 5;
138 for (
int k=0; k<N; k++)
146 && this->options.mumps.inertia)
148 mumps_par.ICNTL(24) = 1;
149 mumps_par.cntl[2] = this->
options.mumps.zeroPivotThreshold;
151 callMumps(&mumps_par);
152 if (mumps_par.info[0] < 0)
161 callMumps(&mumps_par);
162 if (mumps_par.info[0] < 0)
165 switch(mumps_par.info[0])
169 size_t entries = mumps_par.info[1]<0? -1000000*mumps_par.info[1]: mumps_par.info[1];
170 errmsg =
"\nAllocation of " + std::to_string(entries) +
" scalar entries (" + std::to_string(entries*
sizeof(
Scalar)/1024/1024) +
"MB) failed.";
176 throw DirectSolverException(
"MUMPS factorization failed with error " + std::to_string(mumps_par.info[0])+errmsg,__FILE__,__LINE__);
180 && this->options.mumps.inertia) {
181 this->
info_.mumps.negativePivots = mumps_par.infog[11];
182 this->
info_.mumps.zeroPivots = mumps_par.infog[27];
191 void solve(std::vector<Scalar>
const& b, std::vector<Scalar>& x,
bool transpose=
false)
const
211 void solve(std::vector<Scalar>& b)
const
221 callMumps(&mumps_par);
222 if (mumps_par.info[0] < 0)
235 void callMumps(SMUMPS_STRUC_C* mumpsPar)
const
240 void callMumps(DMUMPS_STRUC_C* mumpsPar)
const
247 using MumpsStruct = std::conditional_t<std::is_same<Scalar, float>::value, SMUMPS_STRUC_C, DMUMPS_STRUC_C>;
248 mutable MumpsStruct mumps_par;
To be raised if a direct solver fails.
FactorizationOptions Options
void solve(std::vector< Scalar > const &b, std::vector< Scalar > &x, bool transpose=false) const
Solves the system for the given right hand side.
void solve(Scalar const *b, Scalar *x, bool transpose=false) const
Solves the system for the given right hand side .
void solve(std::vector< Scalar > &b) const
Solves the system for the given right hand side.
size_t size() const
reports the dimension of the system
MUMPSFactorization(MUMPS_INT n_, std::vector< MUMPS_INT > &ridx, std::vector< MUMPS_INT > &cidx, std::vector< Scalar > &values, typename Base::Options options)
Constructor taking input data in triplet format (aka coordinate format).
void solve(Scalar *b) const
void analyze(MUMPS_INT *irn, MUMPS_INT *jcn)
void factorize(Scalar *a)
MatrixProperties matrixProperty
We can specify the properties of the matrix, which might be taken into account for selecing an orderi...