#ifndef GRID_CONJUGATE_GRADIENT_H #define GRID_CONJUGATE_GRADIENT_H namespace Grid { ///////////////////////////////////////////////////////////// // Base classes for iterative processes based on operators // single input vec, single output vec. ///////////////////////////////////////////////////////////// template class ConjugateGradient : public OperatorFunction { public: RealD Tolerance; Integer MaxIterations; ConjugateGradient(RealD tol,Integer maxit) : Tolerance(tol), MaxIterations(maxit) { std::cout << Tolerance< &Linop,const Field &src, Field &psi){ RealD cp,c,a,d,b,ssq,qq,b_pred; Field p(src); Field mmp(src); Field r(src); //Initial residual computation & set up RealD guess = norm2(psi); Linop.OpAndNorm(psi,mmp,d,b); r= src-mmp; p= r; a =norm2(p); cp =a; ssq=norm2(src); std::cout <