CHROMA
unprec_pdwf4d_linop_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned projected DWF operator to 4D using prec 5D bits
3  */
4 
5 #include "chromabase.h"
9 
10 
11 namespace Chroma
12 {
13 
14  // Apply unpreconditioned linear operator
15  template<>
16  void
17  UnprecPDWF4DLinOp<LatticeFermion,
18  multi1d<LatticeColorMatrix>,
19  multi1d<LatticeColorMatrix> >::operator()(LatticeFermion& chi,
20  const LatticeFermion& psi,
21  enum PlusMinus isign) const
22  {
23  START_CODE();
24 
25  const int N5 = size(); // array size better match
27 
28  // Initialize the 5D fields
29  multi1d<LatticeFermion> psi5(N5);
30  // psi5 = (psi,0,0,0,..,0)^T
31  psi5 = zero;
32  psi5[0] = psi;
33 
34  // tmp5 = P . psi5
35  multi1d<LatticeFermion> tmp5(N5);
36  DwfFld(tmp5, psi5, PLUS);
37 
38  multi1d<LatticeFermion> chi5(N5);
39 
40  switch(isign)
41  {
42  case PLUS:
43  {
44  // chi5 = D5(m_q) . tmp5 = D5(m_q) . P . (chi,0,0,..,0)^T
45  D->unprecLinOp(chi5, tmp5, PLUS);
46 
47  // Solve D5(1) . psi5 = chi5
48  psi5 = chi5;
49 
50 #if defined(HACK_USE_PREC)
51  /* Step (i) */
52  /* chi_tmp_o = chi_o - D_oe * A_ee^-1 * chi_e */
53  multi1d<LatticeFermion> chi_tmp(N5);
54  {
55  multi1d<LatticeFermion> tmp1(N5);
56  multi1d<LatticeFermion> tmp2(N5);
57 
58  PV->evenEvenInvLinOp(tmp1, chi5, PLUS);
59  PV->oddEvenLinOp(tmp2, tmp1, PLUS);
60  for(int n=0; n < N5; ++n)
61  chi_tmp[n][rb[1]] = chi5[n] - tmp2[n];
62  }
63 #else
64  multi1d<LatticeFermion> chi_tmp(N5);
65  chi_tmp = chi5;
66 #endif
67 
68 // case CG_INVERTER:
69  {
70  /* tmp5 = M_dag(u) * chi_tmp */
71  (*PV)(tmp5, chi_tmp, MINUS);
72 
73  /* psi5 = (M^dag * M)^(-1) chi_tmp */
74  res = InvCG2 (*PV, tmp5, psi5, invParam.RsdCG, invParam.MaxCG);
75  }
76 
77  #if defined(HACK_USE_PREC)
78  /* Step (ii) */
79  /* psi_e = A_ee^-1 * [chi_e - D_eo * psi_o] */
80  {
81  multi1d<LatticeFermion> tmp1(N5);
82  multi1d<LatticeFermion> tmp2(N5);
83 
84  PV->evenOddLinOp(tmp1, psi5, PLUS);
85  for(int n=0; n < N5; ++n)
86  tmp2[n][rb[0]] = chi5[n] - tmp1[n];
87  PV->evenEvenInvLinOp(psi5, tmp2, PLUS);
88  }
89  #endif
90  }
91  break;
92 
93  case MINUS:
94  {
95  // Solve D5(1) . psi5 = tmp5
96  psi5 = tmp5;
97 
98  // case CG_INVERTER:
99  {
100  /* psi5 = (M^dag * M)^(-1) tmp5 */
101  res = InvCG2(*PV, tmp5, psi5, invParam.RsdCG, invParam.MaxCG);
102 
103  /* tmp5 = M_dag(u) * psi5 */
104  (*PV)(tmp5, psi5, PLUS);
105  }
106 
107  // psi5 = D5(m_q)^dag . tmp5
108  D->unprecLinOp(psi5, tmp5, MINUS);
109  }
110  break;
111  }
112 
113  if ( res.n_count == invParam.MaxCG )
114  QDP_error_exit("no convergence in the inverter", res.n_count);
115 
116  // Project out first slice after chi <- chi5 <- P^(-1) . psi5
117  DwfFld(chi5, psi5, MINUS);
118  chi = chi5[0];
119 
120  END_CODE();
121  }
122 
123 }
Primary include file for CHROMA library code.
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.
unsigned n
Definition: ldumul_w.cc:36
Double tmp2
Definition: mesq.cc:30
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
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
Double zero
Definition: invbicg.cc:106
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Unpreconditioned projected DWF operator to 4D using prec 5D bits.