23 #include "rheolef/ilut.h"
25 #ifdef _RHEOLEF_HAVE_EIGEN
32 template<
class T,
class M>
36 using namespace Eigen;
37 Matrix<int,Dynamic,1> nnz_row (
a.nrow());
40 nnz_row[i] = ia[i+1] - ia[i];
42 SparseMatrix<T> a_tmp (
a.nrow(),
a.ncol());
44 a_tmp.reserve (nnz_row);
48 a_tmp.insert (i, (*p).first) = (*p).second;
51 a_tmp.makeCompressed();
53 warning_macro (
"fill_factor="<<_fill_factor<<
" drop_tol="<<_drop_tol);
54 _ilut_a.setFillfactor (
int(_fill_factor));
55 _ilut_a.setDroptol (
T(_drop_tol));
56 _ilut_a.compute (a_tmp);
57 check_macro (_ilut_a.info() == Success,
"building ILUT preconditioner failed");
60 template<
class T,
class M>
64 if (
b.dis_size() == 0)
return b;
66 using namespace Eigen;
67 Map<Matrix<T,Dynamic,1> > b_map ((
T*)(&(*
b.begin())),
b.size()),
68 x_map ( &(*x.begin()), x.size());
69 x_map = _ilut_a.solve (b_map);
72 template<
class T,
class M>
76 if (
b.dis_size() == 0)
return b;
78 fatal_macro (
"ilut trans_solve: not implemented, sorry");
87 #ifdef _RHEOLEF_HAVE_MPI
89 #endif // _RHEOLEF_HAVE_MPI