CHROMA
dwf_fermact_qprop_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Base class for unprec and even-odd preconditioned DWF qprop
3  */
4 
5 #include "chromabase.h"
9 
10 
11 
12 namespace Chroma
13 {
14  //! Propagator DWF linear operator
15  /*! \ingroup qprop
16  *
17  * Propagator solver for DWF-like fermions
18  */
19  template<typename T>
20  class DWFQprop : public SystemSolver<T>
21  {
22  public:
23  //! Constructor
24  /*!
25  * \param qpropT_ 5D solver ( Read )
26  * \param PV_ Pauli-Villars linear operator ( Read )
27  * \param m_q_ quark mass ( Read )
28  */
32  const Real& m_q_) :
33  qpropT(qpropT_), A(A_), PV(PV_), m_q(m_q_) {}
34 
35  //! Destructor is automatic
36  ~DWFQprop() {}
37 
38  //! Return the subset on which the operator acts
39  const Subset& subset() const {return all;}
40 
41  //! Solver the linear system
42  /*!
43  * \param psi quark propagator ( Modify )
44  * \param chi source ( Read )
45  * \return number of CG iterations
46  */
48  {
49  START_CODE();
50 
52  const int N5 = PV->size();
53 
54  // Initialize the 5D fields
55  multi1d<T> chi5(N5);
56  {
57  // chi5 = (chi,0,0,0,..,0)^T
58  chi5 = zero;
59  chi5[0] = chi;
60 
61  // tmp5 = P . chi5
62  multi1d<T> tmp5(N5);
63  DwfFld(tmp5, chi5, PLUS);
64 
65  // chi5 = D5(1) . tmp5 = D5(1) . P . (chi,0,0,..,0)^T
66  (*PV)(chi5, tmp5, PLUS);
67  }
68 
69  // psi5 = (psi,0,0,0,...,0)^T
70  multi1d<T> psi5(N5);
71  psi5 = zero;
72  psi5[0] = psi;
73 
74  // Solve D5(m_q) . psi5 = chi5
75  res = (*qpropT)(psi5, chi5);
76 
77  // Compute residual
78  {
79  multi1d<T> r(N5);
80  (*A)(r, psi5, PLUS);
81  r -= chi5;
82  res.resid = sqrt(norm2(r));
83  }
84 
85  // Overall normalization
86  Real ftmp1 = Real(1) / Real(1 - m_q);
87 
88  // Project out first slice after chi5 <- P^(-1) . psi5
89  DwfFld(chi5, psi5, MINUS);
90 
91  // Normalize and remove contact term
92  psi = ftmp1*(chi5[0] - chi);
93 
94  END_CODE();
95 
96  return res;
97  }
98 
99  private:
100  // Hide default constructor
101  DWFQprop() {}
102 
106  const Real m_q;
107  };
108 
109 
110  typedef LatticeFermion LF;
111  typedef multi1d<LatticeColorMatrix> LCM;
112 
113 
114  template<>
117  const GroupXML_t& invParam) const
118  {
119  return new DWFQprop<LF>(Handle< SystemSolverArray<LF> >(this->qpropT(state,invParam)),
120  Handle< LinearOperatorArray<LF> >(this->unprecLinOp(state,getQuarkMass())),
121  Handle< LinearOperatorArray<LF> >(this->unprecLinOp(state,Real(1))),
122  getQuarkMass());
123  }
124 
125 
126 
127 
128  template<>
131  const GroupXML_t& invParam) const
132  {
133  return new DWFQprop<LF>(Handle< SystemSolverArray<LF> >(this->qpropT(state,invParam)),
134  Handle< LinearOperatorArray<LF> >(this->unprecLinOp(state,getQuarkMass())),
135  Handle< LinearOperatorArray<LF> >(this->unprecLinOp(state,Real(1))),
136  getQuarkMass());
137  }
138 
139 
140 } // namespace Chroma
Primary include file for CHROMA library code.
Propagator DWF linear operator.
const Subset & subset() const
Return the subset on which the operator acts.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
DWFQprop(Handle< SystemSolverArray< T > > qpropT_, Handle< LinearOperatorArray< T > > A_, Handle< LinearOperatorArray< T > > PV_, const Real &m_q_)
Constructor.
Handle< LinearOperatorArray< T > > PV
Handle< LinearOperatorArray< T > > A
~DWFQprop()
Destructor is automatic.
Handle< SystemSolverArray< T > > qpropT
SystemSolver< T > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Define quark propagator routine for 4D fermions.
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator to arrays.
Definition: linearop.h:61
Linear system solvers of arrays.
Definition: syssolver.h:62
Linear system solvers.
Definition: syssolver.h:34
SystemSolver< T > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Define quark propagator routine for 4D fermions.
DWF parity/rotation operator.
Base class for even-odd preconditioned domain-wall-like fermion actions.
void DwfFld(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign)
DWF parity/rotation operator.
Definition: dwffld_w.cc:24
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
LatticeStaggeredFermion LF
Definition: asqtad_qprop.cc:19
multi1d< LatticeColorMatrix > LCM
Definition: asqtad_qprop.cc:20
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
Hold group xml and type id.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Double ftmp1
Definition: topol.cc:29
Base class for unpreconditioned domain-wall-like fermion actions.