25#ifndef QCD_UTIL_GAUGEGROUPTWOINDEX_H
26#define QCD_UTIL_GAUGEGROUPTWOINDEX_H
32constexpr inline Real delta(
int a,
int b) {
return (a == b) ? 1.0 : 0.0; }
36template <
class cplx,
int nc, TwoIndexSymmetry S>
39template <
class cplx,
int nc>
47 for (
int k = 0; k < j+1; k++) {
49 tmp = 1 /
sqrt(j * (j + 1));
50 eij()()(k, k +
ngroup) = tmp;
51 eij()()(k +
ngroup, k) = -tmp;
54 tmp = -j /
sqrt(j * (j + 1));
55 eij()()(k, k +
ngroup) = tmp;
56 eij()()(k +
ngroup, k) = -tmp;
62 else if (i !=
ngroup + j) {
63 for (
int k = 0; k < nc; k++)
64 for (
int l = 0; l < nc; l++) {
69 RealD nrm = 1. / std::sqrt(2.0);
74template <
class cplx,
int nc>
78 for (
int k = 0; k < nc; k++)
79 for (
int l = 0; l < nc; l++)
83 RealD nrm = 1. / std::sqrt(2.0);
90template <
int ncolour, TwoIndexSymmetry S,
class group_name>
95 static_assert(std::is_same<group_name, GroupName::SU>::value or
96 std::is_same<group_name, GroupName::Sp>::value,
97 "ngroup is only implemented for SU and Sp currently.");
99 std::is_same<group_name, GroupName::SU>::value ? ncolour : ncolour / 2;
101 (ncolour * (ncolour + S) / 2) + (std::is_same<group_name, GroupName::Sp>::value ? (S - 1) / 2 : 0);
103 (ncolour * (ncolour - 1) / 2) + (std::is_same<group_name, GroupName::Sp>::value ? (- 1) : 0);
105 ncolour * (ncolour + 1) / 2;
109 template <
typename vtype>
131 template <
typename vtype>
139 template <
class cplx>
142 eij()()(
Index - ncolour * (ncolour - 1) / 2,
143 Index - ncolour * (ncolour - 1) / 2) = 1.0;
146 template <
class cplx>
149 for (
int k = 0; k < ncolour; k++)
150 for (
int l = 0; l < ncolour; l++)
154 RealD nrm = 1. / std::sqrt(2.0);
158 template <
class cplx>
165 template <
class cplx>
171 static int a[ncolour * (ncolour - 1) / 2][2];
172 static bool filled =
false;
175 for (
int i = 1; i < ncolour; i++) {
176 for (
int j = 0; j < i; j++) {
177 if (std::is_same<group_name, GroupName::Sp>::value)
179 if (j==0 && i==
ngroup+j && S==-1) {
200 for (
int gen = 0; gen <
Dimension; gen++) {
209 template <
class cplx>
224 i2indTa()()(a, b) = iTr;
241 std::cout <<
GridLogMessage <<
"2IndexRep - Checking if traceless"
250 std::cout <<
GridLogMessage <<
"2IndexRep - Checking if antihermitean"
255 assert(
norm2(
adj(i2indTa) + i2indTa) < 1.0e-6);
260 <<
"2IndexRep - Checking Tr[Ta*Tb]=delta(a,b)*(N +- 2)/2"
269 std::cout <<
GridLogMessage <<
"a=" << a <<
"b=" << b <<
"Tr=" << Tr
272 assert(
real(Tr) - ((ncolour + S * 2) * 0.5) < 1e-8);
274 assert(
real(Tr) < 1e-8);
276 assert(
imag(Tr) < 1e-8);
307 Real coefficient = -2.0 / (ncolour + 2 * S) * scale;
324 static bool precalculated =
false;
325 if (!precalculated) {
326 precalculated =
true;
331 -2.0 / (ncolour + 2 * S) * scale;
335 auto tmp =
real(
trace(i2indTa[a] * in)) * coefficient;
341template <
int ncolour, TwoIndexSymmetry S>
358template <
int ncolour, TwoIndexSymmetry S>
std::vector< T, uvmAllocator< T > > Vector
SU_TwoIndex< Nc, Symmetric > TwoIndexSymmMatrices
SU_TwoIndex< 2, Symmetric > SU2TwoIndexSymm
SU_TwoIndex< 5, AntiSymmetric > SU5TwoIndexAntiSymm
Sp_TwoIndex< 2, Symmetric > Sp2TwoIndexSymm
SU_TwoIndex< 2, AntiSymmetric > SU2TwoIndexAntiSymm
SU_TwoIndex< 5, Symmetric > SU5TwoIndexSymm
SU_TwoIndex< Nc, AntiSymmetric > TwoIndexAntiSymmMatrices
SU_TwoIndex< 3, AntiSymmetric > SU3TwoIndexAntiSymm
GaugeGroupTwoIndex< ncolour, S, GroupName::SU > SU_TwoIndex
Sp_TwoIndex< 4, AntiSymmetric > Sp4TwoIndexAntiSymm
Sp_TwoIndex< Nc, Symmetric > SpTwoIndexSymmMatrices
Sp_TwoIndex< Nc, AntiSymmetric > SpTwoIndexAntiSymmMatrices
Sp_TwoIndex< 4, Symmetric > Sp4TwoIndexSymm
GaugeGroupTwoIndex< ncolour, S, GroupName::Sp > Sp_TwoIndex
SU_TwoIndex< 3, Symmetric > SU3TwoIndexSymm
SU_TwoIndex< 4, Symmetric > SU4TwoIndexSymm
SU_TwoIndex< 4, AntiSymmetric > SU4TwoIndexAntiSymm
constexpr Real delta(int a, int b)
accelerator_inline void timesI(Grid_simd2< S, V > &ret, const Grid_simd2< S, V > &in)
accelerator_inline Grid_simd2< S, V > trace(const Grid_simd2< S, V > &arg)
accelerator_inline Grid_simd< S, V > sqrt(const Grid_simd< S, V > &r)
Lattice< vobj > real(const Lattice< vobj > &lhs)
Lattice< vobj > imag(const Lattice< vobj > &lhs)
Lattice< vobj > adj(const Lattice< vobj > &lhs)
RealD norm2(const Lattice< vobj > &arg)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
auto peekColour(const vobj &rhs, int i) -> decltype(PeekIndex< ColourIndex >(rhs, 0))
void pokeColour(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< ColourIndex >(vobj(), 0))> &rhs, int i)
std::complex< Real > Complex
accelerator_inline std::enable_if<!isGridTensor< T >::value, T >::type TensorRemove(T arg)
accelerator_inline ComplexD transpose(ComplexD &rhs)
static const int Dimension
static void baseOffDiagonal(int i, int j, iGroupMatrix< cplx > &eij, GroupName::Sp)
static void generator(int Index, iGroupTwoIndexMatrix< cplx > &i2indTa)
static void baseDiagonal(int Index, iGroupMatrix< cplx > &eij)
Lattice< vTIMatrixD > LatticeTwoIndexMatrixD
Lattice< vTIMatrixF > LatticeTwoIndexMatrixF
iScalar< iScalar< iMatrix< vtype, ncolour > > > iGroupMatrix
iGroupMatrix< ComplexF > MatrixF
static const int DimensionAS
iScalar< iScalar< iMatrix< vtype, Dimension > > > iGroupTwoIndexMatrix
iGroupTwoIndexMatrix< vComplexD > vTIMatrixD
static void TwoIndexLieAlgebraMatrix(const typename GaugeGroup< ncolour, group_name >::LatticeAlgebraVector &h, LatticeTwoIndexMatrix &out, Real scale=1.0)
static void testGenerators(void)
iGroupMatrix< Complex > Matrix
Lattice< iVector< iScalar< iMatrix< vComplexF, Dimension > >, Nd > > LatticeTwoIndexFieldF
static void base(int Index, iGroupMatrix< cplx > &eij)
iGroupTwoIndexMatrix< Complex > TIMatrix
iGroupTwoIndexMatrix< vComplexF > vTIMatrixF
Lattice< vTIMatrix > LatticeTwoIndexMatrix
static void projector(typename GaugeGroup< ncolour, group_name >::LatticeAlgebraVector &h_out, const LatticeTwoIndexMatrix &in, Real scale=1.0)
iGroupMatrix< ComplexD > MatrixD
static void projectOnAlgebra(typename GaugeGroup< ncolour, group_name >::LatticeAlgebraVector &h_out, const LatticeTwoIndexMatrix &in, Real scale=1.0)
Lattice< iVector< iScalar< iMatrix< vComplex, Dimension > >, Nd > > LatticeTwoIndexField
static const int DimensionS
iGroupTwoIndexMatrix< ComplexF > TIMatrixF
iGroupTwoIndexMatrix< vComplex > vTIMatrix
Lattice< iVector< iScalar< iMatrix< vComplexD, Dimension > >, Nd > > LatticeTwoIndexFieldD
static void printGenerators(void)
static void printBase(void)
static void baseOffDiagonal(int i, int j, iGroupMatrix< cplx > &eij, GroupName::SU)
iGroupTwoIndexMatrix< ComplexD > TIMatrixD
static const int NumGenerators
Lattice< vAlgebraVector > LatticeAlgebraVector
static const int AlgebraDimension
static void generator(int lieIndex, iGroupMatrix< cplx > &ta, GroupName::SU)
GridBase * Grid(void) const
static void baseOffDiagonalSp(int i, int j, iScalar< iScalar< iMatrix< cplx, nc > > > &eij)
static void baseOffDiagonalSp(int i, int j, iScalar< iScalar< iMatrix< cplx, nc > > > &eij)