CHROMA
syssolver_linop_eigcg.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Solve a M*psi=chi linear system by EigCG
4  */
5 
6 #ifndef __syssolver_linop_eigcg_h__
7 #define __syssolver_linop_eigcg_h__
8 
11 
12 namespace Chroma
13 {
14 
15  //! Eigenstd::vector accelerated CG system solver namespace
16  namespace LinOpSysSolverEigCGEnv
17  {
18  //! Register the syssolver
19  bool registerAll();
20  }
21 
22 
23  //! Solve a M*psi=chi linear system by EigCG with eigenvectors
24  /*! \ingroup invert
25  */
26  template<typename T>
28  {
29  public:
30  //! Constructor
31  /*!
32  * \param A_ Linear operator ( Read )
33  * \param sysSolver_ MdagM system solver ( Read )
34  */
36  Handle< MdagMSystemSolver<T> > sysSolver_)
37  : A(A_), sysSolver(sysSolver_) {}
38 
39  //! Destructor is automatic
41 
42  //! Return the subset on which the operator acts
43  const Subset& subset() const {return A->subset();}
44 
45  //! Solver the linear system
46  /*!
47  * \param psi solution ( Modify )
48  * \param chi source ( Read )
49  * \return syssolver results
50  */
52  {
53  T chi_tmp;
54  (*A)(chi_tmp, chi, MINUS);
55 
56  return (*sysSolver)(psi, chi_tmp);
57  }
58 
59  private:
60 
61  // Hide default constructor
64  };
65 
66 } // End namespace
67 
68 
69 
70 #endif
71 
Class for counted reference semantics.
Definition: handle.h:33
Solve a M*psi=chi linear system by EigCG with eigenvectors.
Handle< MdagMSystemSolver< T > > sysSolver
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
const Subset & subset() const
Return the subset on which the operator acts.
Handle< LinearOperator< T > > A
LinOpSysSolverEigCG(Handle< LinearOperator< T > > A_, Handle< MdagMSystemSolver< T > > sysSolver_)
Constructor.
~LinOpSysSolverEigCG()
Destructor is automatic.
SystemSolver disambiguator.
Linear Operator.
Definition: linearop.h:27
SystemSolver disambiguator.
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
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Disambiguator for LinOp system solvers.
Disambiguator for MdagM system solvers.