CHROMA
multi_syssolver_mdagm_cg_accumulate.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Solve a MdagM*psi=chi linear system by CG2
4  */
5 
6 #ifndef __multi_syssolver_mdagm_cg_accumulate_h__
7 #define __multi_syssolver_mdagm_cg_accumulate_h__
8 
9 #include "handle.h"
10 #include "syssolver.h"
11 #include "linearop.h"
15 
16 
17 namespace Chroma
18 {
19 
20  //! CG2 system solver namespace
21  namespace MdagMMultiSysSolverAccumulateCGEnv
22  {
23  //! Register the syssolver
24  bool registerAll();
25  }
26 
27 
28  //! Solve a CG2 system. Here, the operator is NOT assumed to be hermitian
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  */
57  SystemSolverResults_t operator() (T& psi, const Real& norm, const multi1d<Real>& residua,
58  const multi1d<Real>& poles, const T& chi) const
59  {
60  START_CODE();
61 
62  /*
63  multi1d<Real> RsdCG(shifts.size());
64  if (invParam.RsdCG.size() == 1)
65  {
66  RsdCG = invParam.RsdCG[0];
67  }
68  else if (invParam.RsdCG.size() == RsdCG.size())
69  {
70  RsdCG = invParam.RsdCG;
71  }
72  else
73  {
74  QDPIO::cerr << "MdagMMultiSysSolverCG: shifts incompatible" << std::endl;
75  QDP_abort(1);
76  }
77 
78  */
80  MInvCG2Accum(*A, chi, psi, norm, residua, poles, invParam.RsdCG, invParam.MaxCG, res.n_count);
81 
82 
83  END_CODE();
84 
85  return res;
86  }
87 
88 
89  private:
90  // Hide default constructor
92 
95  };
96 
97 
98 } // End namespace
99 
100 #endif
101 
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator.
Definition: linearop.h:27
Solve a CG2 system. Here, the operator is NOT assumed to be hermitian.
MdagMMultiSysSolverCGAccumulate(Handle< LinearOperator< T > > A_, const SysSolverCGParams &invParam_)
Constructor.
SystemSolverResults_t operator()(T &psi, const Real &norm, const multi1d< Real > &residua, const multi1d< Real > &poles, const T &chi) const
Solver the linear system.
const Subset & subset() const
Return the subset on which the operator acts.
void MInvCG2Accum(const LinearOperator< LatticeFermion > &M, const LatticeFermion &chi, LatticeFermion &psi, const Real &norm, const multi1d< Real > &residues, const multi1d< Real > &poles, const Real &RsdCG, int MaxCG, int &n_count)
Class for counted reference semantics.
Linear Operators.
Multishift Conjugate-Gradient algorithm for a Linear Operator.
Disambiguator for multi-shift MdagM system solvers.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
int norm
Definition: qtopcor.cc:35
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Linear system solvers.
Solve a CG1 system.