CHROMA
eoprec_staggered_qprop.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Propagator solver for an even-odd non-preconditioned fermion operator
4  *
5  * Solve for the propagator of an even-odd non-preconditioned fermion operator
6  */
7 
8 #ifndef PREC_STAGGERED_QPROP_H
9 #define PREC_STAGGERED_QPROP_H
10 
11 #include "stagtype_fermact_s.h"
14 
15 
16 namespace Chroma
17 {
18  //! Propagator of a generic even-odd fermion linear operator
19  /*! \ingroup qprop
20  *
21  * This routine is actually generic to all even-odd fermions
22  */
23  template<typename T, typename P, typename Q>
25  {
26  public:
27  //! Constructor
28  /*!
29  * \param M_ Linear operator ( Read )
30  * \param A_ M^dag*M operator ( Read )
31  * \param invParam inverter parameters ( Read )
32  */
35  const Real& Mass_,
36  const SysSolverCGParams& invParam_) :
37  M(M_), A(A_), Mass(Mass_), invParam(invParam_)
38  {}
39 
42  const SysSolverCGParams& invParam_) :
43  M(S_.linOp(state)), A(S_.lMdagM(state)),
44  Mass(S_.getQuarkMass()), invParam(invParam_) {}
45 
46  //! Destructor is automatic
48 
49  //! Return the subset on which the operator acts
50  const Subset& subset() const {return all;}
51 
52  //! Solver the linear system
53  /*!
54  * \param psi quark propagator ( Modify )
55  * \param chi source ( Read )
56  * \return number of CG iterations
57  */
59  {
60  START_CODE();
61 
62  LatticeStaggeredFermion tmp, tmp1, tmp2;
63  tmp = tmp1 = tmp2 = zero;
64  Real invm;
65 
66  // switch(invType)
67  //{
68  //case CG_INVERTER:
69 
70  // Make preconditioned source: tmp_1_e = M_ee chi_e + M_eo^{dag} chi_o
71 
72  M->evenEvenLinOp(tmp, chi, PLUS);
73  M->evenOddLinOp(tmp2, chi, MINUS);
74  tmp[rb[0]] += tmp2;
75 
76 
77  /* psi = (M^dag * M)^(-1) chi = A^{-1} chi*/
79  invParam.RsdCG,
81  invParam.MinCG);
82 
83  // psi[rb[0]] is returned, so reconstruct psi[rb[1]]
84  invm = Real(1)/(2*Mass);
85 
86  // tmp_1_o = D_oe psi_e
87  M->oddEvenLinOp(tmp1, psi, PLUS);
88 
89  // tmp_1_o = (1/2m) D_oe psi_e
90  tmp1[rb[1]] *= invm;
91 
92  // tmp_2_o = (1/2m) chi_o
93  tmp2[rb[1]] = invm * chi;
94 
95  // psi_o = (1/2m) chi_o - (1/2m) D_oe psi_e
96  psi[rb[1]] = tmp2 - tmp1;
97  // break;
98 
99  // default:
100  // QDP_error_exit("Unknown inverter type", invType);
101  //}
102 
103  if ( res.n_count == invParam.MaxCG )
104  QDP_error_exit("no convergence in the inverter", res.n_count);
105 
106  // Compute residual
107  {
108  T r;
109  (*M)(r, psi, PLUS);
110  r -= chi;
111  res.resid = sqrt(norm2(r));
112  QDPIO::cout << "eoprec_staggered_qprop: true residual: " << res.resid << std::endl;
113  }
114 
115  END_CODE();
116 
117  return res;
118  }
119 
120 
121  private:
122  // Hide default constructor
124 
127  Real Mass;
129  };
130 
131 } // End namespace
132 
133 #endif
134 
Propagator of a generic even-odd fermion linear operator.
~EvenOddFermActQprop()
Destructor is automatic.
Handle< EvenOddLinearOperator< T, P, Q > > M
Handle< LinearOperator< T > > A
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
EvenOddFermActQprop(const EvenOddStaggeredTypeFermAct< T, P, Q > &S_, Handle< FermState< T, P, Q > > state, const SysSolverCGParams &invParam_)
EvenOddFermActQprop(Handle< EvenOddLinearOperator< T, P, Q > > M_, Handle< LinearOperator< T > > A_, const Real &Mass_, const SysSolverCGParams &invParam_)
Constructor.
const Subset & subset() const
Return the subset on which the operator acts.
Even odd Linear Operator (for staggered like things )
Definition: eo_linop.h:28
Even-odd preconditioned Staggered-like fermion actions.
Definition: fermact.orig.h:714
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator.
Definition: linearop.h:27
Linear system solvers.
Definition: syssolver.h:34
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
Conjugate-Gradient algorithm for a generic Linear Operator.
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
LinOpSysSolverMGProtoClover::T T
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
Staggered-like fermion actions.
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Solve a CG1 system.