CHROMA
unprec_dwf4d_linop_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned projected DWF operator to 4D
3  */
4 
5 #include "chromabase.h"
9 
10 using namespace QDP::Hints;
11 
12 namespace Chroma
13 {
14 
15  // Apply unpreconditioned linear operator
16  template<>
17  void
19  const LatticeFermion& psi,
20  enum PlusMinus isign) const
21  {
22  START_CODE();
23 
25  const int N5 = size(); // array size better match
26 
27  // Initialize the 5D fields
28  multi1d<LatticeFermion> psi5(N5); moveToFastMemoryHint(psi5);
29  // psi5 = (psi,0,0,0,..,0)^T
30  psi5 = zero;
31  psi5[0] = psi;
32 
33  // tmp5 = P . psi5
34  multi1d<LatticeFermion> tmp5(N5); moveToFastMemoryHint(tmp5);
35  DwfFld(tmp5, psi5, PLUS);
36 
37  multi1d<LatticeFermion> chi5(N5); moveToFastMemoryHint(chi5);
38 
39  switch(isign)
40  {
41  case PLUS:
42  {
43  // chi5 = D5(m_q) . tmp5 = D5(m_q) . P . (chi,0,0,..,0)^T
44  (*D)(chi5, tmp5, PLUS);
45 
46  // Solve D5(1) . psi5 = chi5
47  psi5 = chi5;
48 
49 // case CG_INVERTER:
50  {
51  /* tmp5 = M_dag(u) * chi5 */
52  (*PV)(tmp5, chi5, MINUS);
53 
54  /* psi5 = (M^dag * M)^(-1) chi5 */
55  res = InvCG2(*PV, tmp5, psi5, invParam.RsdCG, invParam.MaxCG);
56  }
57  }
58  break;
59 
60  case MINUS:
61  {
62  // Solve D5(1) . psi5 = tmp5
63  psi5 = tmp5;
64 
65 // case CG_INVERTER:
66  {
67  /* psi5 = (M^dag * M)^(-1) tmp5 */
68  res = InvCG2(*PV, tmp5, psi5, invParam.RsdCG, invParam.MaxCG);
69 
70  /* tmp5 = M_dag(u) * psi5 */
71  (*PV)(tmp5, psi5, PLUS);
72  }
73 
74  // psi5 = D5(m_q)^dag . tmp5
75  (*D)(psi5, tmp5, MINUS);
76 
77  }
78  break;
79 
80  default:
81  QDP_error_exit("dwf4d: unknown isign");
82  }
83 
84  if ( res.n_count == invParam.MaxCG )
85  QDP_error_exit("no convergence in the inverter", res.n_count);
86 
87  // Project out first slice after chi <- chi5 <- P^(-1) . psi5
88  DwfFld(chi5, psi5, MINUS);
89  chi = chi5[0];
90 
91  END_CODE();
92  }
93 
94 }
Primary include file for CHROMA library code.
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
DWF parity/rotation operator.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Definition: invcg2.cc:240
void DwfFld(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign)
DWF parity/rotation operator.
Definition: dwffld_w.cc:24
Conjugate-Gradient algorithm for a generic Linear Operator.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
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)
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
Double zero
Definition: invbicg.cc:106
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Unpreconditioned projected DWF operator to 4D.