diff --git a/Grid/algorithms/iterative/PrecGeneralisedConjugateResidual.h b/Grid/algorithms/iterative/PrecGeneralisedConjugateResidual.h index d3188ecb..a61b62e0 100644 --- a/Grid/algorithms/iterative/PrecGeneralisedConjugateResidual.h +++ b/Grid/algorithms/iterative/PrecGeneralisedConjugateResidual.h @@ -38,10 +38,11 @@ Author: Peter Boyle /////////////////////////////////////////////////////////////////////////////////////////////////////// NAMESPACE_BEGIN(Grid); +#define GCRLogLevel std::cout << GridLogMessage < -class PrecGeneralisedConjugateResidual : public OperatorFunction { +class PrecGeneralisedConjugateResidual : public LinearFunction { public: - using OperatorFunction::operator(); RealD Tolerance; Integer MaxIterations; @@ -49,23 +50,29 @@ public: int mmax; int nstep; int steps; + int level; GridStopWatch PrecTimer; GridStopWatch MatTimer; GridStopWatch LinalgTimer; - LinearFunction &Preconditioner; + LinearFunction &Preconditioner; + LinearOperatorBase &Linop; - PrecGeneralisedConjugateResidual(RealD tol,Integer maxit,LinearFunction &Prec,int _mmax,int _nstep) : + void Level(int lv) { level=lv; }; + + PrecGeneralisedConjugateResidual(RealD tol,Integer maxit,LinearOperatorBase &_Linop,LinearFunction &Prec,int _mmax,int _nstep) : Tolerance(tol), MaxIterations(maxit), + Linop(_Linop), Preconditioner(Prec), mmax(_mmax), nstep(_nstep) { + level=1; verbose=1; }; - void operator() (LinearOperatorBase &Linop,const Field &src, Field &psi){ + void operator() (const Field &src, Field &psi){ psi=Zero(); RealD cp, ssq,rsq; @@ -84,9 +91,9 @@ public: steps=0; for(int k=0;k &Linop,const Field &src, Field &psi,RealD rsq){ + RealD GCRnStep(const Field &src, Field &psi,RealD rsq){ RealD cp; RealD a, b; @@ -134,9 +143,7 @@ public: std::vector p(mmax,grid); std::vector qq(mmax); - std::cout<