1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Some example clean up

This commit is contained in:
Peter Boyle 2021-08-25 12:24:17 +01:00
parent 0d588b95f4
commit 114920b8de
2 changed files with 10 additions and 8 deletions

View File

@ -112,8 +112,8 @@ int main(int argc, char ** argv)
PowerMethod<Field> PM; PowerMethod<Field> PM;
PM(HermOp,kronecker); PM(HermOp,kronecker);
Chebyshev<Field> ChebySmear(lo,hi,20,DistillationSmearing); // Chebyshev<Field> ChebySmear(lo,hi,20,DistillationSmearing);
// Chebyshev<Field> ChebySmear(lo,hi,20,MomentumSmearing); Chebyshev<Field> ChebySmear(lo,hi,20,MomentumSmearing);
{ {
std::ofstream of("chebysmear"); std::ofstream of("chebysmear");
ChebySmear.csv(of); ChebySmear.csv(of);

View File

@ -15,8 +15,7 @@ void SimpleConjugateGradient(LinearOperatorBase<Field> &HPDop,const Field &b, Fi
r = b - mmp; r = b - mmp;
p = r; p = r;
alpha = norm2(p); cp = alpha = norm2(p);
cp = alpha;
ssq = norm2(b); ssq = norm2(b);
RealD rsq = Tolerance * Tolerance * ssq; RealD rsq = Tolerance * Tolerance * ssq;
@ -26,11 +25,12 @@ void SimpleConjugateGradient(LinearOperatorBase<Field> &HPDop,const Field &b, Fi
HPDop.HermOp(p, mmp); HPDop.HermOp(p, mmp);
ComplexD dc = innerProduct(p,mmp); d = real(innerProduct(p,mmp));
d = dc.real();
alpha = c / d; alpha = c / d;
cp = axpy_norm(r, -alpha, mmp, r); r = r - alpha *mmp;
cp = norm2(r);
beta = cp / c; beta = cp / c;
x = x + alpha* p ; x = x + alpha* p ;
@ -121,7 +121,9 @@ int main(int argc, char ** argv)
r=kronecker-r; r=kronecker-r;
std::cout << "True residual "<< norm2(r) <<std::endl; std::cout << "True residual "<< norm2(r) <<std::endl;
std::cout << psi<<std::endl;
// Optionally print the result vector
// std::cout << psi<<std::endl;
Grid_finalize(); Grid_finalize();
} }