CHROMA
multi_syssolver_mdagm_cg_accumulate_array.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Solve a MdagM*psi=chi linear system by multi-shift CG
4  */
5 
6 #ifndef __multi_syssolver_mdagm_cg_accumulate_array_h__
7 #define __multi_syssolver_mdagm_cg_accumulate_array_h__
8 
9 #include "qdp.h"
10 #include "handle.h"
11 #include "syssolver.h"
12 #include "linearop.h"
16 
17 using namespace QDP;
18 
19 namespace Chroma
20 {
21 
22  //! CG system solver namespace
23  namespace MdagMMultiSysSolverCGAccumulateArrayEnv
24  {
25  //! Register the syssolver
26  bool registerAll();
27  }
28 
29 
30  //! Solve a CG system. Here, the operator is NOT assumed to be hermitian
31  /*! \ingroup invert
32  */
33  template<typename T>
35  {
36  public:
37  //! Constructor
38  /*!
39  * \param M_ Linear operator ( Read )
40  * \param invParam inverter parameters ( Read )
41  */
43  const MultiSysSolverCGParams& invParam_) :
44  A(A_), invParam(invParam_)
45  {}
46 
47  //! Destructor is automatic
49 
50  //! Expected length of array index
51  int size() const {return A->size();}
52 
53  //! Return the subset on which the operator acts
54  const Subset& subset() const {return A->subset();}
55 
56  //! Solver the linear system
57  /*!
58  * \param psi solution ( Modify )
59  * \param chi source ( Read )
60  * \return syssolver results
61  */
63  const Real& norm,
64  const multi1d<Real>& residues,
65  const multi1d<Real>& poles,
66  const multi1d<T>& chi) const
67  {
68  START_CODE();
69 
70 
72  Real RsdCG=invParam.RsdCG[0];
73 
74  MInvCGAccum(*A, chi,psi, norm, residues,poles, RsdCG, invParam.MaxCG, res.n_count);
75 
76  END_CODE();
77 
78  return res;
79  }
80 
81 
82  private:
83  // Hide default constructor
85 
88  };
89 
90 } // End namespace
91 
92 #endif
93 
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator to arrays.
Definition: linearop.h:61
Solve a CG system. Here, the operator is NOT assumed to be hermitian.
MdagMMultiSysSolverCGAccumulateArray(Handle< LinearOperatorArray< T > > A_, const MultiSysSolverCGParams &invParam_)
Constructor.
const Subset & subset() const
Return the subset on which the operator acts.
void MInvCGAccum(const LinearOperatorArray< LatticeFermion > &M, const multi1d< LatticeFermion > &chi, multi1d< LatticeFermion > &psi, const Real &norm, const multi1d< Real > &residues, const multi1d< Real > &poles, const Real &RsdCG, const int MaxCG, int &n_count)
Class for counted reference semantics.
Linear Operators.
Multishift Conjugate-Gradient algorithm for a Linear Operator.
Params of CG inverter.
Disambiguator for multi-shift MdagM system solvers.
bool registerAll()
Register all the factories.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > & RsdCG
Definition: pbg5p_w.cc:30
A(A, psi, r, Ncb, PLUS)
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
int norm
Definition: qtopcor.cc:35
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Linear system solvers.