#ifndef SCALAR_IMPL #define SCALAR_IMPL NAMESPACE_BEGIN(Grid); template class ScalarImplTypes { public: typedef S Simd; template using iImplField = iScalar > >; typedef iImplField SiteField; typedef SiteField SitePropagator; typedef SiteField SiteComplex; typedef Lattice Field; typedef Field ComplexField; typedef Field FermionField; typedef Field PropagatorField; static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){ gaussian(pRNG, P); } static inline Field projectForce(Field& P){return P;} static inline void update_field(Field& P, Field& U, double ep) { U += P*ep; } static inline RealD FieldSquareNorm(Field& U) { return (- sum(trace(U*U))/2.0); } static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) { gaussian(pRNG, U); } static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) { gaussian(pRNG, U); } static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) { U = 1.0; } static void MomentumSpacePropagator(Field &out, RealD m) { GridBase *grid = out.Grid(); Field kmu(grid), one(grid); const unsigned int nd = grid->_ndimension; std::vector &l = grid->_fdimensions; one = Complex(1.0,0.0); out = m*m; for(int mu = 0; mu < nd; mu++) { Real twoPiL = M_PI*2./l[mu]; LatticeCoordinate(kmu,mu); kmu = 2.*sin(.5*twoPiL*kmu); out = out + kmu*kmu; } out = one/out; } static void FreePropagator(const Field &in, Field &out, const Field &momKernel) { FFT fft((GridCartesian *)in.Grid()); Field inFT(in.Grid()); fft.FFT_all_dim(inFT, in, FFT::forward); inFT = inFT*momKernel; fft.FFT_all_dim(out, inFT, FFT::backward); } static void FreePropagator(const Field &in, Field &out, RealD m) { Field momKernel(in.Grid()); MomentumSpacePropagator(momKernel, m); FreePropagator(in, out, momKernel); } }; template class ScalarAdjMatrixImplTypes { public: typedef S Simd; typedef SU Group; template using iImplField = iScalar>>; template using iImplComplex = iScalar>>; typedef iImplField SiteField; typedef SiteField SitePropagator; typedef iImplComplex SiteComplex; typedef Lattice Field; typedef Lattice ComplexField; typedef Field FermionField; typedef Field PropagatorField; static inline void generate_momenta(Field& P, GridParallelRNG& pRNG) { Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P); } static inline Field projectForce(Field& P) {return P;} static inline void update_field(Field& P, Field& U, double ep) { U += P*ep; } static inline RealD FieldSquareNorm(Field& U) { return (TensorRemove(sum(trace(U*U))).real()); } static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) { Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U); } static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) { Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U, 0.01); } static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) { U = Zero(); } }; typedef ScalarImplTypes ScalarImplR; typedef ScalarImplTypes ScalarImplF; typedef ScalarImplTypes ScalarImplD; typedef ScalarImplTypes ScalarImplCR; typedef ScalarImplTypes ScalarImplCF; typedef ScalarImplTypes ScalarImplCD; // Hardcoding here the size of the matrices typedef ScalarAdjMatrixImplTypes ScalarAdjImplR; typedef ScalarAdjMatrixImplTypes ScalarAdjImplF; typedef ScalarAdjMatrixImplTypes ScalarAdjImplD; template using ScalarNxNAdjImplR = ScalarAdjMatrixImplTypes; template using ScalarNxNAdjImplF = ScalarAdjMatrixImplTypes; template using ScalarNxNAdjImplD = ScalarAdjMatrixImplTypes; NAMESPACE_END(Grid); #endif