25#include "rheolef/cg.h"
26#include "rheolef/gmres.h"
27#include "rheolef/vec_expr_v2.h"
28#include "rheolef/eye.h"
30#pragma GCC diagnostic push
31#pragma GCC diagnostic ignored "-Weffc++"
33#pragma GCC diagnostic pop
38template<
class T,
class M>
42 if (!_precond.initialized()) {
43 _precond = eye_basic<T,M>();
46 if (_a.is_symmetric() && _a.is_definite_positive()) {
47 int status =
cg (_a, x, b, _precond, base::option());
49 using namespace Eigen;
50 size_type m = base::option().krylov_dimension;
51 Matrix<T,Dynamic,Dynamic> h(m+1,m+1);
52 Matrix<T,Dynamic,1> dummy(m);
53 int status =
gmres (_a, x, b, _precond, h, dummy, base::option());
56 "solver: precision "<<base::option().tol<<
" not reached: get "<<base::option().
residue
57 <<
" after " << base::option().max_iter <<
" iterations");
59 "solver: precision "<<base::option().tol<<
" not reached: get "<<base::option().
residue
60 <<
" after " << base::option().max_iter <<
" iterations");
63template<
class T,
class M>
67 if (_a.is_symmetric())
return solve(b);
72template <
class T,
class M>
76 error_macro (
"undefined determinant computation for iterative solver (HINT: use a direct method)");
84#ifdef _RHEOLEF_HAVE_MPI
determinant_type det() const
base::size_type size_type
vec< T, M > trans_solve(const vec< T, M > &rhs) const
vec< T, M > solve(const vec< T, M > &rhs) const
see the vec page for the full documentation
#define error_macro(message)
#define warning_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
void solve(tiny_matrix< T > &a, tiny_vector< size_t > &piv, const tiny_vector< T > &b, tiny_vector< T > &x)
int gmres(const Matrix &A, Vector &x, const Vector &b, const Preconditioner &M, SmallMatrix &H, const SmallVector &V, const solver_option &sopt=solver_option())
int cg(const Matrix &A, Vector &x, const Vector2 &Mb, const Preconditioner &M, const solver_option &sopt=solver_option())
field residue(Float p, const field &uh)