From 343d039b378647f494a9a15f66f14b8e0b1ab4db Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 3 Jun 2015 09:51:06 +0100 Subject: [PATCH] Scaled Shamir and Scaled Shamir Zolotarev aliases for special cases of Mobius. --- lib/qcd/action/Actions.h | 3 +- lib/qcd/action/fermion/ScaledShamir.h | 51 ------------------- lib/qcd/action/fermion/ScaledShamirFermion.h | 37 ++++++++++++++ .../fermion/ScaledShamirZolotarevFermion.h | 39 ++++++++++++++ tests/Grid_any_evenodd.cc | 8 ++- 5 files changed, 85 insertions(+), 53 deletions(-) delete mode 100644 lib/qcd/action/fermion/ScaledShamir.h create mode 100644 lib/qcd/action/fermion/ScaledShamirFermion.h create mode 100644 lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h diff --git a/lib/qcd/action/Actions.h b/lib/qcd/action/Actions.h index d37d1cd4..893564e0 100644 --- a/lib/qcd/action/Actions.h +++ b/lib/qcd/action/Actions.h @@ -41,7 +41,8 @@ #include #include #include -//#include +#include +#include // Chroma interface defining FermionAction diff --git a/lib/qcd/action/fermion/ScaledShamir.h b/lib/qcd/action/fermion/ScaledShamir.h deleted file mode 100644 index a1fd33d0..00000000 --- a/lib/qcd/action/fermion/ScaledShamir.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef GRID_QCD_DOMAIN_WALL_FERMION_H -#define GRID_QCD_DOMAIN_WALL_FERMION_H - -#include - -namespace Grid { - - namespace QCD { - - class ScaledShamirFermion : public CayleyFermion5D - { - public: - - // Constructors - ScaledShamirFermion(LatticeGaugeField &_Umu, - GridCartesian &FiveDimGrid, - GridRedBlackCartesian &FiveDimRedBlackGrid, - GridCartesian &FourDimGrid, - GridRedBlackCartesian &FourDimRedBlackGrid, - RealD _mass,RealD _M5, RealD scale) : - - CayleyFermion5D(_Umu, - FiveDimGrid, - FiveDimRedBlackGrid, - FourDimGrid, - FourDimRedBlackGrid,_mass,_M5, - RealD b, - RealD c) - - { - RealD eps = 1.0; - - Approx::zolotarev_data *zdata = Approx::grid_higham(eps,this->Ls);// eps is ignored for higham - assert(zdata->n==this->Ls); - - //b+c = scale; - //b-c = 1 - //b = 0.5(scale+1); - //c = 0.5(scale-1); - - // Call base setter - this->CayleyFermion5D::SetCoefficients(1.0,zdata,0.5*(scale+1.0),0.5*(scale-1.0)); - - } - - }; - - } -} - -#endif diff --git a/lib/qcd/action/fermion/ScaledShamirFermion.h b/lib/qcd/action/fermion/ScaledShamirFermion.h new file mode 100644 index 00000000..59fb16a8 --- /dev/null +++ b/lib/qcd/action/fermion/ScaledShamirFermion.h @@ -0,0 +1,37 @@ +#ifndef GRID_QCD_SCALED_SHAMIR_FERMION_H +#define GRID_QCD_SCALED_SHAMIR_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + class ScaledShamirFermion : public MobiusFermion + { + public: + + // Constructors + ScaledShamirFermion(LatticeGaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + RealD scale) : + + // b+c=scale, b-c = 1 <=> 2b = scale+1; 2c = scale-1 + MobiusFermion(_Umu, + FiveDimGrid, + FiveDimRedBlackGrid, + FourDimGrid, + FourDimRedBlackGrid,_mass,_M5,0.5*(scale+1.0),0.5*(scale-1.0)) + { + } + + }; + + } +} + +#endif diff --git a/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h b/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h new file mode 100644 index 00000000..a4c88d5d --- /dev/null +++ b/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h @@ -0,0 +1,39 @@ +#ifndef GRID_QCD_SCALED_SHAMIR_ZOLOTAREV_FERMION_H +#define GRID_QCD_SCALED_SHAMIR_ZOLOTAREV_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + class ScaledShamirZolotarevFermion : public MobiusZolotarevFermion + { + public: + + // Constructors + + + ScaledShamirZolotarevFermion(LatticeGaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + RealD scale, + RealD lo, RealD hi) : + + MobiusZolotarevFermion(_Umu, + FiveDimGrid, + FiveDimRedBlackGrid, + FourDimGrid, + FourDimRedBlackGrid,_mass,_M5,0.5*(scale+1.0),0.5*(scale-1.0),lo,hi) + + {} + + }; + + } +} + +#endif diff --git a/tests/Grid_any_evenodd.cc b/tests/Grid_any_evenodd.cc index 8d8580c1..de1e3c78 100644 --- a/tests/Grid_any_evenodd.cc +++ b/tests/Grid_any_evenodd.cc @@ -56,9 +56,15 @@ int main (int argc, char ** argv) MobiusFermion Dmob(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c); TestWhat(Dmob,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); - MobiusZolotarevFermion Dzolo(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c,0.1,4.0); + MobiusZolotarevFermion Dzolo(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c,0.1,2.0); TestWhat(Dzolo,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + ScaledShamirFermion Dsham(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,2.0); + TestWhat(Dsham,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + + ScaledShamirZolotarevFermion Dshamz(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,2.0,0.1,2.0); + TestWhat(Dshamz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + Grid_finalize(); }