mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Merge
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user