1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-27 22:25:56 +01:00

Namespace

This commit is contained in:
paboyle 2018-01-14 23:15:26 +00:00
parent e04f61b1fa
commit 8da49c5a34

View File

@ -1,4 +1,4 @@
/************************************************************************************* /*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid Grid physics library, www.github.com/paboyle/Grid
@ -24,17 +24,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#include <Grid/qcd/action/fermion/FermionCore.h> #include <Grid/qcd/action/fermion/FermionCore.h>
#include <Grid/qcd/action/fermion/PartialFractionFermion5D.h> #include <Grid/qcd/action/fermion/PartialFractionFermion5D.h>
namespace Grid { NAMESPACE_BEGIN(Grid);
namespace QCD {
template<class Impl>
template<class Impl> void PartialFractionFermion5D<Impl>::Mdir (const FermionField &psi, FermionField &chi,int dir,int disp){
void PartialFractionFermion5D<Impl>::Mdir (const FermionField &psi, FermionField &chi,int dir,int disp){
// this does both dag and undag but is trivial; make a common helper routing // this does both dag and undag but is trivial; make a common helper routing
int sign = 1; int sign = 1;
@ -50,10 +48,10 @@ namespace Grid {
} }
ag5xpby_ssp(chi,p[nblock]*scale/amax,chi,0.0,chi,Ls-1,Ls-1); ag5xpby_ssp(chi,p[nblock]*scale/amax,chi,0.0,chi,Ls-1,Ls-1);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::Meooe_internal(const FermionField &psi, FermionField &chi,int dag) void PartialFractionFermion5D<Impl>::Meooe_internal(const FermionField &psi, FermionField &chi,int dag)
{ {
int Ls = this->Ls; int Ls = this->Ls;
int sign = dag ? (-1) : 1; int sign = dag ? (-1) : 1;
@ -70,11 +68,11 @@ namespace Grid {
ag5xpby_ssp(chi, scale,chi,0.0,chi,s+1,s+1); ag5xpby_ssp(chi, scale,chi,0.0,chi,s+1,s+1);
} }
ag5xpby_ssp(chi,p[nblock]*scale/amax,chi,0.0,chi,Ls-1,Ls-1); ag5xpby_ssp(chi,p[nblock]*scale/amax,chi,0.0,chi,Ls-1,Ls-1);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::Mooee_internal(const FermionField &psi, FermionField &chi,int dag) void PartialFractionFermion5D<Impl>::Mooee_internal(const FermionField &psi, FermionField &chi,int dag)
{ {
// again dag and undag are trivially related // again dag and undag are trivially related
int sign = dag ? (-1) : 1; int sign = dag ? (-1) : 1;
int Ls = this->Ls; int Ls = this->Ls;
@ -103,11 +101,11 @@ namespace Grid {
axpby_ssp(chi,1.0,chi,-sqrt(amax*pp)*scale*sign,psi,Ls-1,s); axpby_ssp(chi,1.0,chi,-sqrt(amax*pp)*scale*sign,psi,Ls-1,s);
} }
} }
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MooeeInv_internal(const FermionField &psi, FermionField &chi,int dag) void PartialFractionFermion5D<Impl>::MooeeInv_internal(const FermionField &psi, FermionField &chi,int dag)
{ {
int sign = dag ? (-1) : 1; int sign = dag ? (-1) : 1;
int Ls = this->Ls; int Ls = this->Ls;
@ -165,11 +163,11 @@ namespace Grid {
axpbg5y_ssp(chi,1.0/scale,tmp,coeff2/scale,tmp,s+1,Ls-1); axpbg5y_ssp(chi,1.0/scale,tmp,coeff2/scale,tmp,s+1,Ls-1);
} }
axpby_ssp (chi, 1.0/scale,tmp,0.0,tmp,Ls-1,Ls-1); axpby_ssp (chi, 1.0/scale,tmp,0.0,tmp,Ls-1,Ls-1);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::M_internal(const FermionField &psi, FermionField &chi,int dag) void PartialFractionFermion5D<Impl>::M_internal(const FermionField &psi, FermionField &chi,int dag)
{ {
FermionField D(psi._grid); FermionField D(psi._grid);
int Ls = this->Ls; int Ls = this->Ls;
@ -255,58 +253,58 @@ namespace Grid {
} }
} }
} }
template<class Impl> template<class Impl>
RealD PartialFractionFermion5D<Impl>::M (const FermionField &in, FermionField &out) RealD PartialFractionFermion5D<Impl>::M (const FermionField &in, FermionField &out)
{ {
M_internal(in,out,DaggerNo); M_internal(in,out,DaggerNo);
return norm2(out); return norm2(out);
} }
template<class Impl> template<class Impl>
RealD PartialFractionFermion5D<Impl>::Mdag (const FermionField &in, FermionField &out) RealD PartialFractionFermion5D<Impl>::Mdag (const FermionField &in, FermionField &out)
{ {
M_internal(in,out,DaggerYes); M_internal(in,out,DaggerYes);
return norm2(out); return norm2(out);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::Meooe (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::Meooe (const FermionField &in, FermionField &out)
{ {
Meooe_internal(in,out,DaggerNo); Meooe_internal(in,out,DaggerNo);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MeooeDag (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::MeooeDag (const FermionField &in, FermionField &out)
{ {
Meooe_internal(in,out,DaggerYes); Meooe_internal(in,out,DaggerYes);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::Mooee (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::Mooee (const FermionField &in, FermionField &out)
{ {
Mooee_internal(in,out,DaggerNo); Mooee_internal(in,out,DaggerNo);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MooeeDag (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::MooeeDag (const FermionField &in, FermionField &out)
{ {
Mooee_internal(in,out,DaggerYes); Mooee_internal(in,out,DaggerYes);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MooeeInv (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::MooeeInv (const FermionField &in, FermionField &out)
{ {
MooeeInv_internal(in,out,DaggerNo); MooeeInv_internal(in,out,DaggerNo);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MooeeInvDag (const FermionField &in, FermionField &out) void PartialFractionFermion5D<Impl>::MooeeInvDag (const FermionField &in, FermionField &out)
{ {
MooeeInv_internal(in,out,DaggerYes); MooeeInv_internal(in,out,DaggerYes);
} }
// force terms; five routines; default to Dhop on diagonal // force terms; five routines; default to Dhop on diagonal
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag) void PartialFractionFermion5D<Impl>::MDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag)
{ {
int Ls = this->Ls; int Ls = this->Ls;
FermionField D(V._grid); FermionField D(V._grid);
@ -320,10 +318,10 @@ namespace Grid {
ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1); ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1);
this->DhopDeriv(mat,D,V,DaggerNo); this->DhopDeriv(mat,D,V,DaggerNo);
}; };
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MoeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag) void PartialFractionFermion5D<Impl>::MoeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)
{ {
int Ls = this->Ls; int Ls = this->Ls;
FermionField D(V._grid); FermionField D(V._grid);
@ -337,10 +335,10 @@ namespace Grid {
ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1); ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1);
this->DhopDerivOE(mat,D,V,DaggerNo); this->DhopDerivOE(mat,D,V,DaggerNo);
}; };
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::MeoDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag) void PartialFractionFermion5D<Impl>::MeoDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)
{ {
int Ls = this->Ls; int Ls = this->Ls;
FermionField D(V._grid); FermionField D(V._grid);
@ -354,14 +352,14 @@ namespace Grid {
ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1); ag5xpby_ssp(D,p[nblock]*scale/amax,U,0.0,U,Ls-1,Ls-1);
this->DhopDerivEO(mat,D,V,DaggerNo); this->DhopDerivEO(mat,D,V,DaggerNo);
}; };
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::SetCoefficientsTanh(Approx::zolotarev_data *zdata,RealD scale){ void PartialFractionFermion5D<Impl>::SetCoefficientsTanh(Approx::zolotarev_data *zdata,RealD scale){
SetCoefficientsZolotarev(1.0/scale,zdata); SetCoefficientsZolotarev(1.0/scale,zdata);
} }
template<class Impl> template<class Impl>
void PartialFractionFermion5D<Impl>::SetCoefficientsZolotarev(RealD zolo_hi,Approx::zolotarev_data *zdata){ void PartialFractionFermion5D<Impl>::SetCoefficientsZolotarev(RealD zolo_hi,Approx::zolotarev_data *zdata){
// check on degree matching // check on degree matching
// std::cout<<GridLogMessage << Ls << " Ls"<<std::endl; // std::cout<<GridLogMessage << Ls << " Ls"<<std::endl;
@ -394,11 +392,11 @@ namespace Grid {
scale= part_frac_chroma_convention ? 2.0 : 1.0; // Chroma conventions annoy me scale= part_frac_chroma_convention ? 2.0 : 1.0; // Chroma conventions annoy me
amax=zolo_hi; amax=zolo_hi;
} }
// Constructors // Constructors
template<class Impl> template<class Impl>
PartialFractionFermion5D<Impl>::PartialFractionFermion5D(GaugeField &_Umu, PartialFractionFermion5D<Impl>::PartialFractionFermion5D(GaugeField &_Umu,
GridCartesian &FiveDimGrid, GridCartesian &FiveDimGrid,
GridRedBlackCartesian &FiveDimRedBlackGrid, GridRedBlackCartesian &FiveDimRedBlackGrid,
GridCartesian &FourDimGrid, GridCartesian &FourDimGrid,
@ -410,7 +408,7 @@ namespace Grid {
FourDimGrid, FourDimRedBlackGrid,M5,p), FourDimGrid, FourDimRedBlackGrid,M5,p),
mass(_mass) mass(_mass)
{ {
int Ls = this->Ls; int Ls = this->Ls;
assert((Ls&0x1)==1); // Odd Ls required assert((Ls&0x1)==1); // Odd Ls required
@ -429,10 +427,9 @@ namespace Grid {
Approx::zolotarev_free(zdata); Approx::zolotarev_free(zdata);
}
FermOpTemplateInstantiate(PartialFractionFermion5D);
}
} }
FermOpTemplateInstantiate(PartialFractionFermion5D);
NAMESPACE_END(Grid);