diff --git a/Grid/algorithms/iterative/NormalEquations.h b/Grid/algorithms/iterative/NormalEquations.h index 270b0115..df82b6dc 100644 --- a/Grid/algorithms/iterative/NormalEquations.h +++ b/Grid/algorithms/iterative/NormalEquations.h @@ -33,26 +33,30 @@ NAMESPACE_BEGIN(Grid); /////////////////////////////////////////////////////////////////////////////////////////////////////// // Take a matrix and form an NE solver calling a Herm solver /////////////////////////////////////////////////////////////////////////////////////////////////////// -template class NormalEquations : public OperatorFunction{ +template class NormalEquations { private: SparseMatrixBase & _Matrix; OperatorFunction & _HermitianSolver; - + LinearFunction & _Guess; public: ///////////////////////////////////////////////////// // Wrap the usual normal equations trick ///////////////////////////////////////////////////// - NormalEquations(SparseMatrixBase &Matrix, OperatorFunction &HermitianSolver) - : _Matrix(Matrix), _HermitianSolver(HermitianSolver) {}; + NormalEquations(SparseMatrixBase &Matrix, OperatorFunction &HermitianSolver, + LinearFunction &Guess) + : _Matrix(Matrix), _HermitianSolver(HermitianSolver), _Guess(Guess) {}; void operator() (const Field &in, Field &out){ Field src(in.Grid()); + Field tmp(in.Grid()); + MdagMLinearOperator,Field> MdagMOp(_Matrix); _Matrix.Mdag(in,src); - _HermitianSolver(src,out); // Mdag M out = Mdag in - + _Guess(src,out); + _HermitianSolver(MdagMOp,src,out); // Mdag M out = Mdag in + } };