mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Add an overrelaxation parameter to the MR solver
This commit is contained in:
parent
68c66d2e4b
commit
323ed1a588
@ -42,11 +42,12 @@ template<class Field> class MinimalResidual : public OperatorFunction<Field> {
|
|||||||
// Defaults true.
|
// Defaults true.
|
||||||
RealD Tolerance;
|
RealD Tolerance;
|
||||||
Integer MaxIterations;
|
Integer MaxIterations;
|
||||||
|
RealD overRelaxParam;
|
||||||
Integer IterationsToComplete; // Number of iterations the MR took to finish.
|
Integer IterationsToComplete; // Number of iterations the MR took to finish.
|
||||||
// Filled in upon completion
|
// Filled in upon completion
|
||||||
|
|
||||||
MinimalResidual(RealD tol, Integer maxit, bool err_on_no_conv = true)
|
MinimalResidual(RealD tol, Integer maxit, Real ovrelparam = 1.0, bool err_on_no_conv = true)
|
||||||
: Tolerance(tol), MaxIterations(maxit), ErrorOnNoConverge(err_on_no_conv){};
|
: Tolerance(tol), MaxIterations(maxit), overRelaxParam(ovrelparam), ErrorOnNoConverge(err_on_no_conv){};
|
||||||
|
|
||||||
void operator()(LinearOperatorBase<Field> &Linop, const Field &src, Field &psi) {
|
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 = 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);
|
psi = psi + r * a; // Psi[k] += a[k-1] r[k-1] ; // flopcount.addSiteFlops(4*Nc*Ns,s);
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ int main (int argc, char ** argv)
|
|||||||
DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||||
|
|
||||||
MdagMLinearOperator<DomainWallFermionR,LatticeFermion> HermOp(Ddwf);
|
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);
|
MR(HermOp,src,result);
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
|
@ -62,7 +62,7 @@ int main (int argc, char ** argv)
|
|||||||
ImprovedStaggeredFermionR Ds(Umu,Umu,Grid,RBGrid,mass);
|
ImprovedStaggeredFermionR Ds(Umu,Umu,Grid,RBGrid,mass);
|
||||||
|
|
||||||
MdagMLinearOperator<ImprovedStaggeredFermionR,FermionField> HermOp(Ds);
|
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);
|
MR(HermOp,src,result);
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
|
@ -58,7 +58,7 @@ int main (int argc, char ** argv)
|
|||||||
WilsonFermionR Dw(Umu,Grid,RBGrid,mass);
|
WilsonFermionR Dw(Umu,Grid,RBGrid,mass);
|
||||||
|
|
||||||
MdagMLinearOperator<WilsonFermionR,LatticeFermion> HermOp(Dw);
|
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);
|
MR(HermOp,src,result);
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user