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

Zero changes, literally

This commit is contained in:
paboyle 2018-01-27 23:51:10 +00:00
parent d557f3ef77
commit ce4da83bc2
10 changed files with 47 additions and 47 deletions

View File

@ -543,7 +543,7 @@ public:
Umu5d[Ls*ss+s] = Umu[ss]; Umu5d[Ls*ss+s] = Umu[ss];
} }
} }
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
U[mu] = PeekIndex<LorentzIndex>(Umu5d,mu); U[mu] = PeekIndex<LorentzIndex>(Umu5d,mu);
} }

View File

@ -80,11 +80,11 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5,src); LatticeFermion src (FGrid); random(RNG5,src);
#if 0 #if 0
src = zero; src = Zero();
{ {
std::vector<int> origin({0,0,0,latt4[2]-1,0}); std::vector<int> origin({0,0,0,latt4[2]-1,0});
SpinColourVectorF tmp; SpinColourVectorF tmp;
tmp=zero; tmp=Zero();
tmp()(0)(0)=Complex(-2.0,0.0); tmp()(0)(0)=Complex(-2.0,0.0);
std::cout << " source site 0 " << tmp<<std::endl; std::cout << " source site 0 " << tmp<<std::endl;
pokeSite(tmp,src,origin); pokeSite(tmp,src,origin);
@ -95,8 +95,8 @@ int main (int argc, char ** argv)
#endif #endif
LatticeFermion result(FGrid); result=zero; LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=zero; LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid); LatticeFermion err(FGrid);
@ -134,7 +134,7 @@ int main (int argc, char ** argv)
if (1) if (1)
{ {
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
tmp = U[mu]*Cshift(src,mu+1,1); tmp = U[mu]*Cshift(src,mu+1,1);
@ -287,7 +287,7 @@ int main (int argc, char ** argv)
sDw.Report(); sDw.Report();
RealD sum=0; RealD sum=0;
err=zero; err=Zero();
localConvert(sresult,err); localConvert(sresult,err);
err = err - ref; err = err - ref;
sum = norm2(err); sum = norm2(err);
@ -298,7 +298,7 @@ int main (int argc, char ** argv)
} }
// assert(sum < 1.0e-4); // assert(sum < 1.0e-4);
err=zero; err=Zero();
localConvert(sresult,err); localConvert(sresult,err);
err = err - result; err = err - result;
sum = norm2(err); sum = norm2(err);
@ -339,8 +339,8 @@ int main (int argc, char ** argv)
// setCheckerboard(sr_eo,ssrc_o); // setCheckerboard(sr_eo,ssrc_o);
// setCheckerboard(sr_eo,ssrc_e); // setCheckerboard(sr_eo,ssrc_e);
sr_e = zero; sr_e = Zero();
sr_o = zero; sr_o = Zero();
FGrid->Barrier(); FGrid->Barrier();
sDw.DhopEO(ssrc_o, sr_e, DaggerNo); sDw.DhopEO(ssrc_o, sr_e, DaggerNo);
@ -407,7 +407,7 @@ int main (int argc, char ** argv)
if (1) if (1)
{ // Naive wilson dag implementation { // Naive wilson dag implementation
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x // ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x

View File

@ -118,12 +118,12 @@ void benchDw(std::vector<int> & latt4, int Ls, int threads,int report )
LatticeGaugeField Umu(UGrid); LatticeGaugeField Umu(UGrid);
random(RNG4,Umu); random(RNG4,Umu);
#else #else
LatticeFermion src (FGrid); src=zero; LatticeFermion src (FGrid); src=Zero();
LatticeGaugeField Umu(UGrid); Umu=zero; LatticeGaugeField Umu(UGrid); Umu=Zero();
#endif #endif
LatticeFermion result(FGrid); result=zero; LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=zero; LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid); LatticeFermion err(FGrid);
@ -149,7 +149,7 @@ void benchDw(std::vector<int> & latt4, int Ls, int threads,int report )
#ifdef CHECK #ifdef CHECK
if (1) { if (1) {
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
tmp = U[mu]*Cshift(src,mu+1,1); tmp = U[mu]*Cshift(src,mu+1,1);
ref=ref + tmp - Gamma(Gmu[mu])*tmp; ref=ref + tmp - Gamma(Gmu[mu])*tmp;
@ -258,12 +258,12 @@ void benchsDw(std::vector<int> & latt4, int Ls, int threads, int report )
LatticeGaugeField Umu(UGrid); LatticeGaugeField Umu(UGrid);
random(RNG4,Umu); random(RNG4,Umu);
#else #else
LatticeFermion src (FGrid); src=zero; LatticeFermion src (FGrid); src=Zero();
LatticeGaugeField Umu(UGrid); Umu=zero; LatticeGaugeField Umu(UGrid); Umu=Zero();
#endif #endif
LatticeFermion result(FGrid); result=zero; LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=zero; LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid); LatticeFermion err(FGrid);
@ -339,8 +339,8 @@ void benchsDw(std::vector<int> & latt4, int Ls, int threads, int report )
setCheckerboard(sr_eo,ssrc_o); setCheckerboard(sr_eo,ssrc_o);
setCheckerboard(sr_eo,ssrc_e); setCheckerboard(sr_eo,ssrc_e);
sr_e = zero; sr_e = Zero();
sr_o = zero; sr_o = Zero();
sDw.DhopEO(ssrc_o,sr_e,DaggerNo); sDw.DhopEO(ssrc_o,sr_e,DaggerNo);
PerformanceCounter CounterSdw(8); PerformanceCounter CounterSdw(8);

View File

@ -56,8 +56,8 @@ int main (int argc, char ** argv)
RealD N2 = 1.0/::sqrt(norm2(src)); RealD N2 = 1.0/::sqrt(norm2(src));
src = src*N2; src = src*N2;
GparityLatticeFermionF result(FGrid); result=zero; GparityLatticeFermionF result(FGrid); result=Zero();
GparityLatticeFermionF ref(FGrid); ref=zero; GparityLatticeFermionF ref(FGrid); ref=Zero();
GparityLatticeFermionF tmp(FGrid); GparityLatticeFermionF tmp(FGrid);
GparityLatticeFermionF err(FGrid); GparityLatticeFermionF err(FGrid);

View File

@ -64,7 +64,7 @@ int main (int argc, char ** argv)
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3]*threads; int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3]*threads;
Vec tsum; tsum = zero; Vec tsum; tsum = Zero();
GridParallelRNG pRNG(&Grid); GridParallelRNG pRNG(&Grid);
pRNG.SeedFixedIntegers(std::vector<int>({56,17,89,101})); pRNG.SeedFixedIntegers(std::vector<int>({56,17,89,101}));

View File

@ -41,7 +41,7 @@ int main (int argc, char ** argv)
typedef iVector<vReal,Nvec> Vec; typedef iVector<vReal,Nvec> Vec;
Vec rn = zero; Vec rn = Zero();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vReal::Nsimd()); std::vector<int> simd_layout = GridDefaultSimd(Nd,vReal::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi(); std::vector<int> mpi_layout = GridDefaultMpi();

View File

@ -95,8 +95,8 @@ int main (int argc, char ** argv)
setCheckerboard(r_eo,src_o); setCheckerboard(r_eo,src_o);
setCheckerboard(r_eo,src_e); setCheckerboard(r_eo,src_e);
r_e = zero; r_e = Zero();
r_o = zero; r_o = Zero();
#define BENCH_DW(A,in,out) \ #define BENCH_DW(A,in,out) \
@ -204,8 +204,8 @@ int main (int argc, char ** argv)
setCheckerboard(r_eo,src_o); setCheckerboard(r_eo,src_o);
setCheckerboard(r_eo,src_e); setCheckerboard(r_eo,src_e);
r_e = zero; r_e = Zero();
r_o = zero; r_o = Zero();
BENCH_DW_MEO(Dhop ,src,result); BENCH_DW_MEO(Dhop ,src,result);
BENCH_DW_MEO(DhopEO ,src_o,r_e); BENCH_DW_MEO(DhopEO ,src_o,r_e);

View File

@ -57,10 +57,10 @@ int main (int argc, char ** argv)
typename ImprovedStaggeredFermionR::ImplParams params; typename ImprovedStaggeredFermionR::ImplParams params;
FermionField src (&Grid); random(pRNG,src); FermionField src (&Grid); random(pRNG,src);
FermionField result(&Grid); result=zero; FermionField result(&Grid); result=Zero();
FermionField ref(&Grid); ref=zero; FermionField ref(&Grid); ref=Zero();
FermionField tmp(&Grid); tmp=zero; FermionField tmp(&Grid); tmp=Zero();
FermionField err(&Grid); tmp=zero; FermionField err(&Grid); tmp=Zero();
LatticeGaugeField Umu(&Grid); random(pRNG,Umu); LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid); std::vector<LatticeColourMatrix> U(4,&Grid);
@ -71,12 +71,12 @@ int main (int argc, char ** argv)
// Only one non-zero (y) // Only one non-zero (y)
#if 0 #if 0
Umu=zero; Umu=Zero();
Complex cone(1.0,0.0); Complex cone(1.0,0.0);
for(int nn=0;nn<Nd;nn++){ for(int nn=0;nn<Nd;nn++){
random(pRNG,U[nn]); random(pRNG,U[nn]);
if(1) { if(1) {
if (nn!=2) { U[nn]=zero; std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; } if (nn!=2) { U[nn]=Zero(); std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; }
// else { U[nn]= cone;std::cout<<GridLogMessage << "unit gauge field in dir "<<nn<<std::endl; } // else { U[nn]= cone;std::cout<<GridLogMessage << "unit gauge field in dir "<<nn<<std::endl; }
else { std::cout<<GridLogMessage << "random gauge field in dir "<<nn<<std::endl; } else { std::cout<<GridLogMessage << "random gauge field in dir "<<nn<<std::endl; }
} }
@ -87,10 +87,10 @@ int main (int argc, char ** argv)
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
U[mu] = PeekIndex<LorentzIndex>(Umu,mu); U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
} }
ref = zero; ref = Zero();
/* /*
{ // Naive wilson implementation { // Naive wilson implementation
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
// ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x // ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x
tmp = U[mu]*Cshift(src,mu,1); tmp = U[mu]*Cshift(src,mu,1);

View File

@ -72,10 +72,10 @@ int main (int argc, char ** argv)
// pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}); // pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
LatticeFermion src (&Grid); random(pRNG,src); LatticeFermion src (&Grid); random(pRNG,src);
LatticeFermion result(&Grid); result=zero; LatticeFermion result(&Grid); result=Zero();
LatticeFermion ref(&Grid); ref=zero; LatticeFermion ref(&Grid); ref=Zero();
LatticeFermion tmp(&Grid); tmp=zero; LatticeFermion tmp(&Grid); tmp=Zero();
LatticeFermion err(&Grid); tmp=zero; LatticeFermion err(&Grid); tmp=Zero();
LatticeGaugeField Umu(&Grid); random(pRNG,Umu); LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid); std::vector<LatticeColourMatrix> U(4,&Grid);
@ -86,12 +86,12 @@ int main (int argc, char ** argv)
// Only one non-zero (y) // Only one non-zero (y)
#if 0 #if 0
Umu=zero; Umu=Zero();
Complex cone(1.0,0.0); Complex cone(1.0,0.0);
for(int nn=0;nn<Nd;nn++){ for(int nn=0;nn<Nd;nn++){
random(pRNG,U[nn]); random(pRNG,U[nn]);
if(1) { if(1) {
if (nn!=2) { U[nn]=zero; std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; } if (nn!=2) { U[nn]=Zero(); std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; }
// else { U[nn]= cone;std::cout<<GridLogMessage << "unit gauge field in dir "<<nn<<std::endl; } // else { U[nn]= cone;std::cout<<GridLogMessage << "unit gauge field in dir "<<nn<<std::endl; }
else { std::cout<<GridLogMessage << "random gauge field in dir "<<nn<<std::endl; } else { std::cout<<GridLogMessage << "random gauge field in dir "<<nn<<std::endl; }
} }
@ -104,7 +104,7 @@ int main (int argc, char ** argv)
} }
{ // Naive wilson implementation { // Naive wilson implementation
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
// ref = src + Gamma(Gamma::Algebra::GammaX)* src ; // 1-gamma_x // ref = src + Gamma(Gamma::Algebra::GammaX)* src ; // 1-gamma_x
tmp = U[mu]*Cshift(src,mu,1); tmp = U[mu]*Cshift(src,mu,1);
@ -156,7 +156,7 @@ int main (int argc, char ** argv)
} }
{ // Naive wilson dag implementation { // Naive wilson dag implementation
ref = zero; ref = Zero();
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x // ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x

View File

@ -98,7 +98,7 @@ int main (int argc, char ** argv)
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds); GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
LatticeGaugeField Umu(&Grid); random(pRNG,Umu); LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
LatticeFermion src(&Grid); random(pRNG,src); LatticeFermion src(&Grid); random(pRNG,src);
LatticeFermion result(&Grid); result=zero; LatticeFermion result(&Grid); result=Zero();
double volume = std::accumulate(latt_size.begin(),latt_size.end(),1,std::multiplies<int>()); double volume = std::accumulate(latt_size.begin(),latt_size.end(),1,std::multiplies<int>());