#ifndef GRID_CONJUGATE_RESIDUAL_H #define GRID_CONJUGATE_RESIDUAL_H namespace Grid { ///////////////////////////////////////////////////////////// // Base classes for iterative processes based on operators // single input vec, single output vec. ///////////////////////////////////////////////////////////// template class ConjugateResidual : public OperatorFunction { public: RealD Tolerance; Integer MaxIterations; int verbose; ConjugateResidual(RealD tol,Integer maxit) : Tolerance(tol), MaxIterations(maxit) { verbose=1; }; void operator() (LinearOperatorBase &Linop,const Field &src, Field &psi){ RealD a, b, c, d; RealD cp, ssq,rsq; RealD rAr, rAAr, rArp; RealD pAp, pAAp; GridBase *grid = src._grid; psi=zero; Field r(grid), p(grid), Ap(grid), Ar(grid); r=src; p=src; Linop.HermOpAndNorm(p,Ap,pAp,pAAp); Linop.HermOpAndNorm(r,Ar,rAr,rAAr); std::cout << "pAp, pAAp"<< pAp<<" "<