mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Included changes to Hadrons RBPrecCG solver needed for subtraction of guess
This commit is contained in:
parent
ad6c1c0c4e
commit
891ad66eab
@ -118,7 +118,7 @@ std::vector<std::string> TRBPrecCG<FImpl, nBasis>::getReference(void)
|
|||||||
template <typename FImpl, int nBasis>
|
template <typename FImpl, int nBasis>
|
||||||
std::vector<std::string> TRBPrecCG<FImpl, nBasis>::getOutput(void)
|
std::vector<std::string> TRBPrecCG<FImpl, nBasis>::getOutput(void)
|
||||||
{
|
{
|
||||||
std::vector<std::string> out = {getName()};
|
std::vector<std::string> out = {getName(), getName() + "_subtract"};
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void TRBPrecCG<FImpl, nBasis>::setup(void)
|
|||||||
guesser.reset(new CoarseGuesser(epack.evec, epack.evecCoarse,
|
guesser.reset(new CoarseGuesser(epack.evec, epack.evecCoarse,
|
||||||
epack.evalCoarse));
|
epack.evalCoarse));
|
||||||
}
|
}
|
||||||
catch (Exceptions::ObjectDefinition &)
|
catch (Exceptions::Definition &e)
|
||||||
{
|
{
|
||||||
auto &epack = envGet(EPack, par().eigenPack);
|
auto &epack = envGet(EPack, par().eigenPack);
|
||||||
|
|
||||||
@ -168,19 +168,22 @@ void TRBPrecCG<FImpl, nBasis>::setup(void)
|
|||||||
guesser.reset(new FineGuesser(epack.evec, epack.eval));
|
guesser.reset(new FineGuesser(epack.evec, epack.eval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto solver = [&mat, guesser, this](FermionField &sol,
|
auto makeSolver = [&mat, guesser, this](bool subGuess) {
|
||||||
const FermionField &source)
|
return [&mat, guesser, subGuess, this](FermionField &sol,
|
||||||
{
|
const FermionField &source) {
|
||||||
ConjugateGradient<FermionField> cg(par().residual,
|
ConjugateGradient<FermionField> cg(par().residual,
|
||||||
par().maxIteration);
|
par().maxIteration);
|
||||||
HADRONS_DEFAULT_SCHUR_SOLVE<FermionField> schurSolver(cg);
|
HADRONS_DEFAULT_SCHUR_SOLVE<FermionField> schurSolver(cg);
|
||||||
|
schurSolver.subtractGuess(subGuess);
|
||||||
schurSolver(mat, source, sol, *guesser);
|
schurSolver(mat, source, sol, *guesser);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
auto solver = makeSolver(false);
|
||||||
envCreate(Solver, getName(), Ls, solver, mat);
|
envCreate(Solver, getName(), Ls, solver, mat);
|
||||||
|
auto solver_subtract = makeSolver(true);
|
||||||
|
envCreate(Solver, getName() + "_subtract", Ls, solver_subtract, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
template <typename FImpl, int nBasis>
|
template <typename FImpl, int nBasis>
|
||||||
void TRBPrecCG<FImpl, nBasis>::execute(void)
|
void TRBPrecCG<FImpl, nBasis>::execute(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user