1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-15 02:05:37 +00:00

fix vector assign bug

This commit is contained in:
Yong-Chull Jang 2017-11-27 13:39:52 -05:00
parent 91cc33e907
commit 2c35c89b92
2 changed files with 15 additions and 7 deletions

View File

@ -84,7 +84,8 @@ namespace Grid {
public: public:
void csv(std::ostream &out){ void csv(std::ostream &out){
RealD diff = hi-lo; RealD diff = hi-lo;
for (RealD x=lo-0.2*diff; x<hi+0.2*diff; x+=(hi-lo)/1000) { //for (RealD x=lo-0.2*diff; x<hi+0.2*diff; x+=(hi-lo)/1000) {
for (RealD x=lo-0.2*diff; x<hi+0.2*diff; x+=diff/1000.0) { // ypj [note] divide by float
RealD f = approx(x); RealD f = approx(x);
out<< x<<" "<<f<<std::endl; out<< x<<" "<<f<<std::endl;
} }
@ -115,7 +116,10 @@ namespace Grid {
if(order < 2) exit(-1); if(order < 2) exit(-1);
Coeffs.resize(order); Coeffs.resize(order);
Coeffs.assign(0.,order); //Coeffs.assign(0.,order);
// ypj [note] Does it mean 0 initiallization?
// Then, arguments of the assign() have to be swapped:
Coeffs.assign(order,0.);
Coeffs[order-1] = 1.; Coeffs[order-1] = 1.;
}; };

View File

@ -51,7 +51,9 @@ int main (int argc, char ** argv)
std::vector<int> seeds5({5,6,7,8}); std::vector<int> seeds5({5,6,7,8});
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5); GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
GridParallelRNG RNG5rb(FrbGrid); RNG5.SeedFixedIntegers(seeds5); //GridParallelRNG RNG5rb(FrbGrid); RNG5.SeedFixedIntegers(seeds5);
// ypj [note] why seed RNG5 again? bug? In this case, run with a default seed().
GridParallelRNG RNG5rb(FrbGrid); //RNG5rb.SeedFixedIntegers(seeds5);
LatticeGaugeField Umu(UGrid); LatticeGaugeField Umu(UGrid);
SU3::HotConfiguration(RNG4, Umu); SU3::HotConfiguration(RNG4, Umu);
@ -76,13 +78,15 @@ int main (int argc, char ** argv)
// SchurDiagMooeeOperator<DomainWallFermionR,LatticeFermion> HermOp(Ddwf); // SchurDiagMooeeOperator<DomainWallFermionR,LatticeFermion> HermOp(Ddwf);
const int Nstop = 30; const int Nstop = 30;
const int Nk = 40; const int Nk = 60;
const int Np = 40; const int Np = 60;
const int Nm = Nk+Np; const int Nm = Nk+Np;
const int MaxIt= 10000; const int MaxIt= 10000;
RealD resid = 1.0e-8; RealD resid = 1.0e-8;
std::vector<double> Coeffs { 0.,-1.}; //std::vector<double> Coeffs { 0.,-1.};
// ypj [note] this may not be supported by some compilers
std::vector<double> Coeffs({ 0.,1.});
Polynomial<FermionField> PolyX(Coeffs); Polynomial<FermionField> PolyX(Coeffs);
Chebyshev<FermionField> Cheb(0.2,5.,11); Chebyshev<FermionField> Cheb(0.2,5.,11);
// ChebyshevLanczos<LatticeFermion> Cheb(9.,1.,0.,20); // ChebyshevLanczos<LatticeFermion> Cheb(9.,1.,0.,20);
@ -100,7 +104,7 @@ int main (int argc, char ** argv)
}; };
int Nconv; int Nconv;
//IRL.calc(eval,evec,src,Nconv); IRL.calc(eval,evec,src,Nconv);
Grid_finalize(); Grid_finalize();