1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-18 07:47:06 +01:00

expand ProjecOnGaugeGroup, change ProjectOnSp2nAlgebra into SpTa, fixing some of its issues

This commit is contained in:
Alessandro Lupo
2023-04-04 17:48:13 +01:00
parent 026e736dfa
commit 778291230a
6 changed files with 202 additions and 26 deletions

View File

@ -345,7 +345,7 @@ GridUnopClass(UnaryNot, Not(a));
GridUnopClass(UnaryTrace, trace(a));
GridUnopClass(UnaryTranspose, transpose(a));
GridUnopClass(UnaryTa, Ta(a));
GridUnopClass(UnaryProjectSp2nAlgebra, ProjectSp2nAlgebra(a));
GridUnopClass(UnarySpTa, SpTa(a));
GridUnopClass(UnaryProjectOnGroup, ProjectOnGroup(a));
GridUnopClass(UnaryProjectOnSpGroup, ProjectOnSpGroup(a));
GridUnopClass(UnaryTimesI, timesI(a));
@ -458,7 +458,7 @@ GRID_DEF_UNOP(operator!, UnaryNot);
GRID_DEF_UNOP(trace, UnaryTrace);
GRID_DEF_UNOP(transpose, UnaryTranspose);
GRID_DEF_UNOP(Ta, UnaryTa);
GRID_DEF_UNOP(ProjectSp2nAlgebra, UnaryProjectSp2nAlgebra);
GRID_DEF_UNOP(SpTa, UnarySpTa);
GRID_DEF_UNOP(ProjectOnGroup, UnaryProjectOnGroup);
GRID_DEF_UNOP(ProjectOnSpGroup, UnaryProjectOnSpGroup);
GRID_DEF_UNOP(timesI, UnaryTimesI);

View File

@ -300,9 +300,10 @@ class GaugeGroup {
ColdConfiguration(out);
}
template <typename LatticeMatrixType, ONLY_IF_SU>
template <typename LatticeMatrixType>
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
out = Ta(in);
taProj(in, out, group_name());
//out = Ta(in);
}
template <typename LatticeMatrixType>
@ -333,6 +334,32 @@ class GaugeGroup {
ProjectOnGaugeGroup(Umu, group_name());
}
template <class vtype>
static void ProjectOnGaugeGroup(iScalar<vtype> &r) {
ProjectOnGaugeGroup(r, group_name());
}
template <class vtype, int N>
static void ProjectOnGaugeGroup(iVector<vtype,N> &r) {
r = ProjectOnGaugeGroup(r, group_name());
}
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg) {
arg = ProjectOnGaugeGroup(arg, group_name());
}
/*
template <int N> // reunitarise, resimplectify...
static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd> &U) {
ProjectOnGaugeGroup(U, group_name());
}
template <int N> // reunitarise, resimplectify...
static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > > &Umu) {
ProjectOnGaugeGroup(Umu, group_name());
}*/
template <int N> // reunitarise, resimplectify... previously ProjectSUn
static void ProjectGn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
@ -349,7 +376,7 @@ class GaugeGroup {
}
template <int N> // reunitarise, resimplectify... previously ProjectSUn
static void ProjectGn(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U, GroupName::SU) {
static void ProjectGn(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
// Reunitarise
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);

View File

@ -508,6 +508,7 @@ static void testGenerators(GroupName::SU) {
std::cout << GridLogMessage << std::endl;
}
template <int N>
static void ProjectOnGaugeGroup(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu, GroupName::SU) {
Umu = ProjectOnGroup(Umu);
@ -522,6 +523,44 @@ static void ProjectOnGaugeGroup(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,
}
}
template <class vtype>
static void ProjectOnGaugeGroup(iScalar<vtype> &r, GroupName::SU) {
r = ProjectOnGroup(r);
}
template <class vtype, int N>
static void ProjectOnGaugeGroup(iVector<vtype,N> &r, GroupName::SU) {
r = ProjectOnGroup(r);
}
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg, GroupName::SU) {
arg = ProjectOnGroup(arg);
}
/*
template <int N> // non-lattice objects
static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > > &Umu, GroupName::SU) {
Umu = ProjectOnGroup(Umu);
}
template <int N>
static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd> &U, GroupName::SU) {
// Reunitarise
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
Umu = ProjectOnGroup(Umu);
}
}*/
template <typename LatticeMatrixType>
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU) {
out = Ta(in);
}
/*
* Fundamental rep gauge xform
*/

View File

@ -267,6 +267,41 @@ static void ProjectOnGaugeGroup(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,
}
}
template <class vtype>
static void ProjectOnGaugeGroup(iScalar<vtype> &r, GroupName::Sp) {
r = ProjectOnSpGroup(r);
}
template <class vtype, int N>
static void ProjectOnGaugeGroup(iVector<vtype,N> &r, GroupName::Sp) {
r = ProjectOnSpGroup(r);
}
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg, GroupName::Sp) {
arg = ProjectOnSpGroup(arg);
}
/*
template <int N> // non-lattice objects
static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > > &Umu, GroupName::Sp) {
Umu = ProjectOnSpGroup(Umu);
}
template <int N>
static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd> &U, GroupName::Sp) {
// Reunitarise
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
Umu = ProjectOnSpGroup(Umu);
}
}*/
template <typename LatticeMatrixType>
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::Sp) {
out = SpTa(in);
}
public:
template <ONLY_IF_Sp>
static void OmegaInvariance(ColourMatrix &in) {

View File

@ -66,23 +66,23 @@ template<class vtype,int N> accelerator_inline iMatrix<vtype,N> Ta(const iMatrix
return ret;
}
// for sp2n can't do something as simple as Ta. We do a Gram-Schmidt
// for sp2n can't be as simple as Ta. We do a Gram-Schmidt
template<class vtype> accelerator_inline iScalar<vtype> ProjectSp2nAlgebra(const iScalar<vtype>&r)
template<class vtype> accelerator_inline iScalar<vtype> SpTa(const iScalar<vtype>&r)
{
iScalar<vtype> ret;
ret._internal = ProjectSp2nAlgebra(r._internal);
return ret;
ret._internal = SpTa(r._internal);
return Ta(ret);
}
template<class vtype,int N> accelerator_inline iVector<vtype,N> ProjectSp2nAlgebra(const iVector<vtype,N>&r)
template<class vtype,int N> accelerator_inline iVector<vtype,N> SpTa(const iVector<vtype,N>&r)
{
iVector<vtype,N> ret;
for(int i=0;i<N;i++){
ret._internal[i] = ProjectSp2nAlgebra(r._internal[i]);
ret._internal[i] = SpTa(r._internal[i]);
}
return ret;
return Ta(ret);
}
template<class vtype,int N> accelerator_inline iMatrix<vtype,N> ProjectSp2nAlgebra(const iMatrix<vtype,N> &arg)
template<class vtype,int N> accelerator_inline iMatrix<vtype,N> SpTa(const iMatrix<vtype,N> &arg)
{
iMatrix<vtype,N> ret;
vtype nrm;
@ -142,7 +142,7 @@ template<class vtype,int N> accelerator_inline iMatrix<vtype,N> ProjectSp2nAlgeb
}
return ret;
return Ta(ret);
}