mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-17 07:17:06 +01:00
Rework/global edit to enforce type templating of fermion operators.
Allows multi-precision work and paves the way for alternate BC's and such like allowing for example G-parity which is important for K pipi programme. In particular, can drive an extra flavour index into the fermion fields using template types.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
template<class SiteHalfSpinor,class SiteSpinor>
|
||||
class WilsonCompressor {
|
||||
public:
|
||||
int mu;
|
||||
@ -18,9 +19,13 @@ namespace QCD {
|
||||
mu=p;
|
||||
};
|
||||
|
||||
vHalfSpinColourVector operator () (const vSpinColourVector &in)
|
||||
virtual SiteHalfSpinor operator () (const SiteSpinor &in) {
|
||||
return spinproject(in);
|
||||
}
|
||||
|
||||
SiteHalfSpinor spinproject(const SiteSpinor &in)
|
||||
{
|
||||
vHalfSpinColourVector ret;
|
||||
SiteHalfSpinor ret;
|
||||
int mudag=mu;
|
||||
if (dag) {
|
||||
mudag=(mu+Nd)%(2*Nd);
|
||||
@ -57,5 +62,33 @@ namespace QCD {
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class SiteHalfSpinor,class SiteSpinor>
|
||||
class GparityWilsonCompressor : public WilsonCompressor<SiteHalfSpinor,SiteSpinor>{
|
||||
public:
|
||||
|
||||
GparityWilsonCompressor(int _dag) : WilsonCompressor<SiteHalfSpinor,SiteSpinor> (_dag){};
|
||||
|
||||
SiteHalfSpinor operator () (const SiteSpinor &in)
|
||||
{
|
||||
SiteHalfSpinor tmp = spinproject(in);
|
||||
if( 0 ) tmp = flavourflip(tmp);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
SiteHalfSpinor flavourflip(const SiteHalfSpinor &in) {
|
||||
|
||||
SiteHalfSpinor ret;
|
||||
for(int f=0;f<Ngp;f++){
|
||||
ret(0) = in(1);
|
||||
ret(1) = in(0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}} // namespace close
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user