/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/algorithms/iterative/SchurRedBlack.h Copyright (C) 2015 Author: Peter Boyle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #pragma once NAMESPACE_BEGIN(Grid); template class PauliVillarsSolverUnprec { public: ConjugateGradient & CG; PauliVillarsSolverUnprec( ConjugateGradient &_CG) : CG(_CG){}; template void operator() (Matrix &_Matrix,const Field &src,Field &sol) { RealD m = _Matrix.Mass(); Field A (_Matrix.FermionGrid()); MdagMLinearOperator HermOp(_Matrix); _Matrix.SetMass(1.0); _Matrix.Mdag(src,A); CG(HermOp,A,sol); _Matrix.SetMass(m); }; }; template class PauliVillarsSolverRBprec { public: SchurSolverType & SchurSolver; PauliVillarsSolverRBprec( SchurSolverType &_SchurSolver) : SchurSolver(_SchurSolver){}; template void operator() (Matrix &_Matrix,const Field &src,Field &sol) { RealD m = _Matrix.Mass(); Field A (_Matrix.FermionGrid()); _Matrix.SetMass(1.0); SchurSolver(_Matrix,src,sol); _Matrix.SetMass(m); }; }; template class PauliVillarsSolverFourierAccel { public: GaugeField & Umu; ConjugateGradient & CG; PauliVillarsSolverFourierAccel(GaugeField &_Umu,ConjugateGradient &_CG) : Umu(_Umu), CG(_CG) { }; template void operator() (Matrix &_Matrix,const Field &src,Field &sol) { FourierAcceleratedPV faPV(_Matrix,Umu,CG) ; faPV.pvInv(src,sol); }; }; NAMESPACE_END(Grid);