4#ifndef DUNE_ISTL_SOLVERS_HH
5#define DUNE_ISTL_SOLVERS_HH
21#include <dune/common/deprecated.hh>
22#include <dune/common/exceptions.hh>
23#include <dune/common/timer.hh>
24#include <dune/common/ftraits.hh>
25#include <dune/common/typetraits.hh>
88 template<
class L,
class P>
91 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
93 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
94 "L and P have to have the same category!");
96 "L has to be sequential!");
119 template<
class L,
class S,
class P>
122 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
124 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
125 "L and P must have the same category!");
126 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
127 "L and S must have the same category!");
152 std::cout <<
"=== LoopSolver" << std::endl;
165 for ( ; i<=_maxit; i++ )
178 res.converged =
true;
184 i=std::min(_maxit,i);
196 res.conv_rate =
pow(
res.reduction,1.0/i);
202 std::cout <<
"=== rate=" <<
res.conv_rate
203 <<
", T=" <<
res.elapsed
204 <<
", TIT=" <<
res.elapsed/i
205 <<
", IT=" << i << std::endl;
213 _reduction = reduction;
214 (*this).apply(x,b,
res);
249 template<
class L,
class P>
252 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
254 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
255 "L and P have to have the same category!");
257 "L has to be sequential!");
264 template<
class L,
class S,
class P>
267 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
269 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
270 "L and P have to have the same category!");
271 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
272 "L and S have to have the same category!");
294 std::cout <<
"=== GradientSolver" << std::endl;
304 for ( ; i<=_maxit; i++ )
309 lambda = _sp.dot(p,b)/_sp.dot(
q,p);
320 res.converged =
true;
326 i=std::min(_maxit,i);
333 res.reduction =
static_cast<double>(
def/
def0);
334 res.conv_rate =
static_cast<double>(
pow(
res.reduction,1.0/i));
337 std::cout <<
"=== rate=" <<
res.conv_rate
338 <<
", T=" <<
res.elapsed
339 <<
", TIT=" <<
res.elapsed/i
340 <<
", IT=" << i << std::endl;
351 _reduction = reduction;
352 (*this).apply(x,b,
res);
386 template<
class L,
class P>
388 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
390 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
391 "L and P must have the same category!");
393 "L must be sequential!");
400 template<
class L,
class S,
class P>
402 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
404 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
405 "L and P must have the same category!");
406 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
407 "L and S must have the same category!");
438 std::cout <<
"=== CGSolver: abort due to infinite or NaN initial defect"
441 <<
" is infinite or NaN");
446 res.converged =
true;
452 std::cout <<
"=== rate=" <<
res.conv_rate
453 <<
", T=" <<
res.elapsed <<
", TIT=" <<
res.elapsed
454 <<
", IT=0" << std::endl;
460 std::cout <<
"=== CGSolver" << std::endl;
478 for ( ; i<=_maxit; i++ )
482 alpha = _sp.dot(p,
q);
497 std::cout <<
"=== CGSolver: abort due to infinite or NaN defect"
500 "CGSolver: defect=" <<
def <<
" is infinite or NaN");
505 res.converged =
true;
520 i=std::min(_maxit,i);
527 res.reduction =
static_cast<double>(
def/
def0);
528 res.conv_rate =
static_cast<double>(
pow(
res.reduction,1.0/i));
533 std::cout <<
"=== rate=" <<
res.conv_rate
534 <<
", T=" <<
res.elapsed
535 <<
", TIT=" <<
res.elapsed/i
536 <<
", IT=" << i << std::endl;
551 virtual void apply (X& x, X& b,
double reduction,
555 _reduction = reduction;
556 (*this).apply(x,b,
res);
590 template<
class L,
class P>
593 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
595 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
596 "L and P must be of the same category!");
598 "L must be sequential!");
605 template<
class L,
class S,
class P>
608 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
610 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
611 "L and P must have the same category!");
612 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
613 "L and S must have the same category!");
664 std::cout <<
"=== BiCGSTABSolver" << std::endl;
674 if ( norm < (_reduction *
norm_0) || norm<1
E-30)
689 for (
it = 0.5;
it < _maxit;
it+=.5)
702 <<
" after " <<
it <<
" iterations");
706 <<
" after " <<
it <<
" iterations");
732 <<
" after " <<
it <<
" iterations");
754 if ( norm < (_reduction *
norm_0) )
793 if ( norm < (_reduction *
norm_0) || norm<1
E-30)
803 it=std::min(
static_cast<double>(_maxit),
it);
809 res.iterations =
static_cast<int>(std::ceil(
it));
810 res.reduction =
static_cast<double>(norm/
norm_0);
811 res.conv_rate =
static_cast<double>(
pow(
res.reduction,1.0/
it));
814 std::cout <<
"=== rate=" <<
res.conv_rate
815 <<
", T=" <<
res.elapsed
816 <<
", TIT=" <<
res.elapsed/
it
817 <<
", IT=" <<
it << std::endl;
830 _reduction = reduction;
831 (*this).apply(x,b,
res);
868 template<
class L,
class P>
870 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
872 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
873 "L and P must have the same category!");
875 "L must be sequential!");
882 template<
class L,
class S,
class P>
884 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose)
886 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
887 "L and P must have the same category!");
888 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
889 "L and S must have the same category!");
916 std::cout <<
"=== MINRESSolver" << std::endl;
925 res.converged =
true;
932 std::cout <<
"=== rate=" <<
res.conv_rate
933 <<
", T=" <<
res.elapsed
934 <<
", TIT=" <<
res.elapsed
935 <<
", IT=" <<
res.iterations
945 std::array<real_type,2> c{{0.0,0.0}};
947 std::array<field_type,2>
s{{0.0,0.0}};
950 std::array<field_type,3> T{{0.0,0.0,0.0}};
953 std::array<field_type,2>
xi{{1.0,0.0}};
964 beta =
sqrt(_sp.dot(b,
z));
968 std::array<X,3> p{{b,b,b}};
974 std::array<X,3>
q{{b,b,b}};
983 for( ; i<=_maxit; i++) {
996 alpha = _sp.dot(
z,
q[
i2]);
1017 T[2] = c[(i+1)%2]*alpha -
s[(i+1)%2]*T[1];
1018 T[1] = c[(i+1)%2]*T[1] +
s[(i+1)%2]*alpha;
1024 generateGivensRotation(T[2],beta,c[i%2],
s[i%2]);
1026 T[2] = c[i%2]*T[2] +
s[i%2]*beta;
1028 xi[i%2] = -
s[i%2]*
xi[(i+1)%2];
1029 xi[(i+1)%2] *= c[i%2];
1033 p[
i2].axpy(-T[1],p[
i1]);
1034 p[
i2].axpy(-T[0],p[
i0]);
1051 if(
def <
def0*_reduction ||
def < 1
e-30 || i == _maxit ) {
1052 res.converged =
true;
1064 res.reduction =
static_cast<double>(
def/
def0);
1065 res.conv_rate =
static_cast<double>(
pow(
res.reduction,1.0/i));
1070 std::cout <<
"=== rate=" <<
res.conv_rate
1071 <<
", T=" <<
res.elapsed
1072 <<
", TIT=" <<
res.elapsed/i
1073 <<
", IT=" << i << std::endl;
1085 _reduction = reduction;
1086 (*this).apply(x,b,
res);
1101 }
else if(norm_dx < 1e-15) {
1104 }
else if(norm_dy > norm_dx) {
1106 cs = 1.0/sqrt(1.0 + temp*temp);
1115 cs = 1.0/sqrt(1.0 + temp*temp);
1123 SeqScalarProduct<X> ssp;
1124 LinearOperator<X,X>& _op;
1125 Preconditioner<X,X>& _prec;
1126 ScalarProduct<X>& _sp;
1145 template<
class X,
class Y=X,
class F = Y>
1160 template<
class L,
class P>
1161 DUNE_DEPRECATED_MSG(
"recalc_defect is a unused parameter! Use RestartedGMResSolver(L& op, P& prec, real_type reduction, int restart, int maxit, int verbose) instead")
1168 , _reduction(reduction)
1172 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(L::category),
1173 "P and L must be the same category!");
1175 "L must be sequential!");
1185 template<
class L,
class P>
1188 ssp(), _sp(ssp), _restart(
restart),
1189 _reduction(reduction), _maxit(
maxit), _verbose(verbose)
1191 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(L::category),
1192 "P and L must be the same category!");
1194 "L must be sequential!");
1197 template<
class L,
class S,
class P>
1198 DUNE_DEPRECATED_MSG(
"recalc_defect is a unused parameter! Use RestartedGMResSolver(L& op, S& sp, P& prec, real_type reduction, int restart, int maxit, int verbose) instead")
1204 , _reduction(reduction)
1208 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(L::category),
1209 " P and L must have the same category!");
1210 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(S::category),
1211 "P and S must have the same category!");
1220 template<
class L,
class S,
class P>
1224 _reduction(reduction), _maxit(
maxit), _verbose(verbose)
1226 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(L::category),
1227 "P and L must have the same category!");
1228 static_assert(
static_cast<int>(P::category) ==
static_cast<int>(S::category),
1229 "P and S must have the same category!");
1257 const int m = _restart;
1260 std::vector<field_type>
s(m+1),
sn(m);
1261 std::vector<real_type>
cs(m);
1266 std::vector< std::vector<field_type> >
H(m+1,
s);
1267 std::vector<F> v(m+1,b);
1278 _A.applyscaleadd(-1.0,x,b);
1280 v[0] = 0.0; _W.apply(v[0],b);
1288 std::cout <<
"=== RestartedGMResSolver" << std::endl;
1297 res.converged =
true;
1302 while(j <= _maxit &&
res.converged !=
true) {
1307 for(i=1; i<m+1; i++)
1310 for(i=0; i < m && j <= _maxit &&
res.converged !=
true; i++, j++) {
1315 _A.apply(v[i],v[i+1]);
1317 for(
int k=0; k<i+1; k++) {
1322 H[k][i] = _sp.dot(v[k],
w);
1324 w.axpy(-
H[k][i],v[k]);
1326 H[i+1][i] = _sp.norm(
w);
1329 "breakdown in GMRes - |w| == 0.0 after " << j <<
" iterations");
1332 v[i+1] =
w; v[i+1] *= 1.0/
H[i+1][i];
1335 for(
int k=0; k<i; k++)
1336 applyPlaneRotation(
H[k][i],
H[k+1][i],
cs[k],
sn[k]);
1339 generatePlaneRotation(
H[i][i],
H[i+1][i],
cs[i],
sn[i]);
1341 applyPlaneRotation(
H[i][i],
H[i+1][i],
cs[i],
sn[i]);
1342 applyPlaneRotation(
s[i],
s[i+1],
cs[i],
sn[i]);
1355 if(norm < reduction *
norm_0)
1356 res.converged =
true;
1369 if(
res.converged !=
true && j <= _maxit ) {
1372 std::cout <<
"=== GMRes::restart" << std::endl;
1376 _A.applyscaleadd(-1.0,x,b);
1380 norm = _sp.norm(v[0]);
1390 res.iterations = j-1;
1391 res.reduction =
static_cast<double>(norm/
norm_0);
1392 res.conv_rate =
static_cast<double>(
pow(
res.reduction,1.0/(j-1)));
1403 int k =
res.iterations>0 ?
res.iterations : 1;
1404 std::cout <<
"=== rate=" <<
res.conv_rate
1405 <<
", T=" <<
res.elapsed
1406 <<
", TIT=" <<
res.elapsed/k
1407 <<
", IT=" <<
res.iterations
1411 void update(X& w,
int i,
1412 const std::vector<std::vector<field_type> >& H,
1413 const std::vector<field_type>& s,
1414 const std::vector<X>& v) {
1416 std::vector<field_type> y(s);
1419 for(
int a=i-1; a>=0; a--) {
1421 for(
int b=a+1; b<i; b++)
1422 rhs -= H[a][b]*y[b];
1431 template<
typename T>
1432 typename std::enable_if<std::is_same<field_type,real_type>::value,T>::type conjugate(
const T& t) {
1436 template<
typename T>
1437 typename std::enable_if<!std::is_same<field_type,real_type>::value,T>::type conjugate(
const T& t) {
1448 if(norm_dy < 1e-15) {
1451 }
else if(norm_dx < 1e-15) {
1454 }
else if(norm_dy > norm_dx) {
1456 cs = 1.0/sqrt(1.0 + temp*temp);
1460 sn *= conjugate(dy)/norm_dy;
1463 cs = 1.0/sqrt(1.0 + temp*temp);
1465 sn *= conjugate(dy/dx);
1474 dy = -conjugate(sn) * dx + cs * dy;
1478 LinearOperator<X,Y>& _A;
1479 Preconditioner<X,Y>& _W;
1480 SeqScalarProduct<X> ssp;
1481 ScalarProduct<X>& _sp;
1522 template<
class L,
class P>
1525 ssp(), _op(
op), _prec(
prec), _sp(ssp), _reduction(reduction), _maxit(
maxit),
1528 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
1529 "L and P have to have the same category!");
1530 static_assert(
static_cast<int>(L::category) ==
1532 "L has to be sequential!");
1541 template<
class L,
class P,
class S>
1544 _op(
op), _prec(
prec), _sp(
sp), _reduction(reduction), _maxit(
maxit), _verbose(verbose),
1547 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(P::category),
1548 "L and P must have the same category!");
1549 static_assert(
static_cast<int>(L::category) ==
static_cast<int>(S::category),
1550 "L and S must have the same category!");
1564 std::vector<std::shared_ptr<X> > p(_restart);
1565 std::vector<typename X::field_type>
pp(_restart);
1569 p[0].reset(
new X(x));
1574 res.converged =
true;
1580 std::cout <<
"=== rate=" <<
res.conv_rate
1581 <<
", T=" <<
res.elapsed <<
", TIT=" <<
res.elapsed
1582 <<
", IT=0" << std::endl;
1588 std::cout <<
"=== GeneralizedPCGSolver" << std::endl;
1602 _prec.
apply(*(p[0]),b);
1603 rho = _sp.dot(*(p[0]),b);
1605 pp[0] = _sp.dot(*(p[0]),
q);
1617 res.converged =
true;
1620 std::cout <<
"=== rate=" <<
res.conv_rate
1621 <<
", T=" <<
res.elapsed
1622 <<
", TIT=" <<
res.elapsed
1623 <<
", IT=" << 1 << std::endl;
1630 int end=std::min(_restart, _maxit-i+1);
1631 for (
ii=1;
ii<end; ++
ii )
1641 for(
int j=0; j<
ii; ++j) {
1642 rho =_sp.dot(
q,*(p[j]))/
pp[j];
1643 p[
ii]->axpy(-
rho, *(p[j]));
1649 rho = _sp.dot(*(p[
ii]),b);
1663 res.converged =
true;
1670 *(p[0])=*(p[_restart-1]);
1671 pp[0]=
pp[_restart-1];
1681 res.conv_rate =
pow(
res.reduction,1.0/i);
1686 std::cout <<
"=== rate=" <<
res.conv_rate
1687 <<
", T=" <<
res.elapsed
1688 <<
", TIT=" <<
res.elapsed/i
1689 <<
", IT=" << i+1 << std::endl;
1698 virtual void apply (X& x, X& b,
double reduction,
1702 _reduction = reduction;
1703 (*this).apply(x,b,
res);
Define general, extensible interface for operators. The available implementation wraps a matrix.
Define base class for scalar product and norm.
Define general, extensible interface for inverse operators.
Definition basearray.hh:19
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:81
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:43
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0
apply operator to x, scale and add:
virtual void apply(const X &x, Y &y) const =0
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
virtual void post(X &x)=0
Clean up.
virtual void apply(X &v, const Y &d)=0
Apply one step of the preconditioner to the system A(v)=d.
virtual void pre(X &x, Y &b)=0
Prepare the preconditioner.
Statistics about the application of an inverse operator.
Definition solver.hh:32
Abstract base class for all solvers.
Definition solver.hh:79
void printHeader(std::ostream &s) const
helper function for printing header of solver output
Definition solver.hh:127
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm, const DataType &norm_old) const
helper function for printing solver output
Definition solver.hh:136
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:21
Preconditioned loop solver.
Definition solvers.hh:58
X range_type
The range type of the operator that we do the inverse for.
Definition solvers.hh:63
X domain_type
The domain type of the operator that we do the inverse for.
Definition solvers.hh:61
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:67
LoopSolver(L &op, P &prec, real_type reduction, int maxit, int verbose)
Set up Loop solver.
Definition solvers.hh:89
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition solvers.hh:132
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition solvers.hh:210
LoopSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose)
Set up loop solver.
Definition solvers.hh:120
X::field_type field_type
The field type of the operator that we do the inverse for.
Definition solvers.hh:65
gradient method
Definition solvers.hh:232
X domain_type
The domain type of the operator that we do the inverse for.
Definition solvers.hh:235
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:280
GradientSolver(L &op, P &prec, real_type reduction, int maxit, int verbose)
Set up solver.
Definition solvers.hh:250
GradientSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose)
Set up solver.
Definition solvers.hh:265
X range_type
The range type of the operator that we do the inverse for.
Definition solvers.hh:237
X::field_type field_type
The field type of the operator that we do the inverse for.
Definition solvers.hh:239
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:241
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solvers.hh:348
conjugate gradient method
Definition solvers.hh:370
X range_type
The range type of the operator to be inverted.
Definition solvers.hh:375
X domain_type
The domain type of the operator to be inverted.
Definition solvers.hh:373
CGSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose)
Set up conjugate gradient solver.
Definition solvers.hh:401
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:421
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solvers.hh:551
CGSolver(L &op, P &prec, real_type reduction, int maxit, int verbose)
Set up conjugate gradient solver.
Definition solvers.hh:387
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:379
X::field_type field_type
The field type of the operator to be inverted.
Definition solvers.hh:377
Bi-conjugate Gradient Stabilized (BiCG-STAB)
Definition solvers.hh:574
BiCGSTABSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose)
Set up solver.
Definition solvers.hh:606
X domain_type
The domain type of the operator to be inverted.
Definition solvers.hh:577
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:583
X range_type
The range type of the operator to be inverted.
Definition solvers.hh:579
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:623
X::field_type field_type
The field type of the operator to be inverted.
Definition solvers.hh:581
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solvers.hh:827
BiCGSTABSolver(L &op, P &prec, real_type reduction, int maxit, int verbose)
Set up solver.
Definition solvers.hh:591
Minimal Residual Method (MINRES)
Definition solvers.hh:852
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:897
X::field_type field_type
The field type of the operator to be inverted.
Definition solvers.hh:859
MINRESSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose)
Set up MINRES solver.
Definition solvers.hh:883
MINRESSolver(L &op, P &prec, real_type reduction, int maxit, int verbose)
Set up MINRES solver.
Definition solvers.hh:869
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:861
X range_type
The range type of the operator to be inverted.
Definition solvers.hh:857
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solvers.hh:1082
X domain_type
The domain type of the operator to be inverted.
Definition solvers.hh:855
implements the Generalized Minimal Residual (GMRes) method
Definition solvers.hh:1147
F basis_type
The field type of the basis vectors.
Definition solvers.hh:1158
RestartedGMResSolver(L &op, P &prec, real_type reduction, int restart, int maxit, int verbose)
Set up solver.
Definition solvers.hh:1186
Y range_type
The range type of the operator to be inverted.
Definition solvers.hh:1152
virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:1253
X::field_type field_type
The field type of the operator to be inverted.
Definition solvers.hh:1154
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:1156
X domain_type
The domain type of the operator to be inverted.
Definition solvers.hh:1150
virtual void apply(X &x, Y &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:1240
RestartedGMResSolver(L &op, S &sp, P &prec, real_type reduction, int restart, int maxit, int verbose)
Set up solver.
Definition solvers.hh:1221
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1504
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solvers.hh:1513
GeneralizedPCGSolver(L &op, P &prec, real_type reduction, int maxit, int verbose, int restart=10)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1523
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solvers.hh:1698
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:1557
GeneralizedPCGSolver(L &op, S &sp, P &prec, real_type reduction, int maxit, int verbose, int restart=10)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1542
X::field_type field_type
The field type of the operator to be inverted.
Definition solvers.hh:1511
X range_type
The range type of the operator to be inverted.
Definition solvers.hh:1509
X domain_type
The domain type of the operator to be inverted.
Definition solvers.hh:1507