CHROMA
fermact_qprop_array.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 namespace Chroma
11 {
12  /*! \ingroup qprop
13  *
14  * This routine is actually generic to all non-preconditioned (not red/black) fermions
15  *
16  * Compute the lattice fermion for a generic non-red/black fermion
17  * using the source in "chi" - so, the source can
18  * be of any desired form. The result will appear in "psi", which on input
19  * contains an initial guess for the solution.
20  */
21  template<typename T>
23  {
24  public:
25  //! Constructor
26  /*!
27  * \param A_ Linear operator ( Read )
28  * \param invParam_ inverter parameters ( Read )
29  */
31  Handle< LinOpSystemSolverArray<T> > invA_) : A(A_), invA(invA_)
32  {}
33 
34  //! Destructor is automatic
36 
37  //! Expected length of array index
38  int size() const {return A->size();}
39 
40  //! Return the subset on which the operator acts
41  const Subset& subset() const {return all;}
42 
43  //! Solver the linear system
44  /*!
45  * \param psi quark propagator ( Modify )
46  * \param chi source ( Read )
47  * \return number of CG iterations
48  */
49  SystemSolverResults_t operator() (multi1d<T>& psi, const multi1d<T>& chi) const
50  {
51  START_CODE();
52 
53  if (psi.size() != size() && chi.size() != size())
54  QDP_error_exit("FA5DQprop: sizes wrong");
55 
56  // Call inverter
57  SystemSolverResults_t res = (*invA)(psi, chi);
58 
59  // Compute residual
60  {
61  multi1d<T> r(size());
62  (*A)(r, psi, PLUS);
63  r -= chi;
64  res.resid = sqrt(norm2(r));
65  }
66 
67  END_CODE();
68 
69  return res;
70  }
71 
72  private:
73  // Hide default constructor
75 
78  };
79 
80 
81  template<>
83  FermAct5D<LatticeFermion,
84  multi1d<LatticeColorMatrix>,
85  multi1d<LatticeColorMatrix> >::qpropT(Handle< FermState< LatticeFermion,
86  multi1d<LatticeColorMatrix>,
87  multi1d<LatticeColorMatrix> > > state,
88  const GroupXML_t& invParam) const
89  {
90  return new FermAct5DQprop<LatticeFermion>(linOp(state),
91  invLinOp(state,invParam));
92  }
93 
94 } // Namespace Chroma
const Subset & subset() const
Return the subset on which the operator acts.
int size() const
Expected length of array index.
FermAct5DQprop(Handle< LinearOperatorArray< T > > A_, Handle< LinOpSystemSolverArray< T > > invA_)
Constructor.
Handle< LinOpSystemSolverArray< T > > invA
SystemSolverResults_t operator()(multi1d< T > &psi, const multi1d< T > &chi) const
Solver the linear system.
~FermAct5DQprop()
Destructor is automatic.
Handle< LinearOperatorArray< T > > A
Base class of quadratic matter actions (e.g., fermions) living in an extra dimension.
Definition: fermact.h:265
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
SystemSolver disambiguator.
Linear Operator to arrays.
Definition: linearop.h:61
Linear system solvers of arrays.
Definition: syssolver.h:62
Class structure for fermion actions.
Conjugate-Gradient algorithm for a generic Linear Operator.
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)
@ 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