1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 07:17:06 +01:00

Debugged smearing and adding HMC functions for hirep

This commit is contained in:
Guido Cossu
2016-07-13 17:51:18 +01:00
parent a9ae30f868
commit 9dc345e8e8
12 changed files with 150 additions and 38 deletions

View File

@ -19,11 +19,16 @@ namespace QCD {
template <int ncolour>
class AdjointRep {
public:
typename SU_Adjoint<ncolour>::LatticeAdjMatrix U;
// typdef to be used by the Representations class in HMC to get the
// types for the higher representation fields
typedef typename SU_Adjoint<ncolour>::LatticeAdjMatrix LatticeField;
const int Dimension = ncolour * ncolour - 1;
explicit AdjointRep(GridBase* grid):U(grid) {}
void update_representation(const LatticeGaugeField& Uin) {
LatticeField U;
explicit AdjointRep(GridBase* grid) : U(grid) {}
LatticeField update_representation(const LatticeGaugeField& Uin) {
// Uin is in the fundamental representation
// get the U in AdjointRep
// (U_adj)_B = tr[e^a U e^b U^dag]
@ -34,19 +39,20 @@ class AdjointRep {
U = zero;
LatticeGaugeField tmp(Uin._grid);
Vector<typename SU<ncolour>::Matrix > ta(ncolour * ncolour - 1);
Vector<typename SU<ncolour>::Matrix> ta(ncolour * ncolour - 1);
// FIXME probably not very efficient to get all the generators everytime
// FIXME probably not very efficient to get all the generators
// everytime
for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
for (int a = 0; a < Dimension; a++) {
tmp = 2.0 * adj(Uin) * ta[a] * Uin;
tmp = 2.0 * adj(Uin) * ta[a] * Uin;
for (int b = 0; b < (ncolour * ncolour - 1); b++) {
auto Tr = TensorRemove(trace(tmp * ta[b]));
pokeColour(U, Tr, a,b);
pokeColour(U, Tr, a, b);
}
}
}
};

View File

@ -0,0 +1,39 @@
/*
* Policy classes for the HMC
* Author: Guido Cossu
*/
#ifndef FUNDAMENTAL_H
#define FUNDAMENTAL_H
namespace Grid {
namespace QCD {
/*
* This is an helper class for the HMC
* Empty since HMC updates already the fundamental representation
*/
template <int ncolour>
class FundamentalRep {
public:
const int Dimension = ncolour;
// typdef to be used by the Representations class in HMC to get the
// types for the higher representation fields
typedef typename SU<ncolour>::LatticeMatrix LatticeField;
explicit FundamentalRep(GridBase* grid) {} //do nothing
void update_representation(const LatticeGaugeField& Uin) {} // do nothing
};
typedef FundamentalRep<Nc> FundamentalRepresentation;
}
}
#endif

View File

@ -4,16 +4,27 @@
#include <tuple>
#include <utility>
#include <qcd/representations/adjoint.h>
#include <qcd/representations/fundamental.h>
namespace Grid {
namespace QCD {
// Utility to add support for representations other than the fundamental
// Supported types
//enum {Fundamental, Adjoint} repr_type;
// Utility to add support to the HMC for representations other than the fundamental
template<class... Reptypes>
class Representations{
public:
typedef std::tuple<Reptypes...> Representation_type;
// To access the Reptypes (FundamentalRepresentation, AdjointRepresentation)
template <std::size_t N>
using repr_type = typename std::tuple_element<N, Representation_type >::type;
// in order to get the typename of the field use
// type repr_type::LatticeField
Representation_type rep;
// Multiple types constructor
@ -29,12 +40,16 @@ public:
template <std::size_t I = 0>
inline typename std::enable_if <
I<sizeof...(Reptypes), void >::type update(LatticeGaugeField& U) {
I<sizeof...(Reptypes), void>::type update(LatticeGaugeField& U) {
std::get<I>(rep).update_representation(U);
update<I + 1>(U);
}
};
typedef Representations<FundamentalRepresentation> JustTheFundamental;
}
}