CHROMA
syssolver_polyprec_cg.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Solve a PolyPrec*psi=chi linear system by CG1
4  */
5 
6 #ifndef __syssolver_polyprec_cg_h__
7 #define __syssolver_polyprec_cg_h__
8 
9 #include "handle.h"
10 #include "syssolver.h"
11 #include "linearop.h"
15 
16 
17 namespace Chroma
18 {
19 
20  //! CG system solver namespace
21  namespace PolyPrecSysSolverCGEnv
22  {
23  //! Register the syssolver
24  bool registerAll();
25  }
26 
27 
28  //! Solve a PolyPrec*psi=chi linear system by CG1
29  /*! \ingroup invert
30  */
31  template<typename T>
33  {
34  public:
35  //! Constructor
36  /*!
37  * \param M_ Linear operator ( Read )
38  * \param invParam inverter parameters ( Read )
39  */
41  const SysSolverCGParams& invParam_) :
42  A(A_), invParam(invParam_)
43  {}
44 
45  //! Destructor is automatic
47 
48  //! Return the subset on which the operator acts
49  const Subset& subset() const {return A->subset();}
50 
51  //! Solver the linear system
52  /*!
53  * \param psi solution ( Modify )
54  * \param chi source ( Read )
55  * \return syssolver results
56  */
58  {
59  START_CODE();
60 
61  T chi_tmp;
62  (*A)(chi_tmp, chi, MINUS);
63 
65 
66  END_CODE();
67 
68  return res;
69  }
70 
71 
72  private:
73  // Hide default constructor
75 
78  };
79 
80 } // End namespace
81 
82 #endif
83 
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator.
Definition: linearop.h:27
Solve a PolyPrec*psi=chi linear system by CG1.
~PolyPrecSysSolverCG()
Destructor is automatic.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
PolyPrecSysSolverCG(Handle< LinearOperator< T > > A_, const SysSolverCGParams &invParam_)
Constructor.
Handle< LinearOperator< T > > A
const Subset & subset() const
Return the subset on which the operator acts.
SystemSolverResults_t InvCG1(const LinearOperator< LatticeFermion > &A, const LatticeFermion &chi, LatticeFermion &psi, const Real &RsdCG, int MaxCG, int MinCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Definition: invcg1.cc:215
Class for counted reference semantics.
Conjugate-Gradient algorithm for a generic Linear Operator.
Linear Operators.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
@ MINUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
SystemSolver disambiguator.
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Linear system solvers.
Solve a CG1 system.
Disambiguator for PolyPrec system solvers.