CHROMA
fermact_qprop.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Propagator solver for a generic non-preconditioned fermion operator
3  *
4  * Solve for the propagator of a generic non-preconditioned fermion operator
5  */
6 
7 #include "fermact.h"
9 
10 
11 namespace Chroma
12 {
13  //! Propagator of a generic non-preconditioned fermion linear operator
14  /*! \ingroup qprop
15  *
16  * This routine is actually generic to all non-preconditioned (not red/black) fermions
17  *
18  * Compute the lattice fermion for a generic non-red/black fermion
19  * using the source in "chi" - so, the source can
20  * be of any desired form. The result will appear in "psi", which on input
21  * contains an initial guess for the solution.
22  */
23  template<typename T>
24  class FermActQprop : public SystemSolver<T>
25  {
26  public:
27  //! Constructor
28  /*!
29  * \param A_ Linear operator ( Read )
30  * \param invParam_ inverter parameters ( Read )
31  */
33  Handle< SystemSolver<T> > invA_) : A(A_), invA(invA_)
34  {}
35 
36  //! Destructor is automatic
38 
39  //! Return the subset on which the operator acts
40  const Subset& subset() const {return all;}
41 
42  //! Solver the linear system
43  /*!
44  * \param psi quark propagator ( Modify )
45  * \param chi source ( Read )
46  * \return number of CG iterations
47  */
49  {
50  START_CODE();
51 
52  // Call inverter
53  SystemSolverResults_t res = (*invA)(psi, chi);
54 
55  // Compute residual
56  {
57  T r;
58  (*A)(r, psi, PLUS);
59  r -= chi;
60  res.resid = sqrt(norm2(r));
61  }
62 
63  END_CODE();
64 
65  return res;
66  }
67 
68  private:
69  // Hide default constructor
71 
74  };
75 
76 
77  /*! \ingroup qprop */
78  template<>
80  FermAct4D<LatticeFermion,
81  multi1d<LatticeColorMatrix>,
82  multi1d<LatticeColorMatrix> >::qprop(Handle< FermState<LatticeFermion,
83  multi1d<LatticeColorMatrix>,
84  multi1d<LatticeColorMatrix> > > state,
85  const GroupXML_t& invParam) const
86  {
87  // Typedefs to save typing
88  typedef LatticeFermion T;
89 
90  return new FermActQprop<T>(linOp(state),
91  invLinOp(state,invParam));
92  }
93 
94 
95  /*! \ingroup qprop */
96  template<>
98  FermAct4D<LatticeStaggeredFermion,
99  multi1d<LatticeColorMatrix>,
100  multi1d<LatticeColorMatrix> >::qprop(Handle< FermState< LatticeStaggeredFermion,
101  multi1d<LatticeColorMatrix>,
102  multi1d<LatticeColorMatrix> > > state,
103  const GroupXML_t& invParam) const
104  {
105  // Typedefs to save typing
106  typedef LatticeStaggeredFermion T;
107 
108  return new FermActQprop<T>(linOp(state),
109  invLinOp(state,invParam));
110  }
111 
112 
113 } // namespace Chroma
114 
Base class for quadratic matter actions (e.g., fermions)
Definition: fermact.h:176
Propagator of a generic non-preconditioned fermion linear operator.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
Handle< LinearOperator< T > > A
const Subset & subset() const
Return the subset on which the operator acts.
FermActQprop(Handle< LinearOperator< T > > A_, Handle< SystemSolver< T > > invA_)
Constructor.
Handle< SystemSolver< T > > invA
~FermActQprop()
Destructor is automatic.
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
Class structure for fermion actions.
Conjugate-Gradient algorithm for a generic Linear Operator.
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
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