Grid 0.7.0
SUnAdjoint.h
Go to the documentation of this file.
1#ifndef QCD_UTIL_SUNADJOINT_H
2#define QCD_UTIL_SUNADJOINT_H
3
5//
6// * Adjoint representation generators
7//
8// * Normalisation for the fundamental generators:
9// trace ta tb = 1/2 delta_ab = T_F delta_ab
10// T_F = 1/2 for SU(N) groups
11//
12//
13// base for NxN hermitian traceless matrices
14// normalized to 1:
15//
16// (e_Adj)^a = t^a / sqrt(T_F)
17//
18// then the real, antisymmetric generators for the adjoint representations
19// are computed ( shortcut: e^a == (e_Adj)^a )
20//
21// (iT_adj)^d_ba = i tr[e^a t^d e^b - t^d e^a e^b]
22//
24
26
27template <int ncolour>
28class SU_Adjoint : public SU<ncolour> {
29public:
30 static const int Dimension = ncolour * ncolour - 1;
31
32 template <typename vtype>
35
36 // Actually the adjoint matrices are real...
37 // Consider this overhead... FIXME
41
45
49
53
54
55 template <typename vtype>
57
59
60 template <class cplx>
61 static void generator(int Index, iSUnAdjointMatrix<cplx> &iAdjTa) {
62 // returns i(T_Adj)^index necessary for the projectors
63 // see definitions above
64 iAdjTa = Zero();
65 iSUnMatrix<cplx> ta[ncolour * ncolour - 1];
67
68 // FIXME not very efficient to get all the generators everytime
69 for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
70
71 for (int a = 0; a < Dimension; a++) {
72 tmp = ta[a] * ta[Index] - ta[Index] * ta[a];
73 for (int b = 0; b < (ncolour * ncolour - 1); b++) {
74 iSUnMatrix<cplx> tmp1 = 2.0 * tmp * ta[b]; // 2.0 from the normalization
75 Complex iTr = TensorRemove(timesI(trace(tmp1)));
76 //iAdjTa()()(b, a) = iTr;
77 iAdjTa()()(a, b) = iTr;
78 }
79 }
80 }
81
82 static void printGenerators(void) {
83 for (int gen = 0; gen < Dimension; gen++) {
84 AMatrix ta;
85 generator(gen, ta);
86 std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
87 << std::endl;
88 std::cout << GridLogMessage << ta << std::endl;
89 }
90 }
91
92 static void testGenerators(void) {
93 AMatrix adjTa;
94 std::cout << GridLogMessage << "Adjoint - Checking if real" << std::endl;
95 for (int a = 0; a < Dimension; a++) {
96 generator(a, adjTa);
97 std::cout << GridLogMessage << a << std::endl;
98 assert(norm2(adjTa - conjugate(adjTa)) < 1.0e-6);
99 }
100 std::cout << GridLogMessage << std::endl;
101
102 std::cout << GridLogMessage << "Adjoint - Checking if antisymmetric"
103 << std::endl;
104 for (int a = 0; a < Dimension; a++) {
105 generator(a, adjTa);
106 std::cout << GridLogMessage << a << std::endl;
107 assert(norm2(adjTa + transpose(adjTa)) < 1.0e-6);
108 }
109 std::cout << GridLogMessage << std::endl;
110 }
111
113 const typename SU<ncolour>::LatticeAlgebraVector &h,
114 LatticeAdjMatrix &out, Real scale = 1.0) {
115 conformable(h, out);
116 GridBase *grid = out.Grid();
117 LatticeAdjMatrix la(grid);
118 AMatrix iTa;
119
120 out = Zero();
121 for (int a = 0; a < Dimension; a++) {
122 generator(a, iTa);
123 la = peekColour(h, a) * iTa;
124 out += la;
125 }
126 out *= scale;
127 }
128
129 // Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
130 static void projectOnAlgebra(typename SU<ncolour>::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale = 1.0)
131 {
132
133 conformable(h_out, in);
134 h_out = Zero();
135 AMatrix iTa;
136 Real coefficient = - 1.0/(ncolour) * scale;// 1/Nc for the normalization of the trace in the adj rep
137
138 for (int a = 0; a < Dimension; a++) {
139 generator(a, iTa);
140 pokeColour(h_out, real(trace(iTa * in)) * coefficient, a);
141 }
142 }
143
144 // a projector that keeps the generators stored to avoid the overhead of recomputing them
145 static void projector(typename SU<ncolour>::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale = 1.0) {
146 conformable(h_out, in);
147 static std::vector<AMatrix> iTa(Dimension); // to store the generators
148 h_out = Zero();
149 static bool precalculated = false;
150 if (!precalculated){
151 precalculated = true;
152 for (int a = 0; a < Dimension; a++) generator(a, iTa[a]);
153 }
154
155 Real coefficient = -1.0 / (ncolour) * scale; // 1/Nc for the normalization of
156 // the trace in the adj rep
157
158 for (int a = 0; a < Dimension; a++) {
159 auto tmp = real(trace(iTa[a] * in)) * coefficient;
160 pokeColour(h_out, tmp, a);
161 }
162 }
163
164
165};
166
167
168
169
170// Some useful type names
171
176
178
180
181#endif
GaugeGroup< ncolour, GroupName::SU > SU
Definition GaugeGroup.h:453
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)
void conformable(const Lattice< obj1 > &lhs, const Lattice< obj2 > &rhs)
Lattice< vobj > real(const Lattice< vobj > &lhs)
Lattice< vobj > conjugate(const Lattice< vobj > &lhs)
RealD norm2(const Lattice< vobj > &arg)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int Nd
Definition QCD.h:52
auto peekColour(const vobj &rhs, int i) -> decltype(PeekIndex< ColourIndex >(rhs, 0))
Definition QCD.h:429
void pokeColour(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< ColourIndex >(vobj(), 0))> &rhs, int i)
Definition QCD.h:459
SU_Adjoint< 5 > SU5Adjoint
Definition SUnAdjoint.h:175
SU_Adjoint< 2 > SU2Adjoint
Definition SUnAdjoint.h:172
SU_Adjoint< Nc > AdjointMatrices
Definition SUnAdjoint.h:177
SU_Adjoint< 3 > SU3Adjoint
Definition SUnAdjoint.h:173
SU_Adjoint< 4 > SU4Adjoint
Definition SUnAdjoint.h:174
RealF Real
Definition Simd.h:65
std::complex< Real > Complex
Definition Simd.h:80
accelerator_inline std::enable_if<!isGridTensor< T >::value, T >::type TensorRemove(T arg)
accelerator_inline ComplexD transpose(ComplexD &rhs)
Lattice< vAlgebraVector > LatticeAlgebraVector
Definition GaugeGroup.h:135
GridBase * Grid(void) const
iSUnAdjointMatrix< ComplexD > AMatrixD
Definition SUnAdjoint.h:40
iSUnAdjointMatrix< vComplexF > vAMatrixF
Definition SUnAdjoint.h:43
Lattice< iVector< iScalar< iMatrix< vComplexF, Dimension > >, Nd > > LatticeAdjFieldF
Definition SUnAdjoint.h:51
static void printGenerators(void)
Definition SUnAdjoint.h:82
iScalar< iScalar< iMatrix< vtype, ncolour > > > iSUnMatrix
Definition SUnAdjoint.h:56
iSUnAdjointMatrix< ComplexF > AMatrixF
Definition SUnAdjoint.h:39
static void AdjointLieAlgebraMatrix(const typename SU< ncolour >::LatticeAlgebraVector &h, LatticeAdjMatrix &out, Real scale=1.0)
Definition SUnAdjoint.h:112
iSUnAdjointMatrix< vComplex > vAMatrix
Definition SUnAdjoint.h:42
static void generator(int Index, iSUnAdjointMatrix< cplx > &iAdjTa)
Definition SUnAdjoint.h:61
iSUnAdjointMatrix< Complex > AMatrix
Definition SUnAdjoint.h:38
Lattice< vAMatrix > LatticeAdjMatrix
Definition SUnAdjoint.h:46
static void testGenerators(void)
Definition SUnAdjoint.h:92
Lattice< iVector< iScalar< iMatrix< vComplex, Dimension > >, Nd > > LatticeAdjField
Definition SUnAdjoint.h:50
static void projectOnAlgebra(typename SU< ncolour >::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale=1.0)
Definition SUnAdjoint.h:130
static const int Dimension
Definition SUnAdjoint.h:30
iSUnAdjointMatrix< vComplexD > vAMatrixD
Definition SUnAdjoint.h:44
static void projector(typename SU< ncolour >::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale=1.0)
Definition SUnAdjoint.h:145
Lattice< vAMatrixD > LatticeAdjMatrixD
Definition SUnAdjoint.h:48
Lattice< vAMatrixF > LatticeAdjMatrixF
Definition SUnAdjoint.h:47
Lattice< iVector< iScalar< iMatrix< vComplexD, Dimension > >, Nd > > LatticeAdjFieldD
Definition SUnAdjoint.h:52
iScalar< iScalar< iMatrix< vtype, Dimension > > > iSUnAdjointMatrix
Definition SUnAdjoint.h:33
Lattice< iScalar< iScalar< iVector< vComplex, Dimension > > > > LatticeAdjVector
Definition SUnAdjoint.h:58
Definition Simd.h:194