1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-05 11:45:56 +01:00

Add an overrelaxation parameter to the MR solver

This commit is contained in:
Daniel Richtmann 2018-02-07 17:45:27 +01:00
parent 68c66d2e4b
commit 323ed1a588
No known key found for this signature in database
GPG Key ID: B33C490AF0772057
4 changed files with 7 additions and 6 deletions

View File

@ -42,11 +42,12 @@ template<class Field> class MinimalResidual : public OperatorFunction<Field> {
// Defaults true.
RealD Tolerance;
Integer MaxIterations;
RealD overRelaxParam;
Integer IterationsToComplete; // Number of iterations the MR took to finish.
// Filled in upon completion
MinimalResidual(RealD tol, Integer maxit, bool err_on_no_conv = true)
: Tolerance(tol), MaxIterations(maxit), ErrorOnNoConverge(err_on_no_conv){};
MinimalResidual(RealD tol, Integer maxit, Real ovrelparam = 1.0, bool err_on_no_conv = true)
: Tolerance(tol), MaxIterations(maxit), overRelaxParam(ovrelparam), ErrorOnNoConverge(err_on_no_conv){};
void operator()(LinearOperatorBase<Field> &Linop, const Field &src, Field &psi) {
@ -104,7 +105,7 @@ template<class Field> class MinimalResidual : public OperatorFunction<Field> {
a = c / d;
// a = a * MRovpar; // a[k-1] *= MRovpar // from chroma code. TODO: check what to do with this
a = a * overRelaxParam; // a[k-1] *= MRovpar
psi = psi + r * a; // Psi[k] += a[k-1] r[k-1] ; // flopcount.addSiteFlops(4*Nc*Ns,s);

View File

@ -61,7 +61,7 @@ int main (int argc, char ** argv)
DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
MdagMLinearOperator<DomainWallFermionR,LatticeFermion> HermOp(Ddwf);
MinimalResidual<LatticeFermion> MR(1.0e-6,10000);
MinimalResidual<LatticeFermion> MR(1.0e-6,10000,0.8);
MR(HermOp,src,result);
Grid_finalize();

View File

@ -62,7 +62,7 @@ int main (int argc, char ** argv)
ImprovedStaggeredFermionR Ds(Umu,Umu,Grid,RBGrid,mass);
MdagMLinearOperator<ImprovedStaggeredFermionR,FermionField> HermOp(Ds);
MinimalResidual<FermionField> MR(1.0e-6,10000);
MinimalResidual<FermionField> MR(1.0e-6,10000,0.8);
MR(HermOp,src,result);
Grid_finalize();

View File

@ -58,7 +58,7 @@ int main (int argc, char ** argv)
WilsonFermionR Dw(Umu,Grid,RBGrid,mass);
MdagMLinearOperator<WilsonFermionR,LatticeFermion> HermOp(Dw);
MinimalResidual<LatticeFermion> MR(1.0e-8,10000);
MinimalResidual<LatticeFermion> MR(1.0e-8,10000,0.8);
MR(HermOp,src,result);
Grid_finalize();