mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Slightly generalize interface to SchurRedBlackBase and derived solver classes so we can pass forecasted initial guesses in EOFA heatbath correctly
This commit is contained in:
parent
974003ae96
commit
bb731c97d6
@ -99,10 +99,13 @@ namespace Grid {
|
|||||||
OperatorFunction<Field> & _HermitianRBSolver;
|
OperatorFunction<Field> & _HermitianRBSolver;
|
||||||
int CBfactorise;
|
int CBfactorise;
|
||||||
bool subGuess;
|
bool subGuess;
|
||||||
|
bool useSolnAsInitGuess; // if true user-supplied solution vector is used as initial guess for solver
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SchurRedBlackBase(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false) :
|
SchurRedBlackBase(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false,
|
||||||
_HermitianRBSolver(HermitianRBSolver)
|
const bool _solnAsInitGuess = false) :
|
||||||
|
_HermitianRBSolver(HermitianRBSolver),
|
||||||
|
useSolnAsInitGuess(_solnAsInitGuess)
|
||||||
{
|
{
|
||||||
CBfactorise = 0;
|
CBfactorise = 0;
|
||||||
subtractGuess(initSubGuess);
|
subtractGuess(initSubGuess);
|
||||||
@ -156,7 +159,11 @@ namespace Grid {
|
|||||||
if ( subGuess ) guess_save.resize(nblock,grid);
|
if ( subGuess ) guess_save.resize(nblock,grid);
|
||||||
|
|
||||||
for(int b=0;b<nblock;b++){
|
for(int b=0;b<nblock;b++){
|
||||||
guess(src_o[b],sol_o[b]);
|
if(useSolnAsInitGuess) {
|
||||||
|
pickCheckerboard(Odd, sol_o[b], out[b]);
|
||||||
|
} else {
|
||||||
|
guess(src_o[b],sol_o[b]);
|
||||||
|
}
|
||||||
|
|
||||||
if ( subGuess ) {
|
if ( subGuess ) {
|
||||||
guess_save[b] = sol_o[b];
|
guess_save[b] = sol_o[b];
|
||||||
@ -216,8 +223,11 @@ namespace Grid {
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Construct the guess
|
// Construct the guess
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
Field tmp(grid);
|
if(useSolnAsInitGuess) {
|
||||||
guess(src_o,sol_o);
|
pickCheckerboard(Odd, sol_o, out);
|
||||||
|
} else {
|
||||||
|
guess(src_o,sol_o);
|
||||||
|
}
|
||||||
|
|
||||||
Field guess_save(grid);
|
Field guess_save(grid);
|
||||||
guess_save = sol_o;
|
guess_save = sol_o;
|
||||||
@ -264,8 +274,9 @@ namespace Grid {
|
|||||||
public:
|
public:
|
||||||
typedef CheckerBoardedSparseMatrixBase<Field> Matrix;
|
typedef CheckerBoardedSparseMatrixBase<Field> Matrix;
|
||||||
|
|
||||||
SchurRedBlackStaggeredSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false)
|
SchurRedBlackStaggeredSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false,
|
||||||
: SchurRedBlackBase<Field> (HermitianRBSolver,initSubGuess)
|
const bool _solnAsInitGuess = false)
|
||||||
|
: SchurRedBlackBase<Field> (HermitianRBSolver,initSubGuess,_solnAsInitGuess)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,8 +344,9 @@ namespace Grid {
|
|||||||
public:
|
public:
|
||||||
typedef CheckerBoardedSparseMatrixBase<Field> Matrix;
|
typedef CheckerBoardedSparseMatrixBase<Field> Matrix;
|
||||||
|
|
||||||
SchurRedBlackDiagMooeeSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false)
|
SchurRedBlackDiagMooeeSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false,
|
||||||
: SchurRedBlackBase<Field> (HermitianRBSolver,initSubGuess) {};
|
const bool _solnAsInitGuess = false)
|
||||||
|
: SchurRedBlackBase<Field> (HermitianRBSolver,initSubGuess,_solnAsInitGuess) {};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
@ -405,8 +417,9 @@ namespace Grid {
|
|||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// Wrap the usual normal equations Schur trick
|
// Wrap the usual normal equations Schur trick
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
SchurRedBlackDiagTwoSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false)
|
SchurRedBlackDiagTwoSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false,
|
||||||
: SchurRedBlackBase<Field>(HermitianRBSolver,initSubGuess) {};
|
const bool _solnAsInitGuess = false)
|
||||||
|
: SchurRedBlackBase<Field>(HermitianRBSolver,initSubGuess,_solnAsInitGuess) {};
|
||||||
|
|
||||||
virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o)
|
virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o)
|
||||||
{
|
{
|
||||||
|
@ -63,8 +63,8 @@ namespace QCD{
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ExactOneFlavourRatioPseudoFermionAction(AbstractEOFAFermion<Impl>& _Lop, AbstractEOFAFermion<Impl>& _Rop,
|
ExactOneFlavourRatioPseudoFermionAction(AbstractEOFAFermion<Impl>& _Lop, AbstractEOFAFermion<Impl>& _Rop,
|
||||||
OperatorFunction<FermionField>& S, Params& p, bool use_fc=false) : Lop(_Lop), Rop(_Rop), Solver(S),
|
OperatorFunction<FermionField>& S, Params& p, bool use_fc=false) : Lop(_Lop), Rop(_Rop),
|
||||||
Phi(_Lop.FermionGrid()), param(p), use_heatbath_forecasting(use_fc)
|
Solver(S, false, true), Phi(_Lop.FermionGrid()), param(p), use_heatbath_forecasting(use_fc)
|
||||||
{
|
{
|
||||||
AlgRemez remez(param.lo, param.hi, param.precision);
|
AlgRemez remez(param.lo, param.hi, param.precision);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user