CHROMA
seoprec_fermact_qprop.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Propagator solver for a generic symmetric even-odd preconditioned fermion operator
3  *
4  * Solve for the propagator of a symmetric even-odd non-preconditioned fermion operator
5  */
6 
8 
9 namespace Chroma
10 {
11  //! Propagator of a generic symmetric even-odd preconditioned fermion linear operator
12  /*! \ingroup qprop
13  *
14  * This routine is actually generic to all symmetric even-odd preconditioned fermions
15  */
16  template<typename T, typename P, typename Q>
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' = L^{-1} x M_diag^{-1} chi */
47  T Mdiag_inv_chi;
48  QDPIO::cout << "Diag Inv" << std::endl;
49  A->unprecEvenEvenInvLinOp(Mdiag_inv_chi,chi, PLUS);
50  A->unprecOddOddInvLinOp(Mdiag_inv_chi,chi,PLUS);
51 
52  /* Now apply L^{-1} = [ 1 0 ] = [ 1 0 ]
53  * [ -A^-1_oo D_oe 1 ] [ -M_oe 1]
54  */
55  {
56  T tmp;
57  A->oddEvenLinOp(tmp, Mdiag_inv_chi,PLUS);
58  Mdiag_inv_chi[rb[1]] -= tmp;
59  }
60 
61  // Now solve
62  // [ 1 0 ] [x'_e] = L^{-1} M_diag^{-1} [chi_e]
63  // [ 0 S ] [x'_o] [chi_o]
64  //
65  // = [ Mdiag_inv_chi_e ]
66  // [ Mdiag_inv_chi_o ]
67  //
68  // Call inverter -- for rb[1]
69  SystemSolverResults_t res = (*invA)(psi, Mdiag_inv_chi);
70 
71  // rb[0] is trivial:
72  psi[rb[0]]=Mdiag_inv_chi;
73 
74  /* Step (ii) */
75  /* Reconstruct solution */
76  /* psi = R^{-1} psi = [ 1 - A_ee^{-1} D_eo ] [ psi_e]
77  * [ 0 1 ] [ psi_o]
78  *
79  * = [ 1 -M_eo ] [ psi_e ]
80  * [ 0 1 ] [ psi_o ]
81  */
82  {
83  T tmp;
84 
85  A->evenOddLinOp(tmp, psi, PLUS);
86  psi[rb[0]] -= tmp;
87  }
88 
89  // Compute residual
90  {
91  T r;
92  A->unprecLinOp(r, psi, PLUS);
93  r -= chi;
94  res.resid = sqrt(norm2(r));
95  }
96 
97  END_CODE();
98 
99  return res;
100  }
101 
102  private:
103  // Hide default constructor
105 
108  };
109 
110 
111  typedef LatticeFermion LF;
112  typedef multi1d<LatticeColorMatrix> LCM;
113 
114 
115  template<>
118  const GroupXML_t& invParam) const
119  {
120  StopWatch swatch2;
121 
122  QDPIO::cout << " ... constructing linop " ;
123  swatch2.reset(); swatch2.start();
125  swatch2.stop();
126  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
127 
128 
129  QDPIO::cout << " ... constructing invLinOp " ;
130  swatch2.reset(); swatch2.start();
131  Handle< LinOpSystemSolver<LF> > ilh((*this).invLinOp(state,invParam));
132  swatch2.stop();
133  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
134 
135  QDPIO::cout << " ... constructing SymEvenOddPrecActQprop " ;
136  swatch2.reset(); swatch2.start();
138  swatch2.stop();
139  QDPIO::cout << " ..." << swatch2.getTimeInSeconds() << " sec" << std::endl;
140 
141  return ret_val;
142 
143 }
144 
145 } // namespace Chroma
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 symmetric even-odd preconditioned fermion linear operator.
SymEvenOddPrecActQprop(Handle< SymEvenOddPrecLinearOperator< T, P, Q > > A_, Handle< LinOpSystemSolver< T > > invA_)
Constructor.
Handle< LinOpSystemSolver< T > > invA
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
const Subset & subset() const
Return the subset on which the operator acts.
Handle< SymEvenOddPrecLinearOperator< T, P, Q > > A
~SymEvenOddPrecActQprop()
Destructor is automatic.
Even-odd preconditioned linear operator.
virtual SystemSolver< T > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return quark prop solver, solution of unpreconditioned system.
Linear system solvers.
Definition: syssolver.h:34
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
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
Symmetric even-odd preconditioned Wilson-like fermion actions.
Hold group xml and type id.
Holds return info from SystemSolver call.
Definition: syssolver.h:17