1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

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

This reverts commit 1ba429345b.
This commit is contained in:
Alessandro Lupo 2022-11-23 19:34:59 +00:00
parent 1ba429345b
commit 3af4929dda
4 changed files with 72 additions and 76 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<Nrepresentation>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu); Sp<nSp>::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<Nc>::iSp2nMatrix<Complex> gen; Sp<nsp>::iSp2nMatrix<Complex> gen;
auto Psum = P; auto Psum = P;
Psum = Zero(); Psum = Zero();
for (int a = 0; a < Sp<Nrepresentation>::AlgebraDimension; a++) for (int a = 0; a < Sp<nsp>::AlgebraDimension; a++)
{ {
Sp<Nrepresentation>::generator(a, gen); Sp<nsp>::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<Nrepresentation>::HotConfiguration(pRNG, U); Sp<nSp>::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<Nrepresentation>::TepidConfiguration(pRNG, U); Sp<nSp>::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<Nrepresentation>::ColdConfiguration(pRNG, U); Sp<nSp>::ColdConfiguration(pRNG, U);
} else } else
{ {
Group::ColdConfiguration(pRNG, U); Group::ColdConfiguration(pRNG, U);

View File

@ -5,16 +5,21 @@
NAMESPACE_BEGIN(Grid); NAMESPACE_BEGIN(Grid);
// Sp(2N) // Sp(2N)
// ncolour = 2N // ncolour = N
// 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 nsp = ncolour/2; static const int Dimension = ncolour*2;
static const int Dimension = ncolour; static const int AlgebraDimension = ncolour*(2*ncolour +1);
static const int AlgebraDimension = nsp*(2*nsp +1); static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; }
static int su2subgroups(void) { return (nsp * (nsp - 1)) / 2; } static const int nnsp = ncolour;
template <typename vtype> template <typename vtype>
@ -60,6 +65,9 @@ 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
@ -67,10 +75,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 = nsp * (nsp-1) * 0.5; int mod = ncolour * (ncolour-1) * 0.5;
int offdiag = 2*nsp*nsp; // number of generators not in the cartan subalgebra int offdiag = 2*ncolour*ncolour; // number of generators not in the cartan subalgebra
int wmod = 4*mod; int wmod = 4*mod;
int zmod = wmod+nsp; int zmod = wmod+ncolour;
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;
@ -128,7 +136,7 @@ public:
RealD nrm = 1.0 / 2; RealD nrm = 1.0 / 2;
ta()()(diagIndex,diagIndex) = nrm; ta()()(diagIndex,diagIndex) = nrm;
ta()()(diagIndex+nsp,diagIndex+nsp) = -nrm; ta()()(diagIndex+ncolour,diagIndex+ncolour) = -nrm;
} }
template <class cplx> template <class cplx>
@ -144,8 +152,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+nsp,i2+nsp) = -1; ta()()(i1+ncolour,i2+ncolour) = -1;
ta()()(i2+nsp,i1+nsp) = -1; ta()()(i2+ncolour,i1+ncolour) = -1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -166,8 +174,8 @@ public:
ta()()(i1,i2) = i; ta()()(i1,i2) = i;
ta()()(i2,i1) = -i; ta()()(i2,i1) = -i;
ta()()(i1+nsp,i2+nsp) = i; ta()()(i1+ncolour,i2+ncolour) = i;
ta()()(i2+nsp,i1+nsp) = -i; ta()()(i2+ncolour,i1+ncolour) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -183,10 +191,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+nsp) = 1; ta()()(i1,i2+ncolour) = 1;
ta()()(i2,i1+nsp) = 1; ta()()(i2,i1+ncolour) = 1;
ta()()(i1+nsp,i2) = 1; ta()()(i1+ncolour,i2) = 1;
ta()()(i2+nsp,i1) = 1; ta()()(i2+ncolour,i1) = 1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -202,10 +210,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+nsp) = i; ta()()(i1,i2+ncolour) = i;
ta()()(i2,i1+nsp) = i; ta()()(i2,i1+ncolour) = i;
ta()()(i1+nsp,i2) = -i; ta()()(i1+ncolour,i2) = -i;
ta()()(i2+nsp,i1) = -i; ta()()(i2+ncolour,i1) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -218,8 +226,8 @@ public:
ta = Zero(); ta = Zero();
RealD nrm = 1.0 / 2; //check RealD nrm = 1.0 / 2; //check
ta()()(wIndex,wIndex+nsp) = 1; ta()()(wIndex,wIndex+ncolour) = 1;
ta()()(wIndex+nsp,wIndex) = 1; ta()()(wIndex+ncolour,wIndex) = 1;
ta = ta * nrm; ta = ta * nrm;
} }
@ -232,8 +240,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+nsp) = i; ta()()(zIndex,zIndex+ncolour) = i;
ta()()(zIndex+nsp,zIndex) = -i; ta()()(zIndex+ncolour,zIndex) = -i;
ta = ta * nrm; ta = ta * nrm;
} }
@ -243,11 +251,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 < (nsp * (nsp - 1)) / 2)); assert((su2_index >= 0) && (su2_index < (ncolour * (ncolour - 1)) / 2));
int spare = su2_index; int spare = su2_index;
for (i1 = 0; spare >= (nsp - 1 - i1); i1++) { for (i1 = 0; spare >= (ncolour - 1 - i1); i1++) {
spare = spare - (nsp - 1 - i1); // remove the Nc-1-i1 terms spare = spare - (ncolour - 1 - i1); // remove the Nc-1-i1 terms
} }
i2 = i1 + 1 + spare; i2 = i1 + 1 + spare;
} }
@ -260,7 +268,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 = " << ncolour << std::endl; std::cout << GridLogMessage << "Nc (2n) = " << 2*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;
} }
@ -456,17 +464,10 @@ public:
ColourMatrix Omega; ColourMatrix Omega;
Omega = Zero(); Omega = Zero();
std::cout << GridLogMessage << "I am a ColourMatrix" << std::endl; for (int i = 0; i < ncolour; i++)
//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, nsp+i) = 1.; Omega()()(i, 2*ncolour-1-i) = 1.;
Omega()()(nsp+i, i) = -1; Omega()()(2*ncolour-1-i, i) = -1;
} }
auto diff = Omega - (in * Omega * transpose(in) ); auto diff = Omega - (in * Omega * transpose(in) );
@ -497,8 +498,6 @@ 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);
@ -517,12 +516,10 @@ public:
Omega = Zero(); Omega = Zero();
identity = 1.; identity = 1.;
std::cout << GridLogMessage << "I am a LatticeColourMatrix " << std::endl; for (int i = 0; i < ncolour; i++)
for (int i = 0; i < nsp; i++)
{ {
Omega()()(i, nsp+i) = 1.; Omega()()(i, ncolour+i) = 1.;
Omega()()(nsp+i, i) = -1; Omega()()(ncolour+i, i) = -1;
} }
std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl; std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl;
@ -571,10 +568,10 @@ public:
} }
} }
typedef Sp<2> Sp2; typedef Sp<1> Sp2;
typedef Sp<4> Sp4; typedef Sp<2> Sp4;
typedef Sp<6> Sp6; typedef Sp<3> Sp6;
typedef Sp<8> Sp8; typedef Sp<4> 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 = Sp<Nc>::nsp; const int nsp = Nc / 2;
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<Nc>::ColdConfiguration(pRNG,Umu); Sp<nsp>::ColdConfiguration(pRNG,Umu);
Sp<Nc>::OmegaInvariance(Umu); Sp<nsp>::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<Nc>::HotConfiguration(pRNG,Umu); Sp<nsp>::HotConfiguration(pRNG,Umu);
Sp<Nc>::OmegaInvariance(Umu); Sp<nsp>::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<Nc>::TepidConfiguration(pRNG,Umu); Sp<nsp>::TepidConfiguration(pRNG,Umu);
Sp<Nc>::OmegaInvariance(Umu); Sp<nsp>::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<Nc>::HotConfiguration(pRNG,Umu); Sp<nsp>::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<Nc>::HotConfiguration(pRNG,Umu); Sp<nsp>::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,8 +20,7 @@ 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;
@ -48,7 +47,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<Nc>::OmegaInvariance(U); Sp<nsp>::OmegaInvariance(U);
std::cout <<GridLogMessage << std::endl; std::cout <<GridLogMessage << std::endl;
U = U + epsilon*identity; U = U + epsilon*identity;
@ -79,7 +78,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<Nc>::OmegaInvariance(U); Sp<nsp>::OmegaInvariance(U);
// checks on elements // checks on elements