mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Changes A2A class to make use of the new Solver class
This commit is contained in:
parent
fecec803d9
commit
f7e86f81a0
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <Grid/Hadrons/Global.hpp>
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
#include <Grid/Hadrons/Environment.hpp>
|
#include <Grid/Hadrons/Environment.hpp>
|
||||||
|
#include <Grid/Hadrons/Solver.hpp>
|
||||||
|
|
||||||
BEGIN_HADRONS_NAMESPACE
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
@ -10,14 +11,14 @@ BEGIN_HADRONS_NAMESPACE
|
|||||||
// A2A Modes
|
// A2A Modes
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
template <class Field, class Matrix>
|
template <class Field, class Matrix, class Solver>
|
||||||
class A2AModesSchurDiagTwo
|
class A2AModesSchurDiagTwo
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const std::vector<Field> *evec;
|
const std::vector<Field> *evec;
|
||||||
const std::vector<RealD> *eval;
|
const std::vector<RealD> *eval;
|
||||||
Matrix &action;
|
Matrix &action;
|
||||||
std::function<void(Field &, const Field &)> &Solver;
|
Solver &solver;
|
||||||
const int Nl, Nh;
|
const int Nl, Nh;
|
||||||
const bool return_5d;
|
const bool return_5d;
|
||||||
std::vector<Field> w_high_5d, v_high_5d, w_high_4d, v_high_4d;
|
std::vector<Field> w_high_5d, v_high_5d, w_high_4d, v_high_4d;
|
||||||
@ -25,12 +26,12 @@ class A2AModesSchurDiagTwo
|
|||||||
public:
|
public:
|
||||||
A2AModesSchurDiagTwo(const std::vector<Field> *_evec, const std::vector<RealD> *_eval,
|
A2AModesSchurDiagTwo(const std::vector<Field> *_evec, const std::vector<RealD> *_eval,
|
||||||
Matrix &_action,
|
Matrix &_action,
|
||||||
std::function<void(Field &, const Field &)> &_Solver,
|
Solver &_solver,
|
||||||
const int _Nl, const int _Nh,
|
const int _Nl, const int _Nh,
|
||||||
const bool _return_5d)
|
const bool _return_5d)
|
||||||
: evec(_evec), eval(_eval),
|
: evec(_evec), eval(_eval),
|
||||||
action(_action),
|
action(_action),
|
||||||
Solver(_Solver),
|
solver(_solver),
|
||||||
Nl(_Nl), Nh(_Nh),
|
Nl(_Nl), Nh(_Nh),
|
||||||
return_5d(_return_5d)
|
return_5d(_return_5d)
|
||||||
{
|
{
|
||||||
@ -56,7 +57,7 @@ class A2AModesSchurDiagTwo
|
|||||||
LOG(Message) << "A2A high modes for i = " << i << std::endl;
|
LOG(Message) << "A2A high modes for i = " << i << std::endl;
|
||||||
i5d = 0;
|
i5d = 0;
|
||||||
if (return_5d) i5d = i;
|
if (return_5d) i5d = i;
|
||||||
this->high_mode_v(action, Solver, source_5d, v_high_5d[i5d], v_high_4d[i]);
|
this->high_mode_v(action, solver, source_5d, v_high_5d[i5d], v_high_4d[i]);
|
||||||
this->high_mode_w(source_5d, source_4d, w_high_5d[i5d], w_high_4d[i]);
|
this->high_mode_w(source_5d, source_4d, w_high_5d[i5d], w_high_4d[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,13 +186,13 @@ class A2AModesSchurDiagTwo
|
|||||||
action.ExportPhysicalFermionSolution(wout_5d, wout_4d);
|
action.ExportPhysicalFermionSolution(wout_5d, wout_4d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void high_mode_v(Matrix &action, std::function<void(Field &, const Field &)> &Solver, const Field &source, Field &vout_5d, Field &vout_4d)
|
void high_mode_v(Matrix &action, Solver &solver, const Field &source, Field &vout_5d, Field &vout_4d)
|
||||||
{
|
{
|
||||||
GridBase *fgrid = action.Grid();
|
GridBase *fgrid = action.Grid();
|
||||||
Field tmp(fgrid);
|
Field tmp(fgrid);
|
||||||
|
|
||||||
action.Dminus(source, tmp);
|
action.Dminus(source, tmp);
|
||||||
Solver(vout_5d, source); // Note: Solver is Solver(out, in)
|
solver(vout_5d, source); // Note: solver is solver(out, in)
|
||||||
action.ExportPhysicalFermionSolution(vout_5d, vout_4d);
|
action.ExportPhysicalFermionSolution(vout_5d, vout_4d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,63 +203,29 @@ class A2AModesSchurDiagTwo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
// TODO: A2A for coarse eigenvectors
|
||||||
// Low Modes
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
template <class Field, class Matrix>
|
// template <class FineField, class CoarseField, class Matrix, class Solver>
|
||||||
class A2ALMSchurDiagTwo : public A2AModesSchurDiagTwo<Field, Matrix>
|
// class A2ALMSchurDiagTwoCoarse : public A2AModesSchurDiagTwo<FineField, Matrix, Solver>
|
||||||
{
|
// {
|
||||||
private:
|
// private:
|
||||||
const std::vector<Field> &evec;
|
// const std::vector<FineField> &subspace;
|
||||||
const std::vector<RealD> &eval;
|
// const std::vector<CoarseField> &evec_coarse;
|
||||||
Matrix &action;
|
// const std::vector<RealD> &eval_coarse;
|
||||||
|
// Matrix &action;
|
||||||
|
|
||||||
public:
|
// public:
|
||||||
A2ALMSchurDiagTwo(const std::vector<Field> &_evec, const std::vector<RealD> &_eval, Matrix &_action) : evec(_evec), eval(_eval), action(_action){};
|
// A2ALMSchurDiagTwoCoarse(const std::vector<FineField> &_subspace, const std::vector<CoarseField> &_evec_coarse, const std::vector<RealD> &_eval_coarse, Matrix &_action)
|
||||||
void operator()(int i, Field &vout, Field &wout)
|
// : subspace(_subspace), evec_coarse(_evec_coarse), eval_coarse(_eval_coarse), action(_action){};
|
||||||
{
|
|
||||||
this->low_mode_v(action, evec[i], eval[i], vout);
|
|
||||||
this->low_mode_w(action, evec[i], eval[i], wout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class FineField, class CoarseField, class Matrix>
|
// void operator()(int i, FineField &vout, FineField &wout)
|
||||||
class A2ALMSchurDiagTwoCoarse : public A2AModesSchurDiagTwo<FineField, Matrix>
|
// {
|
||||||
{
|
// FineField prom_evec(subspace[0]._grid);
|
||||||
private:
|
// blockPromote(evec_coarse[i], prom_evec, subspace);
|
||||||
const std::vector<FineField> &subspace;
|
// this->low_mode_v(action, prom_evec, eval_coarse[i], vout);
|
||||||
const std::vector<CoarseField> &evec_coarse;
|
// this->low_mode_w(action, prom_evec, eval_coarse[i], wout);
|
||||||
const std::vector<RealD> &eval_coarse;
|
// }
|
||||||
Matrix &action;
|
// };
|
||||||
|
|
||||||
public:
|
|
||||||
A2ALMSchurDiagTwoCoarse(const std::vector<FineField> &_subspace, const std::vector<CoarseField> &_evec_coarse, const std::vector<RealD> &_eval_coarse, Matrix &_action)
|
|
||||||
: subspace(_subspace), evec_coarse(_evec_coarse), eval_coarse(_eval_coarse), action(_action){};
|
|
||||||
|
|
||||||
void operator()(int i, FineField &vout, FineField &wout)
|
|
||||||
{
|
|
||||||
FineField prom_evec(subspace[0]._grid);
|
|
||||||
blockPromote(evec_coarse[i], prom_evec, subspace);
|
|
||||||
this->low_mode_v(action, prom_evec, eval_coarse[i], vout);
|
|
||||||
this->low_mode_w(action, prom_evec, eval_coarse[i], wout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
// High Modes
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
template <class Field, class Matrix>
|
|
||||||
class A2AHMSchurDiagTwo : virtual public A2AModesSchurDiagTwo<Field, Matrix>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void operator()(Matrix &action, std::function<void(Field &, const Field &)> &Solver, const Field &source, Field &vout, Field &wout)
|
|
||||||
{
|
|
||||||
this->high_mode_v(action, Solver, source, vout);
|
|
||||||
this->high_mode_w(action, source, wout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
END_HADRONS_NAMESPACE
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user