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

Merge pull request #14 from chillenzer/unify_gauge_groups

Unify gauge groups (closes #5)
This commit is contained in:
Alessandro Lupo 2022-12-01 17:35:46 +00:00 committed by GitHub
commit 8c80f1c168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1286 additions and 1482 deletions

View File

@ -150,7 +150,7 @@ public:
P = Ta(P); P = Ta(P);
//const int nsp = Nc / 2; //const int nsp = Nc / 2;
Sp<Nc>::iSp2nMatrix<Complex> gen; Sp<Nc>::iGroupMatrix<Complex> gen;
auto Psum = P; auto Psum = P;

454
Grid/qcd/utils/GaugeGroup.h Normal file
View File

@ -0,0 +1,454 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/utils/SUn.h
Copyright (C) 2015
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
Author: neo <cossu@post.kek.jp>
Author: paboyle <paboyle@ph.ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef QCD_UTIL_SUN_H
#define QCD_UTIL_SUN_H
#define ONLY_IF_SU \
typename dummy_name = group_name, \
typename = std::enable_if_t < \
std::is_same<dummy_name, group_name>::value && \
is_su<dummy_name>::value >
#define ONLY_IF_Sp \
typename dummy_name = group_name, \
typename = std::enable_if_t < \
std::is_same<dummy_name, group_name>::value && \
is_sp<dummy_name>::value >
NAMESPACE_BEGIN(Grid);
namespace GroupName {
class SU {};
class Sp {};
} // namespace GroupName
template <typename group_name>
struct is_su {
static const bool value = false;
};
template <>
struct is_su<GroupName::SU> {
static const bool value = true;
};
template <typename group_name>
struct is_sp {
static const bool value = false;
};
template <>
struct is_sp<GroupName::Sp> {
static const bool value = true;
};
template <typename group_name>
constexpr int compute_adjoint_dimension(int ncolour);
template <>
constexpr int compute_adjoint_dimension<GroupName::SU>(int ncolour) {
return ncolour * ncolour - 1;
}
template <>
constexpr int compute_adjoint_dimension<GroupName::Sp>(int ncolour) {
return ncolour / 2 * (ncolour + 1);
}
template <int ncolour, class group_name>
class GaugeGroup {
public:
static const int Dimension = ncolour;
static const int AdjointDimension =
compute_adjoint_dimension<group_name>(ncolour);
static const int AlgebraDimension =
compute_adjoint_dimension<group_name>(ncolour);
template <typename vtype>
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
template <typename vtype>
using iGroupMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
template <typename vtype>
using iAlgebraVector = iScalar<iScalar<iVector<vtype, AdjointDimension> > >;
static int su2subgroups(void) { return su2subgroups(group_name()); }
//////////////////////////////////////////////////////////////////////////////////////////////////
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
// SU<2>::LatticeMatrix etc...
//////////////////////////////////////////////////////////////////////////////////////////////////
typedef iGroupMatrix<Complex> Matrix;
typedef iGroupMatrix<ComplexF> MatrixF;
typedef iGroupMatrix<ComplexD> MatrixD;
typedef iGroupMatrix<vComplex> vMatrix;
typedef iGroupMatrix<vComplexF> vMatrixF;
typedef iGroupMatrix<vComplexD> vMatrixD;
// For the projectors to the algebra
// these should be real...
// keeping complex for consistency with the SIMD vector types
typedef iAlgebraVector<Complex> AlgebraVector;
typedef iAlgebraVector<ComplexF> AlgebraVectorF;
typedef iAlgebraVector<ComplexD> AlgebraVectorD;
typedef iAlgebraVector<vComplex> vAlgebraVector;
typedef iAlgebraVector<vComplexF> vAlgebraVectorF;
typedef iAlgebraVector<vComplexD> vAlgebraVectorD;
typedef Lattice<vMatrix> LatticeMatrix;
typedef Lattice<vMatrixF> LatticeMatrixF;
typedef Lattice<vMatrixD> LatticeMatrixD;
typedef Lattice<vAlgebraVector> LatticeAlgebraVector;
typedef Lattice<vAlgebraVectorF> LatticeAlgebraVectorF;
typedef Lattice<vAlgebraVectorD> LatticeAlgebraVectorD;
typedef iSU2Matrix<Complex> SU2Matrix;
typedef iSU2Matrix<ComplexF> SU2MatrixF;
typedef iSU2Matrix<ComplexD> SU2MatrixD;
typedef iSU2Matrix<vComplex> vSU2Matrix;
typedef iSU2Matrix<vComplexF> vSU2MatrixF;
typedef iSU2Matrix<vComplexD> vSU2MatrixD;
typedef Lattice<vSU2Matrix> LatticeSU2Matrix;
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
#include "Grid/qcd/utils/SUn.h"
#include "Grid/qcd/utils/Sp2n.h"
public:
template <class cplx>
static void generator(int lieIndex, iGroupMatrix<cplx> &ta) {
return generator(lieIndex, ta, group_name());
}
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
return su2SubGroupIndex(i1, i2, su2_index, group_name());
}
static void testGenerators(void) { testGenerators(group_name()); }
static void printGenerators(void) {
for (int gen = 0; gen < AdjointDimension; gen++) {
Matrix ta;
generator(gen, ta);
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
<< std::endl;
std::cout << GridLogMessage << ta << std::endl;
}
}
// reunitarise??
template <typename LatticeMatrixType>
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out,
double scale = 1.0) {
GridBase *grid = out.Grid();
typedef typename LatticeMatrixType::vector_type vector_type;
typedef typename LatticeMatrixType::scalar_type scalar_type;
typedef iSinglet<vector_type> vTComplexType;
typedef Lattice<vTComplexType> LatticeComplexType;
typedef typename GridTypeMapper<
typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
LatticeComplexType ca(grid);
LatticeMatrixType lie(grid);
LatticeMatrixType la(grid);
ComplexD ci(0.0, scale);
// ComplexD cone(1.0, 0.0);
MatrixType ta;
lie = Zero();
for (int a = 0; a < AdjointDimension; a++) {
random(pRNG, ca);
ca = (ca + conjugate(ca)) * 0.5;
ca = ca - 0.5;
generator(a, ta);
la = ci * ca * ta;
lie = lie + la; // e^{i la ta}
}
taExp(lie, out);
}
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
LatticeMatrix &out,
Real scale = 1.0) {
GridBase *grid = out.Grid();
LatticeReal ca(grid);
LatticeMatrix la(grid);
Complex ci(0.0, scale);
Matrix ta;
out = Zero();
for (int a = 0; a < AdjointDimension; a++) {
gaussian(pRNG, ca);
generator(a, ta);
la = toComplex(ca) * ta;
out += la;
}
out *= ci;
}
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h,
LatticeMatrix &out,
Real scale = 1.0) {
conformable(h, out);
GridBase *grid = out.Grid();
LatticeMatrix la(grid);
Matrix ta;
out = Zero();
for (int a = 0; a < AdjointDimension; a++) {
generator(a, ta);
la = peekColour(h, a) * timesI(ta) * scale;
out += la;
}
}
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1
// ) inverse operation: FundamentalLieAlgebraMatrix
static void projectOnAlgebra(LatticeAlgebraVector &h_out,
const LatticeMatrix &in, Real scale = 1.0) {
conformable(h_out, in);
h_out = Zero();
Matrix Ta;
for (int a = 0; a < AdjointDimension; a++) {
generator(a, Ta);
pokeColour(h_out, -2.0 * (trace(timesI(Ta) * in)) * scale, a);
}
}
template <typename GaugeField>
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
typedef typename GaugeField::vector_type vector_type;
typedef iGroupMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
LieRandomize(pRNG, Umu, 1.0);
PokeIndex<LorentzIndex>(out, Umu, mu);
}
}
template <typename GaugeField>
static void TepidConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
typedef typename GaugeField::vector_type vector_type;
typedef iGroupMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
LieRandomize(pRNG, Umu, 0.01);
PokeIndex<LorentzIndex>(out, Umu, mu);
}
}
template <typename GaugeField>
static void ColdConfiguration(GaugeField &out) {
typedef typename GaugeField::vector_type vector_type;
typedef iGroupMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
Umu = 1.0;
for (int mu = 0; mu < Nd; mu++) {
PokeIndex<LorentzIndex>(out, Umu, mu);
}
}
template <typename GaugeField>
static void ColdConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
ColdConfiguration(out);
}
template <typename LatticeMatrixType, ONLY_IF_SU>
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
out = Ta(in);
}
template <typename LatticeMatrixType>
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) {
typedef typename LatticeMatrixType::scalar_type ComplexType;
LatticeMatrixType xn(x.Grid());
RealD nfac = 1.0;
xn = x;
ex = xn + ComplexType(1.0); // 1+x
// Do a 12th order exponentiation
for (int i = 2; i <= 12; ++i) {
nfac = nfac / RealD(i); // 1/2, 1/2.3 ...
xn = xn * x; // x2, x3,x4....
ex = ex + xn * nfac; // x2/2!, x3/3!....
}
}
};
template <int N>
LatticeComplexD Determinant(
const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
GridBase *grid = Umu.Grid();
auto lvol = grid->lSites();
LatticeComplexD ret(grid);
autoView(Umu_v, Umu, CpuRead);
autoView(ret_v, ret, CpuWrite);
thread_for(site, lvol, {
Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N, N);
Coordinate lcoor;
grid->LocalIndexToLocalCoor(site, lcoor);
iScalar<iScalar<iMatrix<ComplexD, N> > > Us;
peekLocalSite(Us, Umu_v, lcoor);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
EigenU(i, j) = Us()()(i, j);
}
}
ComplexD det = EigenU.determinant();
pokeLocalSite(det, ret_v, lcoor);
});
return ret;
}
template <int N>
static void ProjectSUn(
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
Umu = ProjectOnGroup(Umu);
auto det = Determinant(Umu);
det = conjugate(det);
for (int i = 0; i < N; i++) {
auto element = PeekIndex<ColourIndex>(Umu, N - 1, i);
element = element * det;
PokeIndex<ColourIndex>(Umu, element, Nc - 1, i);
}
}
template <int N>
static void ProjectSUn(
Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
GridBase *grid = U.Grid();
// Reunitarise
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
Umu = ProjectOnGroup(Umu);
ProjectSUn(Umu);
PokeIndex<LorentzIndex>(U, Umu, mu);
}
}
// Explicit specialisation for SU(3).
// Explicit specialisation for SU(3).
static void ProjectSU3(
Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &Umu) {
GridBase *grid = Umu.Grid();
const int x = 0;
const int y = 1;
const int z = 2;
// Reunitarise
Umu = ProjectOnGroup(Umu);
autoView(Umu_v, Umu, CpuWrite);
thread_for(ss, grid->oSites(), {
auto cm = Umu_v[ss];
cm()()(2, x) = adj(cm()()(0, y) * cm()()(1, z) -
cm()()(0, z) * cm()()(1, y)); // x= yz-zy
cm()()(2, y) = adj(cm()()(0, z) * cm()()(1, x) -
cm()()(0, x) * cm()()(1, z)); // y= zx-xz
cm()()(2, z) = adj(cm()()(0, x) * cm()()(1, y) -
cm()()(0, y) * cm()()(1, x)); // z= xy-yx
Umu_v[ss] = cm;
});
}
static void ProjectSU3(
Lattice<iVector<iScalar<iMatrix<vComplexD, 3> >, Nd> > &U) {
GridBase *grid = U.Grid();
// Reunitarise
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
Umu = ProjectOnGroup(Umu);
ProjectSU3(Umu);
PokeIndex<LorentzIndex>(U, Umu, mu);
}
}
template <int ncolour>
using SU = GaugeGroup<ncolour, GroupName::SU>;
template <int ncolour>
using Sp = GaugeGroup<ncolour, GroupName::Sp>;
typedef SU<2> SU2;
typedef SU<3> SU3;
typedef SU<4> SU4;
typedef SU<5> SU5;
typedef SU<Nc> FundamentalMatrices;
template <int N>
static void ProjectSp2n(
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
Umu = ProjectOnSpGroup(Umu);
auto det = Determinant(Umu); // ok ?
det = conjugate(det);
for (int i = 0; i < N; i++) {
auto element = PeekIndex<ColourIndex>(Umu, N - 1, i);
element = element * det;
PokeIndex<ColourIndex>(Umu, element, Nc - 1, i);
}
}
template <int N>
static void ProjectSp2n(
Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
GridBase *grid = U.Grid();
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
Umu = ProjectOnSpGroup(Umu);
ProjectSp2n(Umu);
PokeIndex<LorentzIndex>(U, Umu, mu);
}
}
typedef Sp<2> Sp2;
typedef Sp<4> Sp4;
typedef Sp<6> Sp6;
typedef Sp<8> Sp8;
NAMESPACE_END(Grid);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,580 +1,334 @@
#ifndef QCD_UTIL_Sp2n_H private:
#define QCD_UTIL_Sp2n_H static int su2subgroups(GroupName::Sp) { return (ncolour/2 * (ncolour/2 - 1)) / 2; }
NAMESPACE_BEGIN(Grid); // Sp(2N) has N(2N+1) = 2N^2+N generators
//
// normalise the generators such that
// Trace ( Ta Tb) = 1/2 delta_ab
//
// N generators in the cartan, 2N^2 off
// off diagonal:
// there are 6 types named a,b,c,d and w,z
// abcd are N(N-1)/2 each while wz are N each
// Sp(2N) template <class cplx, ONLY_IF_Sp>
// ncolour = 2N static void generator(int lieIndex, iGroupMatrix<cplx> &ta, GroupName::Sp) {
// map lie index into type of generators: diagonal, abcd type, wz type
const int nsp = ncolour/2;
int diagIndex;
int aIndex, bIndex, cIndex, dIndex;
int wIndex, zIndex; // a,b,c,d are N(N-1)/2 and w,z are N
const int mod = nsp * (nsp - 1) * 0.5;
const int offdiag =
2 * nsp * nsp; // number of generators not in the cartan subalgebra
const int wmod = 4 * mod;
const int zmod = wmod + nsp;
if (lieIndex >= offdiag) {
diagIndex = lieIndex - offdiag; // 0, ... ,N-1
// std::cout << GridLogMessage << "diag type " << std::endl;
generatorDiagtype(diagIndex, ta);
return;
}
if ((lieIndex >= wmod) && (lieIndex < zmod)) {
// std::cout << GridLogMessage << "w type " << std::endl;
wIndex = lieIndex - wmod; // 0, ... ,N-1
generatorWtype(wIndex, ta);
return;
}
if ((lieIndex >= zmod) && (lieIndex < offdiag)) {
// std::cout << GridLogMessage << "z type " << std::endl;
// std::cout << GridLogMessage << "lie index " << lieIndex << std::endl;
// std::cout << GridLogMessage << "z mod " << zmod << std::endl;
zIndex = lieIndex - zmod; // 0, ... ,N-1
generatorZtype(zIndex, ta);
return;
}
if (lieIndex < mod) { // atype 0, ... , N(N-1)/2=mod
// std::cout << GridLogMessage << "a type " << std::endl;
aIndex = lieIndex;
// std::cout << GridLogMessage << "a indx " << aIndex << std::endl;
generatorAtype(aIndex, ta);
return;
}
if ((lieIndex >= mod) && lieIndex < 2 * mod) { // btype mod, ... , 2mod-1
// std::cout << GridLogMessage << "b type " << std::endl;
bIndex = lieIndex - mod;
generatorBtype(bIndex, ta);
return;
}
if ((lieIndex >= 2 * mod) &&
lieIndex < 3 * mod) { // ctype 2mod, ... , 3mod-1
// std::cout << GridLogMessage << "c type " << std::endl;
cIndex = lieIndex - 2 * mod;
generatorCtype(cIndex, ta);
return;
}
if ((lieIndex >= 3 * mod) &&
lieIndex < wmod) { // ctype 3mod, ... , 4mod-1 = wmod-1
// std::cout << GridLogMessage << "d type " << std::endl;
dIndex = lieIndex - 3 * mod;
generatorDtype(dIndex, ta);
return;
}
template <int ncolour> } // end of generator
class Sp {
public:
static const int nsp = ncolour/2;
static const int Dimension = ncolour;
static const int AlgebraDimension = nsp*(2*nsp +1);
static int su2subgroups(void) { return (nsp * (nsp - 1)) / 2; }
template <typename vtype>
using iSp2nMatrix = iScalar<iScalar<iMatrix<vtype, Dimension> > >;
template <typename vtype>
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
template <typename vtype>
using iSp2nAlgebraVector = iScalar<iScalar<iVector<vtype, AlgebraDimension> > >;
typedef iSp2nMatrix<Complex> Matrix;
typedef iSp2nMatrix<ComplexF> MatrixF;
typedef iSp2nMatrix<ComplexD> MatrixD;
typedef iSp2nMatrix<vComplex> vMatrix;
typedef iSp2nMatrix<vComplexF> vMatrixF;
typedef iSp2nMatrix<vComplexD> vMatrixD;
typedef iSp2nAlgebraVector<Complex> AlgebraVector;
typedef iSp2nAlgebraVector<ComplexF> AlgebraVectorF;
typedef iSp2nAlgebraVector<ComplexD> AlgebraVectorD;
typedef iSp2nAlgebraVector<vComplex> vAlgebraVector;
typedef iSp2nAlgebraVector<vComplexF> vAlgebraVectorF;
typedef iSp2nAlgebraVector<vComplexD> vAlgebraVectorD;
typedef Lattice<vMatrix> LatticeMatrix;
typedef Lattice<vMatrixF> LatticeMatrixF;
typedef Lattice<vMatrixD> LatticeMatrixD;
typedef Lattice<vAlgebraVector> LatticeAlgebraVector;
typedef Lattice<vAlgebraVectorF> LatticeAlgebraVectorF;
typedef Lattice<vAlgebraVectorD> LatticeAlgebraVectorD;
// Sp(2N) has N(2N+1) = 2N^2+N generators
//
// normalise the generators such that
// Trace ( Ta Tb) = 1/2 delta_ab
//
// N generators in the cartan, 2N^2 off
// off diagonal:
// there are 6 types named a,b,c,d and w,z
// abcd are N(N-1)/2 each while wz are N each
template <class cplx>
static void generator(int lieIndex, iSp2nMatrix<cplx> &ta) {
// map lie index into type of generators: diagonal, abcd type, wz type
int diagIndex; template <class cplx, ONLY_IF_Sp>
int aIndex, bIndex, cIndex, dIndex; static void generatorDiagtype(int diagIndex, iGroupMatrix<cplx> &ta) {
int wIndex, zIndex; // a,b,c,d are N(N-1)/2 and w,z are N // ta(i,i) = - ta(i+N,i+N) = 1/2 for each i index of the cartan subalgebra
int mod = nsp * (nsp-1) * 0.5;
int offdiag = 2*nsp*nsp; // number of generators not in the cartan subalgebra
int wmod = 4*mod;
int zmod = wmod+nsp;
if (lieIndex >= offdiag) {
diagIndex = lieIndex - offdiag; // 0, ... ,N-1
//std::cout << GridLogMessage << "diag type " << std::endl;
generatorDiagtype(diagIndex, ta);
return;
}
if ( (lieIndex >= wmod) && (lieIndex < zmod) ) {
//std::cout << GridLogMessage << "w type " << std::endl;
wIndex = lieIndex- wmod; // 0, ... ,N-1
generatorWtype(wIndex,ta);
return;
}
if ( (lieIndex >= zmod) && (lieIndex < offdiag) ) {
//std::cout << GridLogMessage << "z type " << std::endl;
//std::cout << GridLogMessage << "lie index " << lieIndex << std::endl;
//std::cout << GridLogMessage << "z mod " << zmod << std::endl;
zIndex = lieIndex - zmod; // 0, ... ,N-1
generatorZtype(zIndex,ta);
return;
}
if (lieIndex < mod) { // atype 0, ... , N(N-1)/2=mod
//std::cout << GridLogMessage << "a type " << std::endl;
aIndex = lieIndex;
//std::cout << GridLogMessage << "a indx " << aIndex << std::endl;
generatorAtype(aIndex, ta);
return;
}
if ( (lieIndex >= mod) && lieIndex < 2*mod) { // btype mod, ... , 2mod-1
//std::cout << GridLogMessage << "b type " << std::endl;
bIndex = lieIndex - mod;
generatorBtype(bIndex, ta);
return;
}
if ( (lieIndex >= 2*mod) && lieIndex < 3*mod) { // ctype 2mod, ... , 3mod-1
//std::cout << GridLogMessage << "c type " << std::endl;
cIndex = lieIndex - 2*mod;
generatorCtype(cIndex, ta);
return;
}
if ( (lieIndex >= 3*mod) && lieIndex < wmod) { // ctype 3mod, ... , 4mod-1 = wmod-1
//std::cout << GridLogMessage << "d type " << std::endl;
dIndex = lieIndex - 3*mod;
generatorDtype(dIndex, ta);
return;
}
} //end of generator
template <class cplx>
static void generatorDiagtype(int diagIndex, iSp2nMatrix<cplx> &ta) {
// ta(i,i) = - ta(i+N,i+N) = 1/2 for each i index of the cartan subalgebra
ta = Zero();
RealD nrm = 1.0 / 2;
ta()()(diagIndex,diagIndex) = nrm; const int nsp=ncolour/2;
ta()()(diagIndex+nsp,diagIndex+nsp) = -nrm; ta = Zero();
} RealD nrm = 1.0 / 2;
template <class cplx>
static void generatorAtype(int aIndex, iSp2nMatrix<cplx> &ta) {
// ta(i,j) = ta(j,i) = -ta(i+N,j+N) = -ta(j+N,i+N) = 1 / 2 sqrt(2)
// with i<j and i=0,...,N-2
// follows that j=i+1, ... , N
int i1, i2;
ta = Zero();
RealD nrm = 1 / (2 * std::sqrt(2) );
su2SubGroupIndex(i1, i2, aIndex);
ta()()(i1,i2) = 1;
ta()()(i2,i1) = 1;
ta()()(i1+nsp,i2+nsp) = -1;
ta()()(i2+nsp,i1+nsp) = -1;
ta = ta * nrm; ta()()(diagIndex, diagIndex) = nrm;
} ta()()(diagIndex + nsp, diagIndex + nsp) = -nrm;
}
template <class cplx>
static void generatorBtype(int bIndex, iSp2nMatrix<cplx> &ta) {
// ta(i,j) = -ta(j,i) = ta(i+N,j+N) = -ta(j+N,i+N) = i / 1/ 2 sqrt(2)
// with i<j and i=0,...,N-2
// follows that j=i+1, ... , N-1
int i1, i2;
ta = Zero();
cplx i(0.0, 1.0);
RealD nrm = 1 / (2 * std::sqrt(2));
su2SubGroupIndex(i1, i2, bIndex);
ta()()(i1,i2) = i; template <class cplx, ONLY_IF_Sp>
ta()()(i2,i1) = -i; static void generatorAtype(int aIndex, iGroupMatrix<cplx> &ta) {
ta()()(i1+nsp,i2+nsp) = i; // ta(i,j) = ta(j,i) = -ta(i+N,j+N) = -ta(j+N,i+N) = 1 / 2 sqrt(2)
ta()()(i2+nsp,i1+nsp) = -i; // with i<j and i=0,...,N-2
// follows that j=i+1, ... , N
int i1, i2;
const int nsp=ncolour/2;
ta = Zero();
RealD nrm = 1 / (2 * std::sqrt(2));
ta = ta * nrm; su2SubGroupIndex(i1, i2, aIndex);
} ta()()(i1, i2) = 1;
ta()()(i2, i1) = 1;
template <class cplx> ta()()(i1 + nsp, i2 + nsp) = -1;
static void generatorCtype(int cIndex, iSp2nMatrix<cplx> &ta) { ta()()(i2 + nsp, i1 + nsp) = -1;
// ta(i,j+N) = ta(j,i+N) = ta(i+N,j) = ta(j+N,i) = 1 / 2 sqrt(2)
int i1, i2;
ta = Zero();
RealD nrm = 1 / (2 * std::sqrt(2) );
su2SubGroupIndex(i1, i2, cIndex);
ta()()(i1,i2+nsp) = 1;
ta()()(i2,i1+nsp) = 1;
ta()()(i1+nsp,i2) = 1;
ta()()(i2+nsp,i1) = 1;
ta = ta * nrm; ta = ta * nrm;
} }
template <class cplx>
static void generatorDtype(int dIndex, iSp2nMatrix<cplx> &ta) {
// ta(i,j+N) = ta(j,i+N) = -ta(i+N,j) = -ta(j+N,i) = i / 2 sqrt(2)
int i1, i2;
ta = Zero();
cplx i(0.0, 1.0);
RealD nrm = 1 / (2 * std::sqrt(2) );
su2SubGroupIndex(i1, i2, dIndex);
ta()()(i1,i2+nsp) = i; template <class cplx, ONLY_IF_Sp>
ta()()(i2,i1+nsp) = i; static void generatorBtype(int bIndex, iGroupMatrix<cplx> &ta) {
ta()()(i1+nsp,i2) = -i; // ta(i,j) = -ta(j,i) = ta(i+N,j+N) = -ta(j+N,i+N) = i / 1/ 2 sqrt(2)
ta()()(i2+nsp,i1) = -i; // with i<j and i=0,...,N-2
// follows that j=i+1, ... , N-1
ta = ta * nrm; const int nsp=ncolour/2;
} int i1, i2;
ta = Zero();
template <class cplx> cplx i(0.0, 1.0);
static void generatorWtype(int wIndex, iSp2nMatrix<cplx> &ta) { RealD nrm = 1 / (2 * std::sqrt(2));
su2SubGroupIndex(i1, i2, bIndex);
// ta(i,i+N) = ta(i+N,i) = 1/2
ta = Zero();
RealD nrm = 1.0 / 2; //check
ta()()(wIndex,wIndex+nsp) = 1; ta()()(i1, i2) = i;
ta()()(wIndex+nsp,wIndex) = 1; ta()()(i2, i1) = -i;
ta()()(i1 + nsp, i2 + nsp) = i;
ta = ta * nrm; ta()()(i2 + nsp, i1 + nsp) = -i;
}
template <class cplx>
static void generatorZtype(int zIndex, iSp2nMatrix<cplx> &ta) {
// ta(i,i+N) = - ta(i+N,i) = i/2
ta = Zero();
RealD nrm = 1.0 / 2; //check
cplx i(0.0, 1.0);
ta()()(zIndex,zIndex+nsp) = i;
ta()()(zIndex+nsp,zIndex) = -i;
ta = ta * nrm;
}
////////////////////////////////////////////////////////////////////////
// Map a su2 subgroup number to the pair of rows that are non zero
////////////////////////////////////////////////////////////////////////
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
assert((su2_index >= 0) && (su2_index < (nsp * (nsp - 1)) / 2));
int spare = su2_index; ta = ta * nrm;
for (i1 = 0; spare >= (nsp - 1 - i1); i1++) { }
spare = spare - (nsp - 1 - i1); // remove the Nc-1-i1 terms
} template <class cplx, ONLY_IF_Sp>
i2 = i1 + 1 + spare; static void generatorCtype(int cIndex, iGroupMatrix<cplx> &ta) {
} // ta(i,j+N) = ta(j,i+N) = ta(i+N,j) = ta(j+N,i) = 1 / 2 sqrt(2)
const int nsp=ncolour/2;
int i1, i2;
ta = Zero();
RealD nrm = 1 / (2 * std::sqrt(2));
static void printGenerators(void) { su2SubGroupIndex(i1, i2, cIndex);
for (int gen = 0; gen < AlgebraDimension; gen++) {
Matrix ta; ta()()(i1, i2 + nsp) = 1;
generator(gen, ta); ta()()(i2, i1 + nsp) = 1;
std::cout << GridLogMessage << "Nc = " << ncolour << std::endl; ta()()(i1 + nsp, i2) = 1;
std::cout << GridLogMessage << " t_" << gen << std::endl; ta()()(i2 + nsp, i1) = 1;
std::cout << GridLogMessage << ta << std::endl;
} ta = ta * nrm;
} }
template <class cplx, ONLY_IF_Sp>
static void generatorDtype(int dIndex, iGroupMatrix<cplx> &ta) {
static void testGenerators(void) { // ta(i,j+N) = ta(j,i+N) = -ta(i+N,j) = -ta(j+N,i) = i / 2 sqrt(2)
Matrix ta;
Matrix tb; const int nsp=ncolour/2;
std::cout << GridLogMessage << "Fundamental - Checking trace ta tb is 0.5 delta_ab " << std::endl; int i1, i2;
for (int a = 0; a < AlgebraDimension; a++) { ta = Zero();
for (int b = 0; b < AlgebraDimension; b++) { cplx i(0.0, 1.0);
generator(a,ta); RealD nrm = 1 / (2 * std::sqrt(2));
generator(b,tb); su2SubGroupIndex(i1, i2, dIndex);
Complex tr = TensorRemove(trace( ta * tb) );
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr ta()()(i1, i2 + nsp) = i;
ta()()(i2, i1 + nsp) = i;
ta()()(i1 + nsp, i2) = -i;
ta()()(i2 + nsp, i1) = -i;
ta = ta * nrm;
}
template <class cplx, ONLY_IF_Sp>
static void generatorWtype(int wIndex, iGroupMatrix<cplx> &ta) {
// ta(i,i+N) = ta(i+N,i) = 1/2
const int nsp=ncolour/2;
ta = Zero();
RealD nrm = 1.0 / 2; // check
ta()()(wIndex, wIndex + nsp) = 1;
ta()()(wIndex + nsp, wIndex) = 1;
ta = ta * nrm;
}
template <class cplx, ONLY_IF_Sp>
static void generatorZtype(int zIndex, iGroupMatrix<cplx> &ta) {
// ta(i,i+N) = - ta(i+N,i) = i/2
const int nsp=ncolour/2;
ta = Zero();
RealD nrm = 1.0 / 2; // check
cplx i(0.0, 1.0);
ta()()(zIndex, zIndex + nsp) = i;
ta()()(zIndex + nsp, zIndex) = -i;
ta = ta * nrm;
}
////////////////////////////////////////////////////////////////////////
// Map a su2 subgroup number to the pair of rows that are non zero
////////////////////////////////////////////////////////////////////////
template <ONLY_IF_Sp>
static void su2SubGroupIndex(int &i1, int &i2, int su2_index, GroupName::Sp) {
const int nsp=ncolour/2;
assert((su2_index >= 0) && (su2_index < (nsp * (nsp - 1)) / 2));
int spare = su2_index;
for (i1 = 0; spare >= (nsp - 1 - i1); i1++) {
spare = spare - (nsp - 1 - i1); // remove the Nc-1-i1 terms
}
i2 = i1 + 1 + spare;
}
static void testGenerators(GroupName::Sp) {
Matrix ta;
Matrix tb;
std::cout << GridLogMessage
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab "
<< std::endl;
for (int a = 0; a < AlgebraDimension; a++) {
for (int b = 0; b < AlgebraDimension; b++) {
generator(a, ta);
generator(b, tb);
Complex tr = TensorRemove(trace(ta * tb));
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
<< std::endl; << std::endl;
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6); if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
if (a != b) assert(abs(tr) < 1.0e-6); if (a != b) assert(abs(tr) < 1.0e-6);
}
}
std::cout << GridLogMessage << std::endl;
std::cout << GridLogMessage << "Fundamental - Checking if hermitian" << std::endl;
for (int a = 0; a < AlgebraDimension; a++) {
generator(a,ta);
std::cout << GridLogMessage << a << std::endl;
assert(norm2(ta - adj(ta)) < 1.0e-6);
}
std::cout << GridLogMessage << std::endl;
std::cout << GridLogMessage << "Fundamental - Checking if traceless" << std::endl;
for (int a = 0; a < AlgebraDimension; a++) {
generator(a, ta);
Complex tr = TensorRemove(trace(ta));
std::cout << GridLogMessage << a << std::endl;
assert(abs(tr) < 1.0e-6);
}
} }
}
std::cout << GridLogMessage << std::endl;
template <typename LatticeMatrixType> std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out, double scale = 1.0) << std::endl;
{ for (int a = 0; a < AlgebraDimension; a++) {
GridBase *grid = out.Grid(); generator(a, ta);
std::cout << GridLogMessage << a << std::endl;
assert(norm2(ta - adj(ta)) < 1.0e-6);
}
std::cout << GridLogMessage << std::endl;
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
<< std::endl;
for (int a = 0; a < AlgebraDimension; a++) {
generator(a, ta);
Complex tr = TensorRemove(trace(ta));
std::cout << GridLogMessage << a << std::endl;
assert(abs(tr) < 1.0e-6);
}
}
typedef typename LatticeMatrixType::vector_type vector_type; public:
typedef typename LatticeMatrixType::scalar_type scalar_type; template <ONLY_IF_Sp>
static void OmegaInvariance(ColourMatrix &in) {
ColourMatrix Omega;
Omega = Zero();
const int nsp=ncolour/2;
typedef iSinglet<vector_type> vTComplexType; std::cout << GridLogMessage << "I am a ColourMatrix" << std::endl;
typedef Lattice<vTComplexType> LatticeComplexType; // for (int i = 0; i < ncolour; i++) wrong?!
typedef typename GridTypeMapper<typename LatticeMatrixType::vector_object>::scalar_object MatrixType; //{
// 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()()(nsp + i, i) = -1;
}
LatticeComplexType ca(grid); auto diff = Omega - (in * Omega * transpose(in));
LatticeMatrixType lie(grid); auto sdiff = norm2(diff);
LatticeMatrixType la(grid); if (norm2(sdiff) < 1e-8) {
ComplexD ci(0.0, scale); std::cout << GridLogMessage
// ComplexD cone(1.0, 0.0); << "Symplectic condition satisfied: Omega invariant" << std::endl;
MatrixType ta; } else {
std::cout << GridLogMessage
<< "WARNING!!!!!! Matrix Omega NOT left invariant by "
<< norm2(sdiff) << std::endl;
}
}
lie = Zero(); template <typename GaugeField, ONLY_IF_Sp>
static void OmegaInvariance(GaugeField &in) {
typedef typename GaugeField::vector_type vector_type;
typedef iGroupMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
for (int a = 0; a < AlgebraDimension; a++) { LatticeMatrixType U(in.Grid());
random(pRNG, ca); LatticeMatrixType OmegaLatt(in.Grid());
LatticeMatrixType identity(in.Grid());
RealD vol = in.Grid()->gSites();
ColourMatrix Omega;
ca = (ca + conjugate(ca)) * 0.5; OmegaLatt = Zero();
ca = ca - 0.5; Omega = Zero();
identity = 1.;
generator(a, ta); std::cout << GridLogMessage << "I am a GaugeField " << std::endl;
la = ci * ca * ta; U = PeekIndex<LorentzIndex>(in, 1);
lie = lie + la; // e^{i la ta} OmegaInvariance(U);
}
} template <ONLY_IF_Sp>
taExp(lie, out); static void OmegaInvariance(LatticeColourMatrixD &in) {
} const int nsp=ncolour/2;
LatticeColourMatrixD OmegaLatt(in.Grid());
LatticeColourMatrixD identity(in.Grid());
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG, //same as sun RealD vol = in.Grid()->gSites();
LatticeMatrix &out, ColourMatrix Omega;
Real scale = 1.0) {
GridBase *grid = out.Grid();
LatticeReal ca(grid);
LatticeMatrix la(grid);
Complex ci(0.0, scale);
Matrix ta;
out = Zero(); OmegaLatt = Zero();
for (int a = 0; a < AlgebraDimension; a++) { Omega = Zero();
gaussian(pRNG, ca); identity = 1.;
generator(a, ta);
la = toComplex(ca) * ta;
out += la;
}
out *= ci;
}
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h,
LatticeMatrix &out,
Real scale = 1.0) {
conformable(h, out);
GridBase *grid = out.Grid();
LatticeMatrix la(grid);
Matrix ta;
out = Zero(); std::cout << GridLogMessage << "I am a LatticeColourMatrix " << std::endl;
for (int a = 0; a < AlgebraDimension; a++) {
generator(a, ta);
la = peekColour(h, a) * timesI(ta) * scale;
out += la;
}
}
template <typename LatticeMatrixType>
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) { // same as sun
typedef typename LatticeMatrixType::scalar_type ComplexType;
LatticeMatrixType xn(x.Grid()); for (int i = 0; i < nsp; i++) {
RealD nfac = 1.0; Omega()()(i, nsp + i) = 1.;
Omega()()(nsp + i, i) = -1;
}
xn = x; std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl;
ex = xn + ComplexType(1.0); // 1+x OmegaLatt = OmegaLatt + (identity * Omega);
// Do a 12th order exponentiation auto diff = OmegaLatt - (in * OmegaLatt * transpose(in));
for (int i = 2; i <= 12; ++i) { auto sdiff = sum(diff);
nfac = nfac / RealD(i); // 1/2, 1/2.3 ... // assert( norm2(sdiff) < 1e-8 );
xn = xn * x; // x2, x3,x4.... if (norm2(sdiff) < 1e-8) {
ex = ex + xn * nfac; // x2/2!, x3/3!.... std::cout << GridLogMessage
} << "Symplectic condition satisfied: Omega invariant" << std::endl;
} } else {
std::cout << GridLogMessage
static void projectOnAlgebra(LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale = 1.0) { << "WARNING!!!!!! Matrix Omega NOT left invariant by "
conformable(h_out, in); << norm2(sdiff) << std::endl;
h_out = Zero(); }
Matrix Ta; }
for (int a = 0; a < AlgebraDimension; a++) {
generator(a, Ta);
pokeColour(h_out, - 2.0 * (trace(timesI(Ta) * in)) * scale, a);
}
}
template <typename GaugeField>
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
typedef typename GaugeField::vector_type vector_type;
typedef iSp2nMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
LieRandomize(pRNG, Umu, 1.0); //def
PokeIndex<LorentzIndex>(out, Umu, mu);
}
}
template<typename GaugeField>
static void TepidConfiguration(GridParallelRNG &pRNG,GaugeField &out){
typedef typename GaugeField::vector_type vector_type;
typedef iSp2nMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
for(int mu=0;mu<Nd;mu++){
LieRandomize(pRNG,Umu,0.01); //def
PokeIndex<LorentzIndex>(out,Umu,mu);
}
}
template<typename GaugeField>
static void ColdConfiguration(GaugeField &out){
typedef typename GaugeField::vector_type vector_type;
typedef iSp2nMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out.Grid());
Umu=1.0;
for(int mu=0;mu<Nd;mu++){
PokeIndex<LorentzIndex>(out,Umu,mu);
}
}
template<typename GaugeField>
static void ColdConfiguration(GridParallelRNG &pRNG,GaugeField &out){
ColdConfiguration(out);
}
static void OmegaInvariance(ColourMatrix &in)
{
ColourMatrix Omega;
Omega = Zero();
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, nsp+i) = 1.;
Omega()()(nsp+i, i) = -1;
}
auto diff = Omega - (in * Omega * transpose(in) );
auto sdiff = norm2(diff);
if (norm2(sdiff) < 1e-8)
{
std::cout << GridLogMessage << "Symplectic condition satisfied: Omega invariant" << std::endl;
} else {
std::cout << GridLogMessage << "WARNING!!!!!! Matrix Omega NOT left invariant by " << norm2(sdiff) << std::endl;
}
}
template<typename GaugeField>
static void OmegaInvariance(GaugeField &in)
{
typedef typename GaugeField::vector_type vector_type;
typedef iSp2nMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType U(in.Grid());
LatticeMatrixType OmegaLatt(in.Grid());
LatticeMatrixType identity(in.Grid());
RealD vol = in.Grid()->gSites();
ColourMatrix Omega;
OmegaLatt = Zero();
Omega = Zero();
identity = 1.;
std::cout << GridLogMessage << "I am a GaugeField " << std::endl;
U = PeekIndex<LorentzIndex>(in,1);
OmegaInvariance(U);
}
static void OmegaInvariance(LatticeColourMatrixD &in)
{
LatticeColourMatrixD OmegaLatt(in.Grid());
LatticeColourMatrixD identity(in.Grid());
RealD vol = in.Grid()->gSites();
ColourMatrix Omega;
OmegaLatt = Zero();
Omega = Zero();
identity = 1.;
std::cout << GridLogMessage << "I am a LatticeColourMatrix " << std::endl;
for (int i = 0; i < nsp; i++)
{
Omega()()(i, nsp+i) = 1.;
Omega()()(nsp+i, i) = -1;
}
std::cout << GridLogMessage << "Omega = " << Omega()() << std::endl;
OmegaLatt = OmegaLatt + (identity*Omega);
auto diff = OmegaLatt - (in*OmegaLatt*transpose(in));
auto sdiff = sum(diff);
//assert( norm2(sdiff) < 1e-8 );
if (norm2(sdiff) < 1e-8)
{
std::cout << GridLogMessage << "Symplectic condition satisfied: Omega invariant" << std::endl;
} else {
std::cout << GridLogMessage << "WARNING!!!!!! Matrix Omega NOT left invariant by " << norm2(sdiff) << std::endl;
}
}
}; // end of class Sp
template<int N>
static void ProjectSp2n(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
{
Umu = ProjectOnSpGroup(Umu);
auto det = Determinant(Umu); // ok ?
det = conjugate(det);
for(int i=0;i<N;i++){
auto element = PeekIndex<ColourIndex>(Umu,N-1,i);
element = element * det;
PokeIndex<ColourIndex>(Umu,element,Nc-1,i);
}
}
template<int N>
static void ProjectSp2n(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,Nd> > &U)
{
GridBase *grid=U.Grid();
for(int mu=0;mu<Nd;mu++){
auto Umu = PeekIndex<LorentzIndex>(U,mu);
Umu = ProjectOnSpGroup(Umu);
ProjectSp2n(Umu);
PokeIndex<LorentzIndex>(U,Umu,mu);
}
}
typedef Sp<2> Sp2;
typedef Sp<4> Sp4;
typedef Sp<6> Sp6;
typedef Sp<8> Sp8;
NAMESPACE_END(Grid);
#endif

View File

@ -175,10 +175,10 @@ public:
template <class cplx> template <class cplx>
static void generator(int Index, iSp2nTwoIndexMatrix<cplx> &i2indTa) { static void generator(int Index, iSp2nTwoIndexMatrix<cplx> &i2indTa) {
Vector<typename Sp<ncolour>::template iSp2nMatrix<cplx> > ta( Vector<iSp2nMatrix<cplx> > ta(
NumGenerators); NumGenerators);
Vector<typename Sp<ncolour>::template iSp2nMatrix<cplx> > eij(Dimension); Vector<iSp2nMatrix<cplx> > eij(Dimension);
typename Sp<ncolour>::template iSp2nMatrix<cplx> tmp; iSp2nMatrix<cplx> tmp;
i2indTa = Zero(); i2indTa = Zero();
for (int a = 0; a < NumGenerators; a++) for (int a = 0; a < NumGenerators; a++)
@ -189,7 +189,7 @@ public:
for (int a = 0; a < Dimension; a++) { for (int a = 0; a < Dimension; a++) {
tmp = transpose(ta[Index]) * adj(eij[a]) + adj(eij[a]) * ta[Index]; tmp = transpose(ta[Index]) * adj(eij[a]) + adj(eij[a]) * ta[Index];
for (int b = 0; b < Dimension; b++) { for (int b = 0; b < Dimension; b++) {
typename Sp<ncolour>::template iSp2nMatrix<cplx> tmp1 = iSp2nMatrix<cplx> tmp1 =
tmp * eij[b]; tmp * eij[b];
Complex iTr = TensorRemove(timesI(trace(tmp1))); Complex iTr = TensorRemove(timesI(trace(tmp1)));
i2indTa()()(a, b) = iTr; i2indTa()()(a, b) = iTr;

View File

@ -8,8 +8,7 @@
#include <Grid/qcd/utils/ScalarObjs.h> #include <Grid/qcd/utils/ScalarObjs.h>
// Include representations // Include representations
#include <Grid/qcd/utils/SUn.h> #include <Grid/qcd/utils/GaugeGroup.h>
#include <Grid/qcd/utils/Sp2n.h>
#include <Grid/qcd/utils/SUnAdjoint.h> #include <Grid/qcd/utils/SUnAdjoint.h>
#include <Grid/qcd/utils/SUnTwoIndex.h> #include <Grid/qcd/utils/SUnTwoIndex.h>
#include <Grid/qcd/utils/Sp2nTwoIndex.h> #include <Grid/qcd/utils/Sp2nTwoIndex.h>

View File

@ -838,7 +838,7 @@ AC_CONFIG_FILES(tests/lanczos/Makefile)
AC_CONFIG_FILES(tests/smearing/Makefile) AC_CONFIG_FILES(tests/smearing/Makefile)
AC_CONFIG_FILES(tests/qdpxx/Makefile) AC_CONFIG_FILES(tests/qdpxx/Makefile)
AC_CONFIG_FILES(tests/testu01/Makefile) AC_CONFIG_FILES(tests/testu01/Makefile)
AC_CONFIG_FILES(tests/Sp2n/Makefile) AC_CONFIG_FILES(tests/sp2n/Makefile)
AC_CONFIG_FILES(benchmarks/Makefile) AC_CONFIG_FILES(benchmarks/Makefile)
AC_CONFIG_FILES(examples/Makefile) AC_CONFIG_FILES(examples/Makefile)
AC_OUTPUT AC_OUTPUT

View File

@ -37,7 +37,6 @@ cd $home/tests
dirs=`find . -type d -not -path '*/\.*'` dirs=`find . -type d -not -path '*/\.*'`
for subdir in $dirs; do for subdir in $dirs; do
cd $home/tests/$subdir cd $home/tests/$subdir
pwd
TESTS=`ls T*.cc` TESTS=`ls T*.cc`
TESTLIST=`echo ${TESTS} | sed s/.cc//g ` TESTLIST=`echo ${TESTS} | sed s/.cc//g `
PREF=`[ $subdir = '.' ] && echo noinst || echo EXTRA` PREF=`[ $subdir = '.' ] && echo noinst || echo EXTRA`

View File

@ -32,7 +32,7 @@ directory
#include <Grid/qcd/utils/CovariantCshift.h> #include <Grid/qcd/utils/CovariantCshift.h>
#include <Grid/qcd/utils/SUn.h> #include <Grid/qcd/utils/GaugeGroup.h>
#include <Grid/qcd/utils/SUnAdjoint.h> #include <Grid/qcd/utils/SUnAdjoint.h>
#include <Grid/qcd/utils/SUnTwoIndex.h> #include <Grid/qcd/utils/SUnTwoIndex.h>

View File

@ -1,55 +0,0 @@
#include <Grid/Grid.h>
#include <Grid/qcd/utils/Sp2n.h>
using namespace Grid;
int main(int argc, char** argv) {
Grid_init(&argc, &argv);
//std::vector<int> latt({4, 4, 4, 8});
//GridCartesian* grid = SpaceTimeGrid::makeFourDimGrid(
//latt, GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi());
//GridRedBlackCartesian* rbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(grid);
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
std::cout << GridLogMessage << "* Generators for Sp(2)" << std::endl;
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
Sp2::printGenerators();
Sp2::testGenerators();
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
std::cout << GridLogMessage << "* Generators for Sp(4)" << std::endl;
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
Sp4::printGenerators();
Sp4::testGenerators();
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
std::cout << GridLogMessage << "* Generators for Sp(6)" << std::endl;
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
Sp6::printGenerators();
Sp6::testGenerators();
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
std::cout << GridLogMessage << "* Generators for Sp(8)" << std::endl;
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
Sp8::printGenerators();
Sp8::testGenerators();
Grid_finalize();
}

View File

@ -4,4 +4,5 @@ include Make.inc
check: tests check: tests
./Test_project_on_Sp ./Test_project_on_Sp
./test_sp2n_lie_gen ./Test_sp2n_lie_gen
./Test_Sp_start

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.;

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;

View File

@ -1,8 +1,4 @@
#include <Grid/Grid.h> #include <Grid/Grid.h>
#include <Grid/qcd/utils/Sp2n.h>
using namespace Grid; using namespace Grid;