mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Missing banner; should recreate globally
This commit is contained in:
parent
6ee5ea6b32
commit
5d3b574325
@ -1,63 +1,61 @@
|
|||||||
#ifndef SCALAR_IMPL
|
#ifndef SCALAR_IMPL
|
||||||
#define SCALAR_IMPL
|
#define SCALAR_IMPL
|
||||||
|
|
||||||
|
NAMESPACE_BEGIN(Grid);
|
||||||
namespace Grid {
|
|
||||||
//namespace QCD {
|
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
class ScalarImplTypes {
|
class ScalarImplTypes {
|
||||||
public:
|
public:
|
||||||
typedef S Simd;
|
typedef S Simd;
|
||||||
|
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iImplField = iScalar<iScalar<iScalar<vtype> > >;
|
using iImplField = iScalar<iScalar<iScalar<vtype> > >;
|
||||||
|
|
||||||
typedef iImplField<Simd> SiteField;
|
typedef iImplField<Simd> SiteField;
|
||||||
typedef SiteField SitePropagator;
|
typedef SiteField SitePropagator;
|
||||||
typedef SiteField SiteComplex;
|
typedef SiteField SiteComplex;
|
||||||
|
|
||||||
typedef Lattice<SiteField> Field;
|
typedef Lattice<SiteField> Field;
|
||||||
typedef Field ComplexField;
|
typedef Field ComplexField;
|
||||||
typedef Field FermionField;
|
typedef Field FermionField;
|
||||||
typedef Field PropagatorField;
|
typedef Field PropagatorField;
|
||||||
|
|
||||||
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){
|
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG){
|
||||||
gaussian(pRNG, P);
|
gaussian(pRNG, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field& P){return P;}
|
static inline Field projectForce(Field& P){return P;}
|
||||||
|
|
||||||
static inline void update_field(Field& P, Field& U, double ep) {
|
static inline void update_field(Field& P, Field& U, double ep) {
|
||||||
U += P*ep;
|
U += P*ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RealD FieldSquareNorm(Field& U) {
|
static inline RealD FieldSquareNorm(Field& U) {
|
||||||
return (- sum(trace(U*U))/2.0);
|
return (- sum(trace(U*U))/2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
gaussian(pRNG, U);
|
gaussian(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
gaussian(pRNG, U);
|
gaussian(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
U = 1.0;
|
U = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MomentumSpacePropagator(Field &out, RealD m)
|
static void MomentumSpacePropagator(Field &out, RealD m)
|
||||||
{
|
{
|
||||||
GridBase *grid = out._grid;
|
GridBase *grid = out._grid;
|
||||||
Field kmu(grid), one(grid);
|
Field kmu(grid), one(grid);
|
||||||
const unsigned int nd = grid->_ndimension;
|
const unsigned int nd = grid->_ndimension;
|
||||||
std::vector<int> &l = grid->_fdimensions;
|
std::vector<int> &l = grid->_fdimensions;
|
||||||
|
|
||||||
one = Complex(1.0,0.0);
|
one = Complex(1.0,0.0);
|
||||||
out = m*m;
|
out = m*m;
|
||||||
for(int mu = 0; mu < nd; mu++)
|
for(int mu = 0; mu < nd; mu++)
|
||||||
{
|
{
|
||||||
Real twoPiL = M_PI*2./l[mu];
|
Real twoPiL = M_PI*2./l[mu];
|
||||||
|
|
||||||
@ -65,98 +63,97 @@ class ScalarImplTypes {
|
|||||||
kmu = 2.*sin(.5*twoPiL*kmu);
|
kmu = 2.*sin(.5*twoPiL*kmu);
|
||||||
out = out + kmu*kmu;
|
out = out + kmu*kmu;
|
||||||
}
|
}
|
||||||
out = one/out;
|
out = one/out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreePropagator(const Field &in, Field &out,
|
static void FreePropagator(const Field &in, Field &out,
|
||||||
const Field &momKernel)
|
const Field &momKernel)
|
||||||
{
|
{
|
||||||
FFT fft((GridCartesian *)in._grid);
|
FFT fft((GridCartesian *)in._grid);
|
||||||
Field inFT(in._grid);
|
Field inFT(in._grid);
|
||||||
|
|
||||||
fft.FFT_all_dim(inFT, in, FFT::forward);
|
fft.FFT_all_dim(inFT, in, FFT::forward);
|
||||||
inFT = inFT*momKernel;
|
inFT = inFT*momKernel;
|
||||||
fft.FFT_all_dim(out, inFT, FFT::backward);
|
fft.FFT_all_dim(out, inFT, FFT::backward);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreePropagator(const Field &in, Field &out, RealD m)
|
static void FreePropagator(const Field &in, Field &out, RealD m)
|
||||||
{
|
{
|
||||||
Field momKernel(in._grid);
|
Field momKernel(in._grid);
|
||||||
|
|
||||||
MomentumSpacePropagator(momKernel, m);
|
MomentumSpacePropagator(momKernel, m);
|
||||||
FreePropagator(in, out, momKernel);
|
FreePropagator(in, out, momKernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class S, unsigned int N>
|
template <class S, unsigned int N>
|
||||||
class ScalarAdjMatrixImplTypes {
|
class ScalarAdjMatrixImplTypes {
|
||||||
public:
|
public:
|
||||||
typedef S Simd;
|
typedef S Simd;
|
||||||
typedef QCD::SU<N> Group;
|
typedef QCD::SU<N> Group;
|
||||||
|
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iImplField = iScalar<iScalar<iMatrix<vtype, N>>>;
|
using iImplField = iScalar<iScalar<iMatrix<vtype, N>>>;
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iImplComplex = iScalar<iScalar<iScalar<vtype>>>;
|
using iImplComplex = iScalar<iScalar<iScalar<vtype>>>;
|
||||||
|
|
||||||
typedef iImplField<Simd> SiteField;
|
typedef iImplField<Simd> SiteField;
|
||||||
typedef SiteField SitePropagator;
|
typedef SiteField SitePropagator;
|
||||||
typedef iImplComplex<Simd> SiteComplex;
|
typedef iImplComplex<Simd> SiteComplex;
|
||||||
|
|
||||||
typedef Lattice<SiteField> Field;
|
typedef Lattice<SiteField> Field;
|
||||||
typedef Lattice<SiteComplex> ComplexField;
|
typedef Lattice<SiteComplex> ComplexField;
|
||||||
typedef Field FermionField;
|
typedef Field FermionField;
|
||||||
typedef Field PropagatorField;
|
typedef Field PropagatorField;
|
||||||
|
|
||||||
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG) {
|
static inline void generate_momenta(Field& P, GridParallelRNG& pRNG) {
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field& P) {return P;}
|
static inline Field projectForce(Field& P) {return P;}
|
||||||
|
|
||||||
static inline void update_field(Field& P, Field& U, double ep) {
|
static inline void update_field(Field& P, Field& U, double ep) {
|
||||||
U += P*ep;
|
U += P*ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RealD FieldSquareNorm(Field& U) {
|
static inline RealD FieldSquareNorm(Field& U) {
|
||||||
return (TensorRemove(sum(trace(U*U))).real());
|
return (TensorRemove(sum(trace(U*U))).real());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U, 0.01);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, U, 0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
U = zero;
|
U = zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef ScalarImplTypes<vReal> ScalarImplR;
|
typedef ScalarImplTypes<vReal> ScalarImplR;
|
||||||
typedef ScalarImplTypes<vRealF> ScalarImplF;
|
typedef ScalarImplTypes<vRealF> ScalarImplF;
|
||||||
typedef ScalarImplTypes<vRealD> ScalarImplD;
|
typedef ScalarImplTypes<vRealD> ScalarImplD;
|
||||||
typedef ScalarImplTypes<vComplex> ScalarImplCR;
|
typedef ScalarImplTypes<vComplex> ScalarImplCR;
|
||||||
typedef ScalarImplTypes<vComplexF> ScalarImplCF;
|
typedef ScalarImplTypes<vComplexF> ScalarImplCF;
|
||||||
typedef ScalarImplTypes<vComplexD> ScalarImplCD;
|
typedef ScalarImplTypes<vComplexD> ScalarImplCD;
|
||||||
|
|
||||||
// Hardcoding here the size of the matrices
|
// Hardcoding here the size of the matrices
|
||||||
typedef ScalarAdjMatrixImplTypes<vComplex, QCD::Nc> ScalarAdjImplR;
|
typedef ScalarAdjMatrixImplTypes<vComplex, QCD::Nc> ScalarAdjImplR;
|
||||||
typedef ScalarAdjMatrixImplTypes<vComplexF, QCD::Nc> ScalarAdjImplF;
|
typedef ScalarAdjMatrixImplTypes<vComplexF, QCD::Nc> ScalarAdjImplF;
|
||||||
typedef ScalarAdjMatrixImplTypes<vComplexD, QCD::Nc> ScalarAdjImplD;
|
typedef ScalarAdjMatrixImplTypes<vComplexD, QCD::Nc> ScalarAdjImplD;
|
||||||
|
|
||||||
template <int Colours > using ScalarNxNAdjImplR = ScalarAdjMatrixImplTypes<vComplex, Colours >;
|
template <int Colours > using ScalarNxNAdjImplR = ScalarAdjMatrixImplTypes<vComplex, Colours >;
|
||||||
template <int Colours > using ScalarNxNAdjImplF = ScalarAdjMatrixImplTypes<vComplexF, Colours >;
|
template <int Colours > using ScalarNxNAdjImplF = ScalarAdjMatrixImplTypes<vComplexF, Colours >;
|
||||||
template <int Colours > using ScalarNxNAdjImplD = ScalarAdjMatrixImplTypes<vComplexD, Colours >;
|
template <int Colours > using ScalarNxNAdjImplD = ScalarAdjMatrixImplTypes<vComplexD, Colours >;
|
||||||
|
|
||||||
//}
|
NAMESPACE_END(Grid);
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user