From a3b599ae30a1a953727053fbdf32f2a712db0edd Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 3 Jun 2015 11:26:54 +0100 Subject: [PATCH] Overlap Wilson Cayley tanh & zolo --- lib/qcd/action/Actions.h | 27 ++++++++++--- .../action/fermion/MobiusZolotarevFermion.h | 1 + .../fermion/OverlapWilsonCayleyTanhFermion.h | 34 ++++++++++++++++ .../OverlapWilsonCayleyZolotarevFermion.h | 37 ++++++++++++++++++ .../action/fermion/PartialFractionFermion5D.h | 4 +- .../fermion/ScaledShamirZolotarevFermion.h | 39 ------------------- .../action/fermion/ShamirZolotarevFermion.h | 39 +++++++++++++++++++ tests/Test_many_cg.cc | 14 +++++-- tests/Test_many_evenodd.cc | 17 +++++++- 9 files changed, 161 insertions(+), 51 deletions(-) create mode 100644 lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h create mode 100644 lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h delete mode 100644 lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h create mode 100644 lib/qcd/action/fermion/ShamirZolotarevFermion.h diff --git a/lib/qcd/action/Actions.h b/lib/qcd/action/Actions.h index 893564e0..8a8c4642 100644 --- a/lib/qcd/action/Actions.h +++ b/lib/qcd/action/Actions.h @@ -30,19 +30,36 @@ //#include //////////////////////////////////////////// -// 5D formulations +// 5D formulations... //////////////////////////////////////////// + #include // used by all 5d overlap types + +////////// +// Cayley +////////// #include -#include -//#include #include #include + #include -#include #include -#include +#include + +#include +#include +#include + +////////////////////// +// Continued fraction +////////////////////// +#include + +////////////////////// +// Partial fraction +////////////////////// +#include // Chroma interface defining FermionAction diff --git a/lib/qcd/action/fermion/MobiusZolotarevFermion.h b/lib/qcd/action/fermion/MobiusZolotarevFermion.h index 866d0c39..9ac795d9 100644 --- a/lib/qcd/action/fermion/MobiusZolotarevFermion.h +++ b/lib/qcd/action/fermion/MobiusZolotarevFermion.h @@ -34,6 +34,7 @@ namespace Grid { assert(zdata->n==this->Ls); std::cout << "MobiusZolotarevFermion (b="<CayleyFermion5D::SetCoefficients(1.0,zdata,b,c); diff --git a/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h b/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h new file mode 100644 index 00000000..e764c8ae --- /dev/null +++ b/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h @@ -0,0 +1,34 @@ +#ifndef OVERLAP_WILSON_CAYLEY_TANH_FERMION_H +#define OVERLAP_WILSON_CAYLEY_TANH_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + class OverlapWilsonCayleyTanhFermion : public MobiusFermion + { + public: + + // Constructors + OverlapWilsonCayleyTanhFermion(LatticeGaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + RealD scale) : + + // b+c=scale, b-c = 0 <=> b =c = scale/2 + MobiusFermion(_Umu, + FiveDimGrid, + FiveDimRedBlackGrid, + FourDimGrid, + FourDimRedBlackGrid,_mass,_M5,0.5*scale,0.5*scale) + { + } + }; + } +} +#endif diff --git a/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h b/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h new file mode 100644 index 00000000..82c43fb7 --- /dev/null +++ b/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h @@ -0,0 +1,37 @@ +#ifndef OVERLAP_WILSON_CAYLEY_ZOLOTAREV_FERMION_H +#define OVERLAP_WILSON_CAYLEY_ZOLOTAREV_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + class OverlapWilsonCayleyZolotarevFermion : public MobiusZolotarevFermion + { + public: + + // Constructors + + OverlapWilsonCayleyZolotarevFermion(LatticeGaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + RealD lo, RealD hi) : + // b+c=1.0, b-c = 0 <=> b =c = 1/2 + MobiusZolotarevFermion(_Umu, + FiveDimGrid, + FiveDimRedBlackGrid, + FourDimGrid, + FourDimRedBlackGrid,_mass,_M5,0.5,0.5,lo,hi) + + {} + + }; + + } +} + +#endif diff --git a/lib/qcd/action/fermion/PartialFractionFermion5D.h b/lib/qcd/action/fermion/PartialFractionFermion5D.h index c51aa563..95f8c0f9 100644 --- a/lib/qcd/action/fermion/PartialFractionFermion5D.h +++ b/lib/qcd/action/fermion/PartialFractionFermion5D.h @@ -25,10 +25,10 @@ namespace Grid { virtual void PartialFractionCoefficients(void); - zolotarev_data *zdata; + Approx::zolotarev_data *zdata; // Part frac - double R=(1+this->mass)/(1-this->mass); + double R; std::vector p; std::vector q; diff --git a/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h b/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h deleted file mode 100644 index a4c88d5d..00000000 --- a/lib/qcd/action/fermion/ScaledShamirZolotarevFermion.h +++ /dev/null @@ -1,39 +0,0 @@ -#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/lib/qcd/action/fermion/ShamirZolotarevFermion.h b/lib/qcd/action/fermion/ShamirZolotarevFermion.h new file mode 100644 index 00000000..6a7df439 --- /dev/null +++ b/lib/qcd/action/fermion/ShamirZolotarevFermion.h @@ -0,0 +1,39 @@ +#ifndef GRID_QCD_SHAMIR_ZOLOTAREV_FERMION_H +#define GRID_QCD_SHAMIR_ZOLOTAREV_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + class ShamirZolotarevFermion : public MobiusZolotarevFermion + { + public: + + // Constructors + + + ShamirZolotarevFermion(LatticeGaugeField &_Umu, + GridCartesian &FiveDimGrid, + GridRedBlackCartesian &FiveDimRedBlackGrid, + GridCartesian &FourDimGrid, + GridRedBlackCartesian &FourDimRedBlackGrid, + RealD _mass,RealD _M5, + RealD lo, RealD hi) : + + // b+c = 1; b-c = 1 => b=1, c=0 + MobiusZolotarevFermion(_Umu, + FiveDimGrid, + FiveDimRedBlackGrid, + FourDimGrid, + FourDimRedBlackGrid,_mass,_M5,1.0,0.0,lo,hi) + + {} + + }; + + } +} + +#endif diff --git a/tests/Test_many_cg.cc b/tests/Test_many_cg.cc index 3241a025..4510d4b5 100644 --- a/tests/Test_many_cg.cc +++ b/tests/Test_many_cg.cc @@ -89,9 +89,17 @@ int main (int argc, char ** argv) ScaledShamirFermion Dsham(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,2.0); TestCGinversions(Dsham,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); - std::cout <<"ScaledShamirZolotarevFermion test"<(Dshamz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + std::cout <<"ShamirZolotarevFermion test"<(Dshamz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + + std::cout <<"OverlapWilsonCayleyTanhFermion test"<(Dov,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + + std::cout <<"OverlapWilsonCayleyZolotarevFermion test"<(Dovz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); Grid_finalize(); } diff --git a/tests/Test_many_evenodd.cc b/tests/Test_many_evenodd.cc index de1e3c78..df28981b 100644 --- a/tests/Test_many_evenodd.cc +++ b/tests/Test_many_evenodd.cc @@ -48,23 +48,36 @@ int main (int argc, char ** argv) RealD mass=0.1; RealD M5 =1.8; + std::cout <<"DomainWallFermion test"<(Ddwf,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); RealD b=1.5;// Scale factor b+c=2, b-c=1 RealD c=0.5; + std::cout <<"MobiusFermion test"<(Dmob,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + std::cout <<"MobiusZolotarevFermion test"<(Dzolo,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + std::cout <<"ScaledShamirFermion test"<(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); + std::cout <<"ShamirZolotarevFermion test"<(Dshamz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + + std::cout <<"OverlapWilsonCayleyTanhFermion test"<(Dov,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); + + std::cout <<"OverlapWilsonCayleyZolotarevFermion test"<(Dovz,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5); Grid_finalize(); }