diff --git a/Grid/algorithms/LinearOperator.h b/Grid/algorithms/LinearOperator.h index ced8d987..76fdb0f6 100644 --- a/Grid/algorithms/LinearOperator.h +++ b/Grid/algorithms/LinearOperator.h @@ -391,12 +391,12 @@ template using SchurStagOperator = SchurStaggeredOpera template class OperatorFunction { public: virtual void operator() (LinearOperatorBase &Linop, const Field &in, Field &out) = 0; - virtual void operator() (LinearOperatorBase &Linop, const std::vector &in,std::vector &out) { - assert(in.size()==out.size()); - for(int k=0;k &Linop, const std::vector &in,std::vector &out) { + assert(in.size()==out.size()); + for(int k=0;k class LinearFunction { diff --git a/Grid/algorithms/approx/Chebyshev.h b/Grid/algorithms/approx/Chebyshev.h index 705422e7..97e0e807 100644 --- a/Grid/algorithms/approx/Chebyshev.h +++ b/Grid/algorithms/approx/Chebyshev.h @@ -47,6 +47,8 @@ struct ChebyParams : Serializable { template class Chebyshev : public OperatorFunction { private: + using OperatorFunction::operator(); + std::vector Coeffs; int order; RealD hi; diff --git a/Grid/algorithms/iterative/ConjugateGradient.h b/Grid/algorithms/iterative/ConjugateGradient.h index e818e059..379a3706 100644 --- a/Grid/algorithms/iterative/ConjugateGradient.h +++ b/Grid/algorithms/iterative/ConjugateGradient.h @@ -41,6 +41,9 @@ NAMESPACE_BEGIN(Grid); template class ConjugateGradient : public OperatorFunction { public: + + using OperatorFunction::operator(); + bool ErrorOnNoConverge; // throw an assert when the CG fails to converge. // Defaults true. RealD Tolerance; @@ -58,7 +61,8 @@ public: conformable(psi, src); - RealD cp, c, a, d, b, ssq, qq, b_pred; + RealD cp, c, a, d, b, ssq, qq; + //RealD b_pred; Field p(src); Field mmp(src); @@ -128,10 +132,10 @@ public: auto psi_v = psi.View(); auto p_v = p.View(); auto r_v = r.View(); - parallel_for(int ss=0;ssoSites();ss++){ + accelerator_loop(ss,p_v,{ vstream(psi_v[ss], a * p_v[ss] + psi_v[ss]); vstream(p_v [ss], b * p_v[ss] + r_v[ss]); - } + }); LinearCombTimer.Stop(); LinalgTimer.Stop();