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

Namespace, indent

This commit is contained in:
paboyle 2018-01-14 23:39:13 +00:00
parent 1619e42d90
commit 83c5f05094

View File

@ -28,17 +28,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
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/Grid_Eigen_Dense.h> #include <Grid/Grid_Eigen_Dense.h>
#include <Grid/qcd/action/fermion/FermionCore.h> #include <Grid/qcd/action/fermion/FermionCore.h>
#include <Grid/qcd/action/fermion/DomainWallEOFAFermion.h> #include <Grid/qcd/action/fermion/DomainWallEOFAFermion.h>
namespace Grid { NAMESPACE_BEGIN(Grid);
namespace QCD {
template<class Impl> template<class Impl>
DomainWallEOFAFermion<Impl>::DomainWallEOFAFermion( DomainWallEOFAFermion<Impl>::DomainWallEOFAFermion(
GaugeField &_Umu, GaugeField &_Umu,
GridCartesian &FiveDimGrid, GridCartesian &FiveDimGrid,
GridRedBlackCartesian &FiveDimRedBlackGrid, GridRedBlackCartesian &FiveDimRedBlackGrid,
@ -49,7 +48,7 @@ namespace QCD {
AbstractEOFAFermion<Impl>(_Umu, FiveDimGrid, FiveDimRedBlackGrid, AbstractEOFAFermion<Impl>(_Umu, FiveDimGrid, FiveDimRedBlackGrid,
FourDimGrid, FourDimRedBlackGrid, _mq1, _mq2, _mq3, FourDimGrid, FourDimRedBlackGrid, _mq1, _mq2, _mq3,
_shift, _pm, _M5, 1.0, 0.0, p) _shift, _pm, _M5, 1.0, 0.0, p)
{ {
RealD eps = 1.0; RealD eps = 1.0;
Approx::zolotarev_data *zdata = Approx::higham(eps,this->Ls); Approx::zolotarev_data *zdata = Approx::higham(eps,this->Ls);
assert(zdata->n == this->Ls); assert(zdata->n == this->Ls);
@ -58,16 +57,16 @@ namespace QCD {
this->SetCoefficientsTanh(zdata, 1.0, 0.0); this->SetCoefficientsTanh(zdata, 1.0, 0.0);
Approx::zolotarev_free(zdata); Approx::zolotarev_free(zdata);
} }
/*************************************************************** /***************************************************************
* Additional EOFA operators only called outside the inverter. * Additional EOFA operators only called outside the inverter.
* Since speed is not essential, simple axpby-style * Since speed is not essential, simple axpby-style
* implementations should be fine. * implementations should be fine.
***************************************************************/ ***************************************************************/
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::Omega(const FermionField& psi, FermionField& Din, int sign, int dag) void DomainWallEOFAFermion<Impl>::Omega(const FermionField& psi, FermionField& Din, int sign, int dag)
{ {
int Ls = this->Ls; int Ls = this->Ls;
Din = zero; Din = zero;
@ -75,21 +74,21 @@ namespace QCD {
else if((sign == -1) && (dag == 0)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, 0); } else if((sign == -1) && (dag == 0)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, 0); }
else if((sign == 1 ) && (dag == 1)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, Ls-1); } else if((sign == 1 ) && (dag == 1)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, Ls-1); }
else if((sign == -1) && (dag == 1)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, 0); } else if((sign == -1) && (dag == 1)){ axpby_ssp(Din, 0.0, psi, 1.0, psi, 0, 0); }
} }
// This is just the identity for DWF // This is just the identity for DWF
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::Dtilde(const FermionField& psi, FermionField& chi){ chi = psi; } void DomainWallEOFAFermion<Impl>::Dtilde(const FermionField& psi, FermionField& chi){ chi = psi; }
// This is just the identity for DWF // This is just the identity for DWF
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::DtildeInv(const FermionField& psi, FermionField& chi){ chi = psi; } void DomainWallEOFAFermion<Impl>::DtildeInv(const FermionField& psi, FermionField& chi){ chi = psi; }
/*****************************************************************************************************/ /*****************************************************************************************************/
template<class Impl> template<class Impl>
RealD DomainWallEOFAFermion<Impl>::M(const FermionField& psi, FermionField& chi) RealD DomainWallEOFAFermion<Impl>::M(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
FermionField Din(psi._grid); FermionField Din(psi._grid);
@ -99,11 +98,11 @@ namespace QCD {
axpby(chi, 1.0, 1.0, chi, psi); axpby(chi, 1.0, 1.0, chi, psi);
this->M5D(psi, chi); this->M5D(psi, chi);
return(norm2(chi)); return(norm2(chi));
} }
template<class Impl> template<class Impl>
RealD DomainWallEOFAFermion<Impl>::Mdag(const FermionField& psi, FermionField& chi) RealD DomainWallEOFAFermion<Impl>::Mdag(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
FermionField Din(psi._grid); FermionField Din(psi._grid);
@ -113,15 +112,15 @@ namespace QCD {
this->M5Ddag(psi, chi); this->M5Ddag(psi, chi);
axpby(chi, 1.0, 1.0, chi, psi); axpby(chi, 1.0, 1.0, chi, psi);
return(norm2(chi)); return(norm2(chi));
} }
/******************************************************************** /********************************************************************
* Performance critical fermion operators called inside the inverter * Performance critical fermion operators called inside the inverter
********************************************************************/ ********************************************************************/
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::M5D(const FermionField& psi, FermionField& chi) void DomainWallEOFAFermion<Impl>::M5D(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
int pm = this->pm; int pm = this->pm;
RealD shift = this->shift; RealD shift = this->shift;
@ -140,7 +139,7 @@ namespace QCD {
std::vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1] = mq1 + shiftm; std::vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1] = mq1 + shiftm;
std::vector<Coeff_t> lower(Ls,-1.0); lower[0] = mq1 + shiftp; std::vector<Coeff_t> lower(Ls,-1.0); lower[0] = mq1 + shiftp;
#if(0) #if(0)
std::cout << GridLogMessage << "DomainWallEOFAFermion::M5D(FF&,FF&):" << std::endl; std::cout << GridLogMessage << "DomainWallEOFAFermion::M5D(FF&,FF&):" << std::endl;
for(int i=0; i<diag.size(); ++i){ for(int i=0; i<diag.size(); ++i){
std::cout << GridLogMessage << "diag[" << i << "] =" << diag[i] << std::endl; std::cout << GridLogMessage << "diag[" << i << "] =" << diag[i] << std::endl;
@ -151,14 +150,14 @@ namespace QCD {
for(int i=0; i<lower.size(); ++i){ for(int i=0; i<lower.size(); ++i){
std::cout << GridLogMessage << "lower[" << i << "] =" << lower[i] << std::endl; std::cout << GridLogMessage << "lower[" << i << "] =" << lower[i] << std::endl;
} }
#endif #endif
this->M5D(psi, chi, chi, lower, diag, upper); this->M5D(psi, chi, chi, lower, diag, upper);
} }
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::M5Ddag(const FermionField& psi, FermionField& chi) void DomainWallEOFAFermion<Impl>::M5Ddag(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
int pm = this->pm; int pm = this->pm;
RealD shift = this->shift; RealD shift = this->shift;
@ -177,7 +176,7 @@ namespace QCD {
std::vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1] = mq1 + shiftp; std::vector<Coeff_t> upper(Ls,-1.0); upper[Ls-1] = mq1 + shiftp;
std::vector<Coeff_t> lower(Ls,-1.0); lower[0] = mq1 + shiftm; std::vector<Coeff_t> lower(Ls,-1.0); lower[0] = mq1 + shiftm;
#if(0) #if(0)
std::cout << GridLogMessage << "DomainWallEOFAFermion::M5Ddag(FF&,FF&):" << std::endl; std::cout << GridLogMessage << "DomainWallEOFAFermion::M5Ddag(FF&,FF&):" << std::endl;
for(int i=0; i<diag.size(); ++i){ for(int i=0; i<diag.size(); ++i){
std::cout << GridLogMessage << "diag[" << i << "] =" << diag[i] << std::endl; std::cout << GridLogMessage << "diag[" << i << "] =" << diag[i] << std::endl;
@ -188,15 +187,15 @@ namespace QCD {
for(int i=0; i<lower.size(); ++i){ for(int i=0; i<lower.size(); ++i){
std::cout << GridLogMessage << "lower[" << i << "] =" << lower[i] << std::endl; std::cout << GridLogMessage << "lower[" << i << "] =" << lower[i] << std::endl;
} }
#endif #endif
this->M5Ddag(psi, chi, chi, lower, diag, upper); this->M5Ddag(psi, chi, chi, lower, diag, upper);
} }
// half checkerboard operations // half checkerboard operations
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::Mooee(const FermionField& psi, FermionField& chi) void DomainWallEOFAFermion<Impl>::Mooee(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
std::vector<Coeff_t> diag = this->bee; std::vector<Coeff_t> diag = this->bee;
@ -211,11 +210,11 @@ namespace QCD {
lower[0] = this->dp; lower[0] = this->dp;
this->M5D(psi, psi, chi, lower, diag, upper); this->M5D(psi, psi, chi, lower, diag, upper);
} }
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::MooeeDag(const FermionField& psi, FermionField& chi) void DomainWallEOFAFermion<Impl>::MooeeDag(const FermionField& psi, FermionField& chi)
{ {
int Ls = this->Ls; int Ls = this->Ls;
std::vector<Coeff_t> diag = this->bee; std::vector<Coeff_t> diag = this->bee;
@ -230,14 +229,14 @@ namespace QCD {
lower[0] = this->dm; lower[0] = this->dm;
this->M5Ddag(psi, psi, chi, lower, diag, upper); this->M5Ddag(psi, psi, chi, lower, diag, upper);
} }
/****************************************************************************************/ /****************************************************************************************/
//Zolo //Zolo
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::SetCoefficientsInternal(RealD zolo_hi, std::vector<Coeff_t>& gamma, RealD b, RealD c) void DomainWallEOFAFermion<Impl>::SetCoefficientsInternal(RealD zolo_hi, std::vector<Coeff_t>& gamma, RealD b, RealD c)
{ {
int Ls = this->Ls; int Ls = this->Ls;
int pm = this->pm; int pm = this->pm;
RealD mq1 = this->mq1; RealD mq1 = this->mq1;
@ -327,21 +326,21 @@ namespace QCD {
int inv = 1; int inv = 1;
this->MooeeInternalCompute(0, inv, this->MatpInv, this->MatmInv); this->MooeeInternalCompute(0, inv, this->MatpInv, this->MatmInv);
this->MooeeInternalCompute(1, inv, this->MatpInvDag, this->MatmInvDag); this->MooeeInternalCompute(1, inv, this->MatpInvDag, this->MatmInvDag);
} }
// Recompute Cayley-form coefficients for different shift // Recompute Cayley-form coefficients for different shift
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::RefreshShiftCoefficients(RealD new_shift) void DomainWallEOFAFermion<Impl>::RefreshShiftCoefficients(RealD new_shift)
{ {
this->shift = new_shift; this->shift = new_shift;
Approx::zolotarev_data *zdata = Approx::higham(1.0, this->Ls); Approx::zolotarev_data *zdata = Approx::higham(1.0, this->Ls);
this->SetCoefficientsTanh(zdata, 1.0, 0.0); this->SetCoefficientsTanh(zdata, 1.0, 0.0);
} }
template<class Impl> template<class Impl>
void DomainWallEOFAFermion<Impl>::MooeeInternalCompute(int dag, int inv, void DomainWallEOFAFermion<Impl>::MooeeInternalCompute(int dag, int inv,
Vector<iSinglet<Simd> >& Matp, Vector<iSinglet<Simd> >& Matm) Vector<iSinglet<Simd> >& Matp, Vector<iSinglet<Simd> >& Matm)
{ {
int Ls = this->Ls; int Ls = this->Ls;
GridBase* grid = this->FermionRedBlackGrid(); GridBase* grid = this->FermionRedBlackGrid();
@ -371,7 +370,7 @@ namespace QCD {
Eigen::MatrixXcd PplusMat ; Eigen::MatrixXcd PplusMat ;
Eigen::MatrixXcd PminusMat; Eigen::MatrixXcd PminusMat;
#if(0) #if(0)
std::cout << GridLogMessage << "Pplus:" << std::endl; std::cout << GridLogMessage << "Pplus:" << std::endl;
for(int s=0; s<Ls; ++s){ for(int s=0; s<Ls; ++s){
for(int ss=0; ss<Ls; ++ss){ for(int ss=0; ss<Ls; ++ss){
@ -386,7 +385,7 @@ namespace QCD {
} }
std::cout << std::endl; std::cout << std::endl;
} }
#endif #endif
if(inv) { if(inv) {
PplusMat = Pplus.inverse(); PplusMat = Pplus.inverse();
@ -430,9 +429,9 @@ namespace QCD {
Matp[LLs*s2+s1] = Vp; Matp[LLs*s2+s1] = Vp;
Matm[LLs*s2+s1] = Vm; Matm[LLs*s2+s1] = Vm;
}} }}
} }
FermOpTemplateInstantiate(DomainWallEOFAFermion); FermOpTemplateInstantiate(DomainWallEOFAFermion);
GparityFermOpTemplateInstantiate(DomainWallEOFAFermion); GparityFermOpTemplateInstantiate(DomainWallEOFAFermion);
}} NAMESPACE_END(Grid);