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

Added all elements for Hirep HMC

TODO: Test and debug
This commit is contained in:
Guido Cossu
2016-07-18 12:05:23 +01:00
parent 7edf4c6c04
commit 9c77bb69a5
9 changed files with 148 additions and 79 deletions

View File

@ -97,7 +97,8 @@ struct ActionLevelHirep {
//std::vector<ActPtr> actions;
// construct a tuple of vectors of the actions for the corresponding higher
// representation fields
typename AccessTypes<Action, Repr>::VectorCollection actions_hirep;
typedef typename AccessTypes<Action, Repr>::VectorCollection action_collection;
action_collection actions_hirep;
typedef typename AccessTypes<Action, Repr>::ClassCollection actions_hirep_ptrs_type;
std::vector<ActPtr>& actions;
@ -109,7 +110,7 @@ struct ActionLevelHirep {
ActionLevelHirep(unsigned int mul = 1) : actions(std::get<0>(actions_hirep)), multiplier(mul) {
// initialize the hirep vectors to zero.
//apply(&ActionLevelHirep::resize, actions_hirep, 0); //need a working resize
//apply(this->resize, actions_hirep, 0); //need a working resize
assert(mul >= 1);
};
@ -128,18 +129,19 @@ struct ActionLevelHirep {
}
template <std::size_t I>
auto getRepresentation(Repr& R)->decltype(std::get<I>(R).U) {return std::get<I>(R).U;}
// Loop on tuple for a callable function
template <std::size_t I = 0, class Tuple, typename Callable, typename ...Args>
inline typename std::enable_if<(I == std::tuple_size<Tuple>::value), void>::type apply(
Callable&, Tuple& , Args...) {}
template <std::size_t I = 1, typename Callable, typename ...Args>
inline typename std::enable_if<I == std::tuple_size<action_collection>::value, void>::type apply(
Callable, Repr& R,Args...) const {}
template <std::size_t I = 0, class Tuple, typename Callable, typename ...Args>
inline typename std::enable_if<(I < std::tuple_size<Tuple>::value), void>::type apply(
Callable& fn, Tuple& T, Args... arguments) {
fn(std::get<I>(T), arguments...);
apply<I + 1>(T, fn, arguments...);
template <std::size_t I = 1, typename Callable, typename ...Args>
inline typename std::enable_if<I < std::tuple_size<action_collection>::value, void>::type apply(
Callable fn, Repr& R, Args... arguments) const {
fn(std::get<I>(actions_hirep), std::get<I>(R.rep), arguments...);
apply<I + 1>(fn, R, arguments...);
}
};

View File

@ -111,12 +111,15 @@ namespace Grid {
///////
// Single flavour four spinors with colour index
///////
template <class S, int Nrepresentation = Nc>
template <class S, class Representation = FundamentalRepresentation >
class WilsonImpl
: public PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > {
: public PeriodicGaugeImpl<GaugeImplTypes<S, Representation::Dimension > > {
public:
typedef PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > Gimpl;
constexpr bool is_fundamental() const{return Nrepresentation == Nc ? 1 : 0;}
static const int Nrepresentation = Representation::Dimension;
typedef PeriodicGaugeImpl<GaugeImplTypes<S, Representation::Dimension > > Gimpl;
//Necessary?
constexpr bool is_fundamental() const{return Representation::Dimension == Nc ? 1 : 0;}
INHERIT_GIMPL_TYPES(Gimpl);
@ -501,13 +504,13 @@ class GparityWilsonImpl
}
};
typedef WilsonImpl<vComplex, Nc> WilsonImplR; // Real.. whichever prec
typedef WilsonImpl<vComplexF, Nc> WilsonImplF; // Float
typedef WilsonImpl<vComplexD, Nc> WilsonImplD; // Double
typedef WilsonImpl<vComplex, FundamentalRepresentation> WilsonImplR; // Real.. whichever prec
typedef WilsonImpl<vComplexF, FundamentalRepresentation> WilsonImplF; // Float
typedef WilsonImpl<vComplexD, FundamentalRepresentation> WilsonImplD; // Double
typedef WilsonImpl<vComplex, SU_Adjoint<Nc>::Dimension > WilsonAdjImplR; // Real.. whichever prec
typedef WilsonImpl<vComplexF, SU_Adjoint<Nc>::Dimension > WilsonAdjImplF; // Float
typedef WilsonImpl<vComplexD, SU_Adjoint<Nc>::Dimension > WilsonAdjImplD; // Double
typedef WilsonImpl<vComplex, AdjointRepresentation > WilsonAdjImplR; // Real.. whichever prec
typedef WilsonImpl<vComplexF, AdjointRepresentation > WilsonAdjImplF; // Float
typedef WilsonImpl<vComplexD, AdjointRepresentation > WilsonAdjImplD; // Double
typedef DomainWallRedBlack5dImpl<vComplex, Nc>
DomainWallRedBlack5dImplR; // Real.. whichever prec