diff --git a/lib/qcd/utils/LinalgUtils.h b/lib/qcd/utils/LinalgUtils.h index 5eaf1c2a..04a224e5 100644 --- a/lib/qcd/utils/LinalgUtils.h +++ b/lib/qcd/utils/LinalgUtils.h @@ -173,6 +173,39 @@ void G5R5(Lattice &z,const Lattice &x) } } } +} -}} +// I explicitly need these outside the QCD namespace +template +void G5C(Lattice &z, const Lattice &x) +{ + GridBase *grid = x._grid; + z.checkerboard = x.checkerboard; + conformable(x, z); + + QCD::Gamma G5(QCD::Gamma::Algebra::Gamma5); + z = G5 * x; +} + +template +void G5C(Lattice> &z, const Lattice> &x) +{ + GridBase *grid = x._grid; + z.checkerboard = x.checkerboard; + conformable(x, z); + + static_assert(nbasis % 2 == 0, ""); + int nb = nbasis / 2; + + parallel_for(int ss = 0; ss < grid->oSites(); ss++) { + for(int n = 0; n < nb; ++n) { + z._odata[ss](n) = x._odata[ss](n); + } + for(int n = nb; n < nbasis; ++n) { + z._odata[ss](n) = -x._odata[ss](n); + } + } +} + +} #endif