diff --git a/Grid/algorithms/iterative/SchurRedBlack.h b/Grid/algorithms/iterative/SchurRedBlack.h index fdb17a98..6c1e1f1c 100644 --- a/Grid/algorithms/iterative/SchurRedBlack.h +++ b/Grid/algorithms/iterative/SchurRedBlack.h @@ -99,10 +99,13 @@ namespace Grid { OperatorFunction & _HermitianRBSolver; int CBfactorise; bool subGuess; + bool useSolnAsInitGuess; // if true user-supplied solution vector is used as initial guess for solver public: - SchurRedBlackBase(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) : - _HermitianRBSolver(HermitianRBSolver) + SchurRedBlackBase(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false, + const bool _solnAsInitGuess = false) : + _HermitianRBSolver(HermitianRBSolver), + useSolnAsInitGuess(_solnAsInitGuess) { CBfactorise = 0; subtractGuess(initSubGuess); @@ -156,7 +159,11 @@ namespace Grid { if ( subGuess ) guess_save.resize(nblock,grid); for(int b=0;b Matrix; - SchurRedBlackStaggeredSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) - : SchurRedBlackBase (HermitianRBSolver,initSubGuess) + SchurRedBlackStaggeredSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false, + const bool _solnAsInitGuess = false) + : SchurRedBlackBase (HermitianRBSolver,initSubGuess,_solnAsInitGuess) { } @@ -333,8 +344,9 @@ namespace Grid { public: typedef CheckerBoardedSparseMatrixBase Matrix; - SchurRedBlackDiagMooeeSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) - : SchurRedBlackBase (HermitianRBSolver,initSubGuess) {}; + SchurRedBlackDiagMooeeSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false, + const bool _solnAsInitGuess = false) + : SchurRedBlackBase (HermitianRBSolver,initSubGuess,_solnAsInitGuess) {}; ////////////////////////////////////////////////////// @@ -405,8 +417,9 @@ namespace Grid { ///////////////////////////////////////////////////// // Wrap the usual normal equations Schur trick ///////////////////////////////////////////////////// - SchurRedBlackDiagTwoSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) - : SchurRedBlackBase(HermitianRBSolver,initSubGuess) {}; + SchurRedBlackDiagTwoSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false, + const bool _solnAsInitGuess = false) + : SchurRedBlackBase(HermitianRBSolver,initSubGuess,_solnAsInitGuess) {}; virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o) { diff --git a/Grid/qcd/action/pseudofermion/ExactOneFlavourRatio.h b/Grid/qcd/action/pseudofermion/ExactOneFlavourRatio.h index 9c1e2921..b0c42d20 100644 --- a/Grid/qcd/action/pseudofermion/ExactOneFlavourRatio.h +++ b/Grid/qcd/action/pseudofermion/ExactOneFlavourRatio.h @@ -63,8 +63,8 @@ namespace QCD{ public: ExactOneFlavourRatioPseudoFermionAction(AbstractEOFAFermion& _Lop, AbstractEOFAFermion& _Rop, - OperatorFunction& S, Params& p, bool use_fc=false) : Lop(_Lop), Rop(_Rop), Solver(S), - Phi(_Lop.FermionGrid()), param(p), use_heatbath_forecasting(use_fc) + OperatorFunction& S, Params& p, bool use_fc=false) : Lop(_Lop), Rop(_Rop), + Solver(S, false, true), Phi(_Lop.FermionGrid()), param(p), use_heatbath_forecasting(use_fc) { AlgRemez remez(param.lo, param.hi, param.precision); @@ -244,7 +244,7 @@ namespace QCD{ Lop.Dtilde(spProj_Phi, Chi); G5R5(g5_R5_Chi, Chi); Lop.MDeriv(force, g5_R5_Chi, Chi, DaggerNo); - dSdU = Lop.k * force; + dSdU = -Lop.k * force; // RH: dSdU = dSdU - k \chi_{R}^{\dagger} \gamma_{5} R_{5} ( \partial_{x,\mu} D_{w} ) \chi_{} // \chi_{R} = ( H(mb) - \Delta_{+}(mf,mb) P_{+} )^{-1} \Omega_{+} P_{+} \Phi @@ -256,7 +256,7 @@ namespace QCD{ Rop.Dtilde(spProj_Phi, Chi); G5R5(g5_R5_Chi, Chi); Lop.MDeriv(force, g5_R5_Chi, Chi, DaggerNo); - dSdU = dSdU - Rop.k * force; + dSdU = dSdU + Rop.k * force; }; }; }}