1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00
This commit is contained in:
Peter Boyle
2015-07-21 13:56:22 +09:00
parent 5ac625f716
commit 4e94ddad46
5 changed files with 247 additions and 6 deletions

View File

@ -17,8 +17,12 @@ public:
pRNG.SeedFixedIntegers(seeds);
random(pRNG,sqrtscale);
sqrtscale = sqrtscale * adj(sqrtscale);// force real pos def
scale = sqrtscale * sqrtscale;
sqrtscale = real(sqrtscale)*3.0+0.5;// force real pos def
scale = sqrtscale *sqrtscale; //scale should be bounded by 12.25
//
// sqrtscale = 2.0;
// scale = 4.0;
}
// Support for coarsening to a multigrid
void OpDiag (const Field &in, Field &out) {};
@ -48,8 +52,18 @@ public:
void ApplySqrt(const Field &in, Field &out){
out = sqrtscale * in;
}
void ApplyInverse(const Field &in, Field &out){
out = pow(scale,-1.0) * in;
}
};
RealD InverseApproximation(RealD x){
return 1.0/x;
}
RealD SqrtApproximation(RealD x){
return std::sqrt(x);
}
int main (int argc, char ** argv)
{
@ -114,5 +128,22 @@ int main (int argc, char ** argv)
error = summed - combined;
std::cout << " summed-combined "<<norm2(error) <<std::endl;
src=1.0;
Chebyshev<LatticeFermion> Cheby(0.1,40.0,200,InverseApproximation);
std::cout<<"Chebuy approx vector "<<std::endl;
Cheby(Diagonal,src,combined);
std::ofstream of("cheby");
Cheby.csv(of);
Diagonal.ApplyInverse(src,reference);
error = reference - combined;
std::cout << "Chebyshev inverse test "<<std::endl;
std::cout << " Reference "<<norm2(reference)<<std::endl;
std::cout << " combined "<<norm2(combined) <<std::endl;
std::cout << " error "<<norm2(error) <<std::endl;
Grid_finalize();
}