32#ifndef QCD_UTIL_GAUGEGROUP_H
33#define QCD_UTIL_GAUGEGROUP_H
38 typename dummy_name = group_name, \
39 typename named_dummy = std::enable_if_t < \
40 std::is_same<dummy_name, group_name>::value && \
41 is_su<dummy_name>::value >
44 typename dummy_name = group_name, \
45 typename named_dummy = std::enable_if_t < \
46 std::is_same<dummy_name, group_name>::value && \
47 is_sp<dummy_name>::value >
55template <
typename group_name>
57 static const bool value =
false;
65template <
typename group_name>
67 static const bool value =
false;
75template <
typename group_name>
80 return ncolour * ncolour - 1;
85 return ncolour / 2 * (ncolour + 1);
88template <
int ncolour,
class group_name>
97 template <
typename vtype>
99 template <
typename vtype>
101 template <
typename vtype>
103 template <
typename vtype>
170 template <
class cplx>
191 template <
typename LatticeMatrixType>
193 double scale = 1.0) {
196 typedef typename LatticeMatrixType::vector_type vector_type;
202 typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
204 LatticeComplexType ca(grid);
205 LatticeMatrixType lie(grid);
206 LatticeMatrixType la(grid);
277 template <
class vtype>
282 template <
class vtype,
int N>
287 template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >
::type * =
nullptr>
292 template <
int N,
class vComplex_t>
294 for (
int mu = 0; mu <
Nd; mu++) {
302 template <
int N,
class vComplex_t>
307 template <
int N,
class vComplex_t>
314 for (
int i = 0; i < N; i++) {
316 element = element * det;
321 template <
int N,
class vComplex_t>
324 for (
int mu = 0; mu <
Nd; mu++) {
331 template <
typename GaugeField>
333 typedef typename GaugeField::vector_type vector_type;
337 LatticeMatrixType Umu(out.Grid());
338 LatticeMatrixType tmp(out.Grid());
339 for (
int mu = 0; mu <
Nd; mu++) {
350 template <
typename GaugeField>
352 typedef typename GaugeField::vector_type vector_type;
356 LatticeMatrixType Umu(out.Grid());
357 for (
int mu = 0; mu <
Nd; mu++) {
363 template <
typename GaugeField>
365 typedef typename GaugeField::vector_type vector_type;
369 LatticeMatrixType Umu(out.Grid());
371 for (
int mu = 0; mu <
Nd; mu++) {
376 template <
typename GaugeField>
381 template <
typename LatticeMatrixType>
382 static void taProj(
const LatticeMatrixType &in, LatticeMatrixType &out) {
383 taProj(in, out, group_name());
386 template <
typename LatticeMatrixType>
387 static void taExp(
const LatticeMatrixType &x, LatticeMatrixType &ex) {
388 typedef typename LatticeMatrixType::scalar_type ComplexType;
390 LatticeMatrixType xn(x.Grid());
394 ex = xn + ComplexType(1.0);
397 for (
int i = 2; i <= 12; ++i) {
398 nfac = nfac /
RealD(i);
417 int NNm1 = N * (N - 1);
421 for(
int su2Index=0;su2Index<hNNm1;su2Index++){
425 int ay = su2Index*2+1;
430 out_v[ss]()()(ax,b) = 0.5*(real(in_v[ss]()()(i2,i1)) - real(in_v[ss]()()(i1,i2)));
431 out_v[ss]()()(ay,b) = 0.5*(imag(in_v[ss]()()(i1,i2)) + imag(in_v[ss]()()(i2,i1)));
434 for(
int diagIndex=0;diagIndex<N-1;diagIndex++){
435 int k = diagIndex + 1;
436 int a = NNm1+diagIndex;
439 auto tmp = in_v[ss]()()(0,0);
440 for(int i=1;i<k;i++){
441 tmp=tmp+in_v[ss]()()(i,i);
443 tmp = tmp - in_v[ss]()()(k,k)*k;
444 out_v[ss]()()(a,b) =
imag(tmp) * scale;
452template <
int ncolour>
455template <
int ncolour>
470template <
int N,
class vComplex_t>
476template <
int N,
class vComplex_t>
482template <
int N,
class vComplex_t>
488template <
int N,
class vComplex_t>
506 cm()()(2, x) = adj(cm()()(0, y) * cm()()(1, z) -
507 cm()()(0, z) * cm()()(1, y));
508 cm()()(2, y) = adj(cm()()(0, z) * cm()()(1, x) -
509 cm()()(0, x) * cm()()(1, z));
510 cm()()(2, z) = adj(cm()()(0, x) * cm()()(1, y) -
511 cm()()(0, y) * cm()()(1, x));
519 for (
int mu = 0; mu <
Nd; mu++) {
#define accelerator_inline
#define accelerator_for(iterator, num, nsimd,...)
static void ProjectSU3(Lattice< iScalar< iScalar< iMatrix< vComplexD, 3 > > > > &Umu)
constexpr int compute_adjoint_dimension(int ncolour)
GaugeGroup< ncolour, GroupName::SU > SU
constexpr int compute_adjoint_dimension< GroupName::Sp >(int ncolour)
SU< Nc > FundamentalMatrices
GaugeGroup< ncolour, GroupName::Sp > Sp
static void ProjectSUn(Lattice< iScalar< iScalar< iMatrix< vComplex_t, N > > > > &Umu)
constexpr int compute_adjoint_dimension< GroupName::SU >(int ncolour)
static void ProjectSpn(Lattice< iScalar< iScalar< iMatrix< vComplex_t, N > > > > &Umu)
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)
void PokeIndex(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< Index >(vobj(), 0))> &rhs, int i)
auto PeekIndex(const Lattice< vobj > &lhs, int i) -> Lattice< decltype(peekIndex< Index >(vobj(), i))>
Lattice< vobj > imag(const Lattice< vobj > &lhs)
Lattice< typename vobj::Complexified > toComplex(const Lattice< vobj > &lhs)
Lattice< vobj > conjugate(const Lattice< vobj > &lhs)
void gaussian(GridParallelRNG &rng, Lattice< vobj > &l)
void random(GridParallelRNG &rng, Lattice< vobj > &l)
Lattice< iScalar< iScalar< iScalar< Vec > > > > Determinant(const Lattice< iScalar< iScalar< iMatrix< Vec, N > > > > &Umu)
#define autoView(l_v, l, mode)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Lattice< vTReal > LatticeReal
iScalar< iScalar< iScalar< vtype > > > iSinglet
auto peekColour(const vobj &rhs, int i) -> decltype(PeekIndex< ColourIndex >(rhs, 0))
Lattice< vTComplex > LatticeComplex
void pokeColour(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< ColourIndex >(vobj(), 0))> &rhs, int i)
std::complex< RealD > ComplexD
std::complex< Real > Complex
accelerator_inline iScalar< vtype > ProjectOnGroup(const iScalar< vtype > &r)
accelerator_inline iScalar< vtype > Ta(const iScalar< vtype > &r)
#define thread_for(i, num,...)
static INTERNAL_PRECISION U
iAlgebraVector< ComplexD > AlgebraVectorD
static void ProjectOnSpecialGroup(Lattice< iScalar< iScalar< iMatrix< vComplex_t, N > > > > &Umu)
static void ColdConfiguration(GaugeField &out)
iScalar< iScalar< iMatrix< vtype, 2 > > > iSU2Matrix
Lattice< vAlgebraMatrixD > LatticeAlgebraMatrixD
static void ProjectOnSpecialGroup(Lattice< iVector< iScalar< iMatrix< vComplex_t, N > >, Nd > > &U)
Lattice< vMatrixD > LatticeMatrixD
iScalar< iScalar< iMatrix< vtype, AdjointDimension > > > iSUnAlgebraMatrix
static accelerator_inline iVector< vtype, N > ProjectOnGeneralGroup(const iVector< vtype, N > &r)
Lattice< vAlgebraMatrixF > LatticeAlgebraMatrixF
iGroupMatrix< ComplexD > MatrixD
static void TepidConfiguration(GridParallelRNG &pRNG, GaugeField &out)
iAlgebraVector< vComplexF > vAlgebraVectorF
iSU2Matrix< ComplexD > SU2MatrixD
Lattice< vSU2Matrix > LatticeSU2Matrix
iScalar< iScalar< iMatrix< vtype, ncolour > > > iGroupMatrix
static Lattice< iScalar< iScalar< iMatrix< vComplex_t, N > > > > ProjectOnGeneralGroup(const Lattice< iScalar< iScalar< iMatrix< vComplex_t, N > > > > &Umu)
static int su2subgroups(void)
static void ProjectOnGeneralGroup(Lattice< iVector< iScalar< iMatrix< vComplex_t, N > >, Nd > > &U)
iGroupMatrix< vComplexD > vMatrixD
static const int Dimension
Lattice< vAlgebraVectorF > LatticeAlgebraVectorF
static void projectOnAlgebra(LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale=1.0)
iGroupMatrix< Complex > Matrix
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out, double scale=1.0)
static void ColdConfiguration(GridParallelRNG &pRNG, GaugeField &out)
iGroupMatrix< vComplexF > vMatrixF
Lattice< vAlgebraVector > LatticeAlgebraVector
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG, LatticeMatrix &out, Real scale=1.0)
iSU2Matrix< Complex > SU2Matrix
static void printGenerators(void)
iAlgebraVector< vComplex > vAlgebraVector
Lattice< vMatrixF > LatticeMatrixF
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex)
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU)
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out)
iSUnAlgebraMatrix< vComplexD > vAlgebraMatrixD
static void generator(int lieIndex, iGroupMatrix< cplx > &ta)
iGroupMatrix< vComplex > vMatrix
static void LieAlgebraProject(LatticeAlgebraMatrix &out, const LatticeMatrix &in, int b)
iSU2Matrix< vComplex > vSU2Matrix
static Lattice< iScalar< iScalar< iMatrix< vtype, N > > > > ProjectOnGeneralGroup(const Lattice< iScalar< iScalar< iMatrix< vtype, N > > > > &Umu, GroupName::SU)
Lattice< vSU2MatrixD > LatticeSU2MatrixD
iSU2Matrix< vComplexD > vSU2MatrixD
static const int AlgebraDimension
iSU2Matrix< ComplexF > SU2MatrixF
static accelerator_inline iScalar< vtype > ProjectOnGeneralGroup(const iScalar< vtype > &r)
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h, LatticeMatrix &out, Real scale=1.0)
iSUnAlgebraMatrix< vComplex > vAlgebraMatrix
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out)
static accelerator_inline iMatrix< vtype, N > ProjectOnGeneralGroup(const iMatrix< vtype, N > &arg)
Lattice< vSU2MatrixF > LatticeSU2MatrixF
static const int AdjointDimension
Lattice< vAlgebraVectorD > LatticeAlgebraVectorD
Lattice< vMatrix > LatticeMatrix
iGroupMatrix< ComplexF > MatrixF
iSUnAlgebraMatrix< vComplexF > vAlgebraMatrixF
iAlgebraVector< Complex > AlgebraVector
iSU2Matrix< vComplexF > vSU2MatrixF
iAlgebraVector< ComplexF > AlgebraVectorF
Lattice< vAlgebraMatrix > LatticeAlgebraMatrix
static accelerator_inline void su2SubGroupIndex(int &i1, int &i2, int su2_index)
iScalar< iScalar< iVector< vtype, AdjointDimension > > > iAlgebraVector
static accelerator_inline void su2SubGroupIndex(int &i1, int &i2, int su2_index, GroupName::SU)
static void generator(int lieIndex, iGroupMatrix< cplx > &ta, GroupName::SU)
static void testGenerators(void)
iAlgebraVector< vComplexD > vAlgebraVectorD
static accelerator_inline constexpr int Nsimd(void)
GridBase * Grid(void) const