diff --git a/Grid/qcd/utils/GaugeGroup.h b/Grid/qcd/utils/GaugeGroup.h index f0442e2f..dea8f985 100644 --- a/Grid/qcd/utils/GaugeGroup.h +++ b/Grid/qcd/utils/GaugeGroup.h @@ -244,6 +244,29 @@ class GaugeGroup { ex = ex + xn * nfac; // x2/2!, x3/3!.... } } + + template // reunitarise, resimplectify... + static void ProjectOnGaugeGroup(Lattice >, Nd> > &U) { + ProjectOnGaugeGroup(U, group_name()); + } + + template // reunitarise, resimplectify... + static void ProjectOnGaugeGroup(Lattice > > > &Umu) { + ProjectOnGaugeGroup(Umu, group_name()); + } + + + template // reunitarise, resimplectify... previously ProjectSUn + static void ProjectGn(Lattice > > > &Umu) { + ProjectGn(Umu, group_name()); + } + + template // reunitarise, resimplectify... previously ProjectSUn + static void ProjectGn(Lattice >, Nd> > &U) { + ProjectGn(U, group_name()); + + } + }; template @@ -271,6 +294,8 @@ LatticeComplexD Determinant( }); return ret; } + + template static void ProjectSUn( Lattice > > > &Umu) { @@ -285,6 +310,7 @@ static void ProjectSUn( PokeIndex(Umu, element, Nc - 1, i); } } + template static void ProjectSUn( Lattice >, Nd> > &U) { @@ -297,6 +323,7 @@ static void ProjectSUn( PokeIndex(U, Umu, mu); } } + // Explicit specialisation for SU(3). // Explicit specialisation for SU(3). static void ProjectSU3( diff --git a/Grid/qcd/utils/SUn.impl b/Grid/qcd/utils/SUn.impl index eef039c7..18be96b1 100644 --- a/Grid/qcd/utils/SUn.impl +++ b/Grid/qcd/utils/SUn.impl @@ -621,6 +621,47 @@ static void projectOnAlgebra(LatticeAlgebraVector &h_out, } } +template +static void ProjectOnGaugeGroup(Lattice > > > &Umu, GroupName::SU) { + Umu = ProjectOnGroup(Umu); + } + +template +static void ProjectOnGaugeGroup(Lattice >, Nd> > &U, GroupName::SU) { + GridBase *grid = U.Grid(); + // Reunitarise + for (int mu = 0; mu < Nd; mu++) { + auto Umu = PeekIndex(U, mu); + Umu = ProjectOnGroup(Umu); + } +} + +template +static void ProjectGn(Lattice > > > &Umu, GroupName::SU) { + Umu = ProjectOnGroup(Umu); + auto det = Determinant(Umu); + + det = conjugate(det); + + for (int i = 0; i < N; i++) { + auto element = PeekIndex(Umu, N - 1, i); + element = element * det; + PokeIndex(Umu, element, Nc - 1, i); + } +} + +template +static void ProjectGn(Lattice >, Nd> > &U, GroupName::SU) { + GridBase *grid = U.Grid(); + // Reunitarise + for (int mu = 0; mu < Nd; mu++) { + auto Umu = PeekIndex(U, mu); + Umu = ProjectOnGroup(Umu); + ProjectSUn(Umu); + PokeIndex(U, Umu, mu); + } +} + /* * Fundamental rep gauge xform */ diff --git a/Grid/qcd/utils/Sp2n.impl b/Grid/qcd/utils/Sp2n.impl index 411235ec..44771a14 100644 --- a/Grid/qcd/utils/Sp2n.impl +++ b/Grid/qcd/utils/Sp2n.impl @@ -366,6 +366,47 @@ static void TepidConfiguration(GridParallelRNG &pRNG, GaugeField &out, GroupName } } +template +static void ProjectOnGaugeGroup(Lattice > > > &Umu, GroupName::Sp) { + Umu = ProjectOnSpGroup(Umu); + } + +template +static void ProjectOnGaugeGroup(Lattice >, Nd> > &U, GroupName::Sp) { + GridBase *grid = U.Grid(); + // Reunitarise + for (int mu = 0; mu < Nd; mu++) { + auto Umu = PeekIndex(U, mu); + Umu = ProjectOnSpGroup(Umu); + } +} + +template +static void ProjectGn(Lattice > > > &Umu, GroupName::Sp) { + Umu = ProjectOnSpGroup(Umu); + auto det = Determinant(Umu); + + det = conjugate(det); + + for (int i = 0; i < N; i++) { + auto element = PeekIndex(Umu, N - 1, i); + element = element * det; + PokeIndex(Umu, element, Nc - 1, i); + } +} + +template +static void ProjectGn(Lattice >, Nd> > &U, GroupName::Sp) { + GridBase *grid = U.Grid(); + // Reunitarise + for (int mu = 0; mu < Nd; mu++) { + auto Umu = PeekIndex(U, mu); + Umu = ProjectOnSpGroup(Umu); + ProjectSUn(Umu); + PokeIndex(U, Umu, mu); + } +} + public: template static void OmegaInvariance(ColourMatrix &in) {