paboyle / Grid

Data parallel C++ mathematical object library
GNU General Public License v2.0
155 stars 111 forks source link

Propagator has incorrect dimensions for higher representations #463

Open edbennett opened 3 months ago

edbennett commented 3 months ago

Describe the issue:

Grid/qcd/QCD.h currently defines a LatticePropagator as a LatticeSpinColourMatrix.

Since propagators have dimension $4^2 \dim(R)^2$ for representation $R$, this works correctly for the fundamental representation, where $\dim(R)=N_\mathrm{c}$. However, for higher representations this isn't the case, so the propagator has the wrong dimensionality.

Could this type be templated, along the lines:

template<typename vtype, int NF = Grid::Nc> using iSpinFlavourMatrix = Grid::iScalar<Grid::iMatrix<Grid::iMatrix<vtype, NF>, Grid::Ns> >;
template<int NF = Grid::Nc> using vSpinFlavourMatrix = iSpinFlavourMatrix<Grid::vComplex, NF>;
template<int NF = Grid::Nc> using LatticeSpinFlavourMatrix = Grid::Lattice<vSpinFlavourMatrix<NF>>;
template<class representation = FundamentalRepresentation> using LatticePropagator = LatticeSpinFlavourMatrix<representation::Dimension>;

which could then be instantiated as LatticePropagator<FImpl>, with the argument optional.

Edit: After some testing, I'm not sure the last line works, because QCD.h doesn't include Representations.h, so doesn't know about FundamentalRepresentation. So either this would need to change, or the template would need to be in terms of NF similar to the LatticeSpinFlavourMatrix etc.

Code example:

No response

Target platform:

(N/A)

Configure options:

--enable-fermion-reps