CHROMA
eoprec_fermact_qprop.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Propagator solver for a generic even-odd preconditioned fermion operator
3  *
4  * Solve for the propagator of a even-odd non-preconditioned fermion operator
5  */
6 
8 
9 namespace Chroma
10 {
11  //! Propagator of a generic even-odd preconditioned fermion linear operator
12  /*! \ingroup qprop
13  *
14  * This routine is actually generic to all even-odd preconditioned fermions
15  */
16  template<typename T, typename P, typename Q>
17  class PrecFermActQprop : public SystemSolver<T>
18  {
19  public:
20  //! Constructor
21  /*!
22  * \param A_ Linear operator ( Read )
23  * \param invParam_ inverter parameters ( Read )
24  */
26  Handle< LinOpSystemSolver<T> > invA_) : A(A_), invA(invA_)
27  {}
28 
29  //! Destructor is automatic
31 
32  //! Return the subset on which the operator acts
33  const Subset& subset() const {return all;}
34 
35  //! Solver the linear system
36  /*!
37  * \param psi quark propagator ( Modify )
38  * \param chi source ( Read )
39  * \return number of CG iterations
40  */
42  {
43  START_CODE();
44 
45  /* Step (i) */
46  /* chi_tmp = chi_o - D_oe * A_ee^-1 * chi_e */
47  T chi_tmp;
48  {
49  T tmp1, tmp2;
50 
51  A->evenEvenInvLinOp(tmp1, chi, PLUS);
52  A->oddEvenLinOp(tmp2, tmp1, PLUS);
53  chi_tmp[rb[1]] = chi - tmp2;
54  }
55 
56  // Call inverter
57  SystemSolverResults_t res = (*invA)(psi, chi_tmp);
58 
59  /* Step (ii) */
60  /* psi_e = A_ee^-1 * [chi_e - D_eo * psi_o] */
61  {
62  T tmp1, tmp2;
63 
64  A->evenOddLinOp(tmp1, psi, PLUS);
65  tmp2[rb[0]] = chi - tmp1;
66  A->evenEvenInvLinOp(psi, tmp2, PLUS);
67  }
68 
69  // Compute residual
70  {
71  T r;
72  A->unprecLinOp(r, psi, PLUS);
73  r -= chi;
74  res.resid = sqrt(norm2(r));
75  }
76 
77  END_CODE();
78 
79  return res;
80  }
81 
82  private:
83  // Hide default constructor
85 
88  };
89 
90 
91  typedef LatticeFermion LF;
92  typedef multi1d<LatticeColorMatrix> LCM;
93 
94 
95  template<>
98  const GroupXML_t& invParam) const
99  {
100  StopWatch swatch2;
101 
102  QDPIO::cout << " ... constructing linop " ;
103  swatch2.reset(); swatch2.start();
105  swatch2.stop();
106  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
107 
108 
109  QDPIO::cout << " ... constructing invLinOp " ;
110  swatch2.reset(); swatch2.start();
111  Handle< LinOpSystemSolver<LF> > ilh((*this).invLinOp(state,invParam));
112  swatch2.stop();
113  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
114 
115  QDPIO::cout << " ... constructing PrecFermActQprop " ;
116  swatch2.reset(); swatch2.start();
118  swatch2.stop();
119  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
120 
121  return ret_val;
122 
123 }
124 
125 } // namespace Chroma
Even-odd preconditioned linear operator.
Definition: eoprec_linop.h:92
virtual SystemSolver< T > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return quark prop solver, solution of unpreconditioned system.
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
SystemSolver disambiguator.
Propagator of a generic even-odd preconditioned fermion linear operator.
PrecFermActQprop(Handle< EvenOddPrecLinearOperator< T, P, Q > > A_, Handle< LinOpSystemSolver< T > > invA_)
Constructor.
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.
Handle< LinOpSystemSolver< T > > invA
Handle< EvenOddPrecLinearOperator< T, P, Q > > A
~PrecFermActQprop()
Destructor is automatic.
Linear system solvers.
Definition: syssolver.h:34
Even-odd preconditioned Wilson-like fermion actions.
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
@ 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
Hold group xml and type id.
Holds return info from SystemSolver call.
Definition: syssolver.h:17