Grid 0.7.0
two_index.h
Go to the documentation of this file.
1/*
2 * Policy classes for the HMC
3 * Authors: Guido Cossu, David Preti
4 */
5
6#ifndef SUN2INDEX_H_H
7#define SUN2INDEX_H_H
8
10
11/*
12 * This is an helper class for the HMC
13 * Should contain only the data for the two index representations
14 * and the facility to convert from the fundamental -> two index
15 * The templated parameter TwoIndexSymmetry choses between the
16 * symmetric and antisymmetric representations
17 *
18 * There is an
19 * enum TwoIndexSymmetry { Symmetric = 1, AntiSymmetric = -1 };
20 * in the SUnTwoIndex.h file
21 */
22
23template <int ncolour, TwoIndexSymmetry S, class group_name = GroupName::SU>
25public:
26 // typdef to be used by the Representations class in HMC to get the
27 // types for the higher representation fields
31 static const bool isFundamental = false;
32
34
35 explicit TwoIndexRep(GridBase *grid) : U(grid) {}
36
38 std::cout << GridLogDebug << "Updating TwoIndex representation\n";
39 // Uin is in the fundamental representation
40 // get the U in TwoIndexRep
41 // (U)_{(ij)(lk)} = tr [ adj(e^(ij)) U e^(lk) transpose(U) ]
42 conformable(U, Uin);
43 U = Zero();
44 LatticeColourMatrix tmp(Uin.Grid());
45
46 std::vector<typename GaugeGroup<ncolour,group_name>::Matrix> eij(Dimension);
47
48 for (int a = 0; a < Dimension; a++)
50
51 for (int mu = 0; mu < Nd; mu++) {
52 auto Uin_mu = peekLorentz(Uin, mu);
53 auto U_mu = peekLorentz(U, mu);
54 for (int a = 0; a < Dimension; a++) {
55 tmp = transpose(Uin_mu) * adj(eij[a]) * Uin_mu;
56 for (int b = 0; b < Dimension; b++)
57 pokeColour(U_mu, trace(tmp * eij[b]), a, b);
58 }
59 pokeLorentz(U, U_mu, mu);
60 }
61 }
62
64 Real scale = 1.0) const {
65 LatticeGaugeField out(in.Grid());
66 out = Zero();
67
68 for (int mu = 0; mu < Nd; mu++) {
69 LatticeColourMatrix out_mu(in.Grid()); // fundamental representation
70 LatticeMatrix in_mu = peekLorentz(in, mu);
71
72 out_mu = Zero();
73
75 projectOnAlgebra(h, in_mu, double(Nc + 2 * S)); // factor T(r)/T(fund)
76 FundamentalLieAlgebraMatrix(h, out_mu); // apply scale only once
77 pokeLorentz(out, out_mu, mu);
78 }
79 return out;
80 }
81
82private:
87
93};
94
97
100
102
103#endif
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 > adj(const Lattice< vobj > &lhs)
GridLogger GridLogDebug(1, "Debug", GridLogColours, "PURPLE")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
void pokeLorentz(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< LorentzIndex >(vobj(), 0))> &rhs, int i)
Definition QCD.h:487
static constexpr int Nd
Definition QCD.h:52
static constexpr int Nc
Definition QCD.h:50
Lattice< vColourMatrix > LatticeColourMatrix
Definition QCD.h:295
LatticeLorentzColourMatrix LatticeGaugeField
Definition QCD.h:385
void pokeColour(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< ColourIndex >(vobj(), 0))> &rhs, int i)
Definition QCD.h:459
auto peekLorentz(const vobj &rhs, int i) -> decltype(PeekIndex< LorentzIndex >(rhs, 0))
Definition QCD.h:446
RealF Real
Definition Simd.h:65
accelerator_inline ComplexD transpose(ComplexD &rhs)
static const int Dimension
static void base(int Index, iGroupMatrix< cplx > &eij)
Lattice< vTIMatrix > LatticeTwoIndexMatrix
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
Lattice< vAlgebraVector > LatticeAlgebraVector
Definition GaugeGroup.h:135
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h, LatticeMatrix &out, Real scale=1.0)
Definition GaugeGroup.h:246
Lattice< vMatrix > LatticeMatrix
Definition GaugeGroup.h:131
GridBase * Grid(void) const
void update_representation(const LatticeGaugeField &Uin)
Definition two_index.h:37
void FundamentalLieAlgebraMatrix(typename GaugeGroup< ncolour, group_name >::LatticeAlgebraVector &h, typename GaugeGroup< ncolour, group_name >::LatticeMatrix &out, Real scale=1.0) const
Definition two_index.h:88
LatticeGaugeField RtoFundamentalProject(const LatticeField &in, Real scale=1.0) const
Definition two_index.h:63
void projectOnAlgebra(typename GaugeGroup< ncolour, group_name >::LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale=1.0) const
Definition two_index.h:83
GaugeGroupTwoIndex< ncolour, S, group_name >::LatticeTwoIndexMatrix LatticeMatrix
Definition two_index.h:28
TwoIndexRep(GridBase *grid)
Definition two_index.h:35
GaugeGroupTwoIndex< ncolour, S, group_name >::LatticeTwoIndexField LatticeField
Definition two_index.h:29
Definition Simd.h:194
TwoIndexRep< Nc, AntiSymmetric, GroupName::Sp > SpTwoIndexAntiSymmetricRepresentation
Definition two_index.h:99
TwoIndexRep< Nc, Symmetric, GroupName::Sp > SpTwoIndexSymmetricRepresentation
Definition two_index.h:98
TwoIndexRep< Nc, AntiSymmetric, GroupName::SU > TwoIndexAntiSymmetricRepresentation
Definition two_index.h:96
TwoIndexRep< Nc, Symmetric, GroupName::SU > TwoIndexSymmetricRepresentation
Definition two_index.h:95