1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Revert "Revert "Fixing issue #11: consistent use of ncolour and nsp""

This reverts commit 3af4929dda.
This commit is contained in:
Alessandro Lupo 2022-11-23 19:40:28 +00:00
parent 3af4929dda
commit 2de03e5172
4 changed files with 76 additions and 72 deletions

View File

@ -126,8 +126,8 @@ public:
{ {
if (isSp2n == true) if (isSp2n == true)
{ {
const int nSp = Nrepresentation/2; //const int nSp = Nrepresentation/2;
Sp<nSp>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu); Sp<Nrepresentation>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
} else } else
{ {
@ -148,18 +148,18 @@ public:
if (isSp2n == true) if (isSp2n == true)
{ {
P = Ta(P); P = Ta(P);
const int nsp = Nc / 2; //const int nsp = Nc / 2;
Sp<nsp>::iSp2nMatrix<Complex> gen; Sp<Nc>::iSp2nMatrix<Complex> gen;
auto Psum = P; auto Psum = P;
Psum = Zero(); Psum = Zero();
for (int a = 0; a < Sp<nsp>::AlgebraDimension; a++) for (int a = 0; a < Sp<Nrepresentation>::AlgebraDimension; a++)
{ {
Sp<nsp>::generator(a, gen); Sp<Nrepresentation>::generator(a, gen);
auto coeff = 2. * trace(P * gen); auto coeff = 2. * trace(P * gen);
Psum += coeff * gen; Psum += coeff * gen;
@ -223,8 +223,8 @@ public:
{ {
if (isSp2n == true) if (isSp2n == true)
{ {
const int nSp = Nrepresentation/2; //const int nSp = Nrepresentation/2;
Sp<nSp>::HotConfiguration(pRNG, U); Sp<Nrepresentation>::HotConfiguration(pRNG, U);
} else } else
{ {
Group::HotConfiguration(pRNG, U); Group::HotConfiguration(pRNG, U);
@ -235,8 +235,8 @@ public:
{ {
if (isSp2n == true) if (isSp2n == true)
{ {
const int nSp = Nrepresentation/2; //const int nSp = Nrepresentation/2;
Sp<nSp>::TepidConfiguration(pRNG, U); Sp<Nrepresentation>::TepidConfiguration(pRNG, U);
} else } else
{ {
Group::TepidConfiguration(pRNG, U); Group::TepidConfiguration(pRNG, U);
@ -248,8 +248,8 @@ public:
{ {
if (isSp2n == true) if (isSp2n == true)
{ {
const int nSp = Nrepresentation/2; //const int nSp = Nrepresentation/2;
Sp<nSp>::ColdConfiguration(pRNG, U); Sp<Nrepresentation>::ColdConfiguration(pRNG, U);
} else } else
{ {
Group::ColdConfiguration(pRNG, U); Group::ColdConfiguration(pRNG, U);

View File

@ -5,21 +5,16 @@
NAMESPACE_BEGIN(Grid); NAMESPACE_BEGIN(Grid);
// Sp(2N) // Sp(2N)
// ncolour = N // ncolour = 2N
// need to be careful with n and 2n
// I am defining the Sp class for Sp(2n) to be such that the template variable ncolour
// is n inside 2n and the typedef at the end of the file should eliminate possible confusion.
// the other routines, like projectOnSp2n, N will be the dimension of the actual number of colors for consistency with the sun routines
template <int ncolour> template <int ncolour>
class Sp { class Sp {
public: public:
static const int Dimension = ncolour*2; static const int nsp = ncolour/2;
static const int AlgebraDimension = ncolour*(2*ncolour +1); static const int Dimension = ncolour;
static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; } static const int AlgebraDimension = nsp*(2*nsp +1);
static const int nnsp = ncolour; static int su2subgroups(void) { return (nsp * (nsp - 1)) / 2; }
template <typename vtype> template <typename vtype>
@ -65,9 +60,6 @@ public:
// there are 6 types named a,b,c,d and w,z // there are 6 types named a,b,c,d and w,z
// abcd are N(N-1)/2 each while wz are N each // abcd are N(N-1)/2 each while wz are N each
template <class cplx> template <class cplx>
static void generator(int lieIndex, iSp2nMatrix<cplx> &ta) { static void generator(int lieIndex, iSp2nMatrix<cplx> &ta) {
// map lie index into type of generators: diagonal, abcd type, wz type // map lie index into type of generators: diagonal, abcd type, wz type
@ -75,10 +67,10 @@ public:
int diagIndex; int diagIndex;
int aIndex, bIndex, cIndex, dIndex; int aIndex, bIndex, cIndex, dIndex;
int wIndex, zIndex; // a,b,c,d are N(N-1)/2 and w,z are N int wIndex, zIndex; // a,b,c,d are N(N-1)/2 and w,z are N
int mod = ncolour * (ncolour-1) * 0.5; int mod = nsp * (nsp-1) * 0.5;
int offdiag = 2*ncolour*ncolour; // number of generators not in the cartan subalgebra int offdiag = 2*nsp*nsp; // number of generators not in the cartan subalgebra
int wmod = 4*mod; int wmod = 4*mod;
int zmod = wmod+ncolour; int zmod = wmod+nsp;
if (lieIndex >= offdiag) { if (lieIndex >= offdiag) {
diagIndex = lieIndex - offdiag; // 0, ... ,N-1 diagIndex = lieIndex - offdiag; // 0, ... ,N-1
//std::cout << GridLogMessage << "diag type " << std::endl; //std::cout << GridLogMessage << "diag type " << std::endl;
@ -136,7 +128,7 @@ public:
RealD nrm = 1.0 / 2; RealD nrm = 1.0 / 2;
ta()()(diagIndex,diagIndex) = nrm; ta()()(diagIndex,diagIndex) = nrm;
ta()()(diagIndex+ncolour,diagIndex+ncolour) = -nrm; ta()()(diagIndex+nsp,diagIndex+nsp) = -nrm;
} }
template <class cplx> template <class cplx>
@ -152,8 +144,8 @@ public:
su2SubGroupIndex(i1, i2, aIndex); su2SubGroupIndex(i1, i2, aIndex);
ta()()(i1,i2) = 1; ta()()(i1,i2) = 1;
ta()()(i2,i1) = 1; ta()()(i2,i1) = 1;
ta()()(i1+ncolour,i2+ncolour) = -1; ta()()(i1+nsp,i2+nsp) = -1;
ta()()(i2+ncolour,i1+ncolour) = -1; ta()()(i2+nsp,i1+nsp) = -1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -174,8 +166,8 @@ public:
ta()()(i1,i2) = i; ta()()(i1,i2) = i;
ta()()(i2,i1) = -i; ta()()(i2,i1) = -i;
ta()()(i1+ncolour,i2+ncolour) = i; ta()()(i1+nsp,i2+nsp) = i;
ta()()(i2+ncolour,i1+ncolour) = -i; ta()()(i2+nsp,i1+nsp) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -191,10 +183,10 @@ public:
RealD nrm = 1 / (2 * std::sqrt(2) ); RealD nrm = 1 / (2 * std::sqrt(2) );
su2SubGroupIndex(i1, i2, cIndex); su2SubGroupIndex(i1, i2, cIndex);
ta()()(i1,i2+ncolour) = 1; ta()()(i1,i2+nsp) = 1;
ta()()(i2,i1+ncolour) = 1; ta()()(i2,i1+nsp) = 1;
ta()()(i1+ncolour,i2) = 1; ta()()(i1+nsp,i2) = 1;
ta()()(i2+ncolour,i1) = 1; ta()()(i2+nsp,i1) = 1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -210,10 +202,10 @@ public:
RealD nrm = 1 / (2 * std::sqrt(2) ); RealD nrm = 1 / (2 * std::sqrt(2) );
su2SubGroupIndex(i1, i2, dIndex); su2SubGroupIndex(i1, i2, dIndex);
ta()()(i1,i2+ncolour) = i; ta()()(i1,i2+nsp) = i;
ta()()(i2,i1+ncolour) = i; ta()()(i2,i1+nsp) = i;
ta()()(i1+ncolour,i2) = -i; ta()()(i1+nsp,i2) = -i;
ta()()(i2+ncolour,i1) = -i; ta()()(i2+nsp,i1) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -226,8 +218,8 @@ public:
ta = Zero(); ta = Zero();
RealD nrm = 1.0 / 2; //check RealD nrm = 1.0 / 2; //check
ta()()(wIndex,wIndex+ncolour) = 1; ta()()(wIndex,wIndex+nsp) = 1;
ta()()(wIndex+ncolour,wIndex) = 1; ta()()(wIndex+nsp,wIndex) = 1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -240,8 +232,8 @@ public:
ta = Zero(); ta = Zero();
RealD nrm = 1.0 / 2; //check RealD nrm = 1.0 / 2; //check
cplx i(0.0, 1.0); cplx i(0.0, 1.0);
ta()()(zIndex,zIndex+ncolour) = i; ta()()(zIndex,zIndex+nsp) = i;
ta()()(zIndex+ncolour,zIndex) = -i; ta()()(zIndex+nsp,zIndex) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -251,11 +243,11 @@ public:
// Map a su2 subgroup number to the pair of rows that are non zero // Map a su2 subgroup number to the pair of rows that are non zero
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) { static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
assert((su2_index >= 0) && (su2_index < (ncolour * (ncolour - 1)) / 2)); assert((su2_index >= 0) && (su2_index < (nsp * (nsp - 1)) / 2));
int spare = su2_index; int spare = su2_index;
for (i1 = 0; spare >= (ncolour - 1 - i1); i1++) { for (i1 = 0; spare >= (nsp - 1 - i1); i1++) {
spare = spare - (ncolour - 1 - i1); // remove the Nc-1-i1 terms spare = spare - (nsp - 1 - i1); // remove the Nc-1-i1 terms
} }
i2 = i1 + 1 + spare; i2 = i1 + 1 + spare;
} }
@ -268,7 +260,7 @@ public:
for (int gen = 0; gen < AlgebraDimension; gen++) { for (int gen = 0; gen < AlgebraDimension; gen++) {
Matrix ta; Matrix ta;
generator(gen, ta); generator(gen, ta);
std::cout << GridLogMessage << "Nc (2n) = " << 2*ncolour << std::endl; std::cout << GridLogMessage << "Nc = " << ncolour << std::endl;
std::cout << GridLogMessage << " t_" << gen << std::endl; std::cout << GridLogMessage << " t_" << gen << std::endl;
std::cout << GridLogMessage << ta << std::endl; std::cout << GridLogMessage << ta << std::endl;
} }
@ -464,10 +456,17 @@ public:
ColourMatrix Omega; ColourMatrix Omega;
Omega = Zero(); Omega = Zero();
for (int i = 0; i < ncolour; i++) std::cout << GridLogMessage << "I am a ColourMatrix" << std::endl;
//for (int i = 0; i < ncolour; i++) wrong?!
//{
// Omega()()(i, 2*ncolour-1-i) = 1.;
// Omega()()(2*ncolour-1-i, i) = -1;
//}
for (int i = 0; i < nsp; i++)
{ {
Omega()()(i, 2*ncolour-1-i) = 1.; Omega()()(i, nsp+i) = 1.;
Omega()()(2*ncolour-1-i, i) = -1; Omega()()(nsp+i, i) = -1;
} }
auto diff = Omega - (in * Omega * transpose(in) ); auto diff = Omega - (in * Omega * transpose(in) );
@ -498,6 +497,8 @@ public:
Omega = Zero(); Omega = Zero();
identity = 1.; identity = 1.;
std::cout << GridLogMessage << "I am a GaugeField " << std::endl;
U = PeekIndex<LorentzIndex>(in,1); U = PeekIndex<LorentzIndex>(in,1);
OmegaInvariance(U); OmegaInvariance(U);
@ -516,10 +517,12 @@ public:
Omega = Zero(); Omega = Zero();
identity = 1.; identity = 1.;
for (int i = 0; i < ncolour; i++) std::cout << GridLogMessage << "I am a LatticeColourMatrix " << std::endl;
for (int i = 0; i < nsp; i++)
{ {
Omega()()(i, ncolour+i) = 1.; Omega()()(i, nsp+i) = 1.;
Omega()()(ncolour+i, i) = -1; Omega()()(nsp+i, i) = -1;
} }
std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl; std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl;
@ -568,10 +571,10 @@ public:
} }
} }
typedef Sp<1> Sp2; typedef Sp<2> Sp2;
typedef Sp<2> Sp4; typedef Sp<4> Sp4;
typedef Sp<3> Sp6; typedef Sp<6> Sp6;
typedef Sp<4> Sp8; typedef Sp<8> Sp8;
NAMESPACE_END(Grid); NAMESPACE_END(Grid);
#endif #endif

View File

@ -21,7 +21,7 @@ int main (int argc, char **argv)
double vol = Umu.Grid()->gSites(); double vol = Umu.Grid()->gSites();
const int nsp = Nc / 2; const int nsp = Sp<Nc>::nsp;
identity = 1.; identity = 1.;
Cidentity = 1.; Cidentity = 1.;
@ -34,8 +34,8 @@ int main (int argc, char **argv)
std::cout << GridLogMessage << "-------" << std::endl; std::cout << GridLogMessage << "-------" << std::endl;
std::cout << GridLogMessage << "Checking Cold Configuration " << std::endl; std::cout << GridLogMessage << "Checking Cold Configuration " << std::endl;
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
Sp<nsp>::ColdConfiguration(pRNG,Umu); Sp<Nc>::ColdConfiguration(pRNG,Umu);
Sp<nsp>::OmegaInvariance(Umu); Sp<Nc>::OmegaInvariance(Umu);
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
Umu = Umu - identity; Umu = Umu - identity;
@ -47,8 +47,8 @@ int main (int argc, char **argv)
std::cout << GridLogMessage << "-------" << std::endl; std::cout << GridLogMessage << "-------" << std::endl;
std::cout << GridLogMessage << "Checking Hot Configuration" << std::endl; std::cout << GridLogMessage << "Checking Hot Configuration" << std::endl;
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
Sp<nsp>::HotConfiguration(pRNG,Umu); Sp<Nc>::HotConfiguration(pRNG,Umu);
Sp<nsp>::OmegaInvariance(Umu); Sp<Nc>::OmegaInvariance(Umu);
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
U = PeekIndex<LorentzIndex>(Umu,1); U = PeekIndex<LorentzIndex>(Umu,1);
std::cout << GridLogMessage << "Checking unitarity " << std::endl; std::cout << GridLogMessage << "Checking unitarity " << std::endl;
@ -62,8 +62,8 @@ int main (int argc, char **argv)
std::cout << GridLogMessage << "-------" << std::endl; std::cout << GridLogMessage << "-------" << std::endl;
std::cout << GridLogMessage << "Checking Tepid Configuration" << std::endl; std::cout << GridLogMessage << "Checking Tepid Configuration" << std::endl;
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
Sp<nsp>::TepidConfiguration(pRNG,Umu); Sp<Nc>::TepidConfiguration(pRNG,Umu);
Sp<nsp>::OmegaInvariance(Umu); Sp<Nc>::OmegaInvariance(Umu);
std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << std::endl;
U = PeekIndex<LorentzIndex>(Umu,1); U = PeekIndex<LorentzIndex>(Umu,1);
std::cout << GridLogMessage << "Checking unitarity " << std::endl; std::cout << GridLogMessage << "Checking unitarity " << std::endl;
@ -85,7 +85,7 @@ int main (int argc, char **argv)
Complex i(0., 1.); Complex i(0., 1.);
Sp<nsp>::HotConfiguration(pRNG,Umu); Sp<Nc>::HotConfiguration(pRNG,Umu);
U = PeekIndex<LorentzIndex>(Umu,0); U = PeekIndex<LorentzIndex>(Umu,0);
for (int c1 = 0; c1 < nsp; c1++) //check on W for (int c1 = 0; c1 < nsp; c1++) //check on W
{ {
@ -123,7 +123,7 @@ int main (int argc, char **argv)
std::cout << GridLogMessage << "Hot start ok " << std::endl; std::cout << GridLogMessage << "Hot start ok " << std::endl;
Sp<nsp>::HotConfiguration(pRNG,Umu); Sp<Nc>::HotConfiguration(pRNG,Umu);
U = PeekIndex<LorentzIndex>(Umu,0); U = PeekIndex<LorentzIndex>(Umu,0);
for (int c1 = 0; c1 < nsp; c1++) //check on W for (int c1 = 0; c1 < nsp; c1++) //check on W
{ {

View File

@ -20,7 +20,8 @@ int main (int argc, char **argv)
LatticeColourMatrixD aux(&Grid); LatticeColourMatrixD aux(&Grid);
LatticeColourMatrixD identity(&Grid); LatticeColourMatrixD identity(&Grid);
const int nsp = Nc / 2; //const int nsp = Nc / 2;
const int nsp = Sp<Nc>::nsp;
identity = 1.0; identity = 1.0;
RealD epsilon = 0.01; RealD epsilon = 0.01;
@ -47,7 +48,7 @@ int main (int argc, char **argv)
{ {
std::cout << GridLogMessage << "This matrix should not leave Omega invariant, expect a warning" << std::endl; std::cout << GridLogMessage << "This matrix should not leave Omega invariant, expect a warning" << std::endl;
} }
Sp<nsp>::OmegaInvariance(U); Sp<Nc>::OmegaInvariance(U);
std::cout <<GridLogMessage << std::endl; std::cout <<GridLogMessage << std::endl;
U = U + epsilon*identity; U = U + epsilon*identity;
@ -78,7 +79,7 @@ int main (int argc, char **argv)
// actual sp2n check // actual sp2n check
std::cout << GridLogMessage << "Checking invariance after projection "<< std::endl; std::cout << GridLogMessage << "Checking invariance after projection "<< std::endl;
Sp<nsp>::OmegaInvariance(U); Sp<Nc>::OmegaInvariance(U);
// checks on elements // checks on elements