CHROMA
lwldslash_base_3d_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson Dslash linear operator
3  */
4 
5 #include "chromabase.h"
7 #include "io/aniso_io.h"
8 
9 #if QDP_NS == 4
10 #if QDP_NC == 3
11 #if QDP_ND == 4
12 
13 namespace Chroma
14 {
15 
16 
17  //! Take deriv of D
18  /*!
19  * \param chi left std::vector (Read)
20  * \param psi right std::vector (Read)
21  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
22  *
23  * \return Computes \f$\chi^\dag * \dot(D} * \psi\f$
24  */
25  void
26  WilsonDslash3DBase::deriv(multi1d<LatticeColorMatrix>& ds_u,
27  const LatticeFermion& chi, const LatticeFermion& psi,
28  enum PlusMinus isign) const
29  {
30  START_CODE();
31 
32  ds_u.resize(Nd);
33 
34  multi1d<LatticeColorMatrix> ds_tmp(Nd);
35  deriv(ds_u, chi, psi, isign, 0);
36  deriv(ds_tmp, chi, psi, isign, 1);
37  ds_u += ds_tmp;
38 
39  END_CODE();
40  }
41 
42 
43  //! Take deriv of D
44  /*! \return Computes \f$\chi^\dag * \dot(D} * \psi\f$ */
45  void
46  WilsonDslash3DBase::deriv(multi1d<LatticeColorMatrix>& ds_u,
47  const LatticeFermion& chi, const LatticeFermion& psi,
48  enum PlusMinus isign, int cb) const
49  {
50  START_CODE();
51 
52  ds_u.resize(Nd);
53  ds_u[3] = zero;
54 
55  const multi1d<Real>& anisoWeights = getCoeffs();
56 
57  for(int mu = 0; mu < 3; ++mu)
58  {
59  // Break this up to use fewer expressions:
60  LatticeFermion temp_ferm1;
61  LatticeHalfFermion tmp_h;
62 
63  switch (isign) {
64 
65  case PLUS:
66  // Undaggered: Minus Projectors
67  {
68  switch(mu) {
69  case 0:
70  tmp_h[rb3[1-cb]] = spinProjectDir0Minus(psi);
71  temp_ferm1[rb3[1-cb]] = spinReconstructDir0Minus(tmp_h);
72  break;
73  case 1:
74  tmp_h[rb3[1-cb]] = spinProjectDir1Minus(psi);
75  temp_ferm1[rb3[1-cb]] = spinReconstructDir1Minus(tmp_h);
76  break;
77  case 2:
78  tmp_h[rb3[1-cb]] = spinProjectDir2Minus(psi);
79  temp_ferm1[rb3[1-cb]] = spinReconstructDir2Minus(tmp_h);
80  break;
81  default:
82  break;
83  };
84 
85  }
86  break;
87 
88  case MINUS:
89  {
90  // Daggered: Plus Projectors
91  LatticeHalfFermion tmp_h;
92  switch(mu) {
93  case 0:
94  tmp_h[rb3[1-cb]] = spinProjectDir0Plus(psi);
95  temp_ferm1[rb3[1-cb]] = spinReconstructDir0Plus(tmp_h);
96  break;
97  case 1:
98  tmp_h[rb3[1-cb]] = spinProjectDir1Plus(psi);
99  temp_ferm1[rb3[1-cb]] = spinReconstructDir1Plus(tmp_h);
100  break;
101  case 2:
102  tmp_h[rb3[1-cb]] = spinProjectDir2Plus(psi);
103  temp_ferm1[rb3[1-cb]] = spinReconstructDir2Plus(tmp_h);
104  break;
105  default:
106  break;
107  };
108  }
109  break;
110  default:
111  QDP_error_exit("unknown case");
112  }
113 
114  // QDP Shifts the whole darn thing anyhow
115  LatticeFermion temp_ferm2 = shift(temp_ferm1, FORWARD, mu);
116  LatticeColorMatrix temp_mat;
117 
118  // This step supposedly optimised in QDP++
119  temp_mat[rb3[cb]] = traceSpin(outerProduct(temp_ferm2,chi));
120 
121  // Just do the bit we need.
122  ds_u[mu][rb3[cb]] = anisoWeights[mu] * temp_mat;
123  ds_u[mu][rb3[1-cb]] = zero;
124  }
125 
126  // Remaining directions?
127 
128 
129  getFermBC().zero(ds_u);
130 
131  END_CODE();
132  }
133 
134 
135  //! Return flops performed by the operator()
136  unsigned long
137  WilsonDslash3DBase::nFlops() const {return 990;}
138 
139 } // End Namespace Chroma
140 
141 
142 #endif // QDP_ND
143 #endif // QDP_NC
144 #endif // QDP_NS
Anisotropy parameters.
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
3D Wilson Dslash linear operator
Nd
Definition: meslate.cc:74
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()
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106
#define FORWARD
Definition: primitives.h:82
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.