CHROMA
lwldslash_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson Dslash linear operator array
3  */
4 
5 #include "chromabase.h"
7 
8 
9 namespace Chroma
10 {
11  //! General Wilson-Dirac dslash of arrays
12  /*! \ingroup linop
13  * DSLASH
14  *
15  * This routine is specific to Wilson fermions!
16  *
17  * Description:
18  *
19  * This routine applies the operator D' to Psi, putting the result in Chi.
20  *
21  * Nd-1
22  * ---
23  * \
24  * chi(x) := > U (x) (1 - isign gamma ) psi(x+mu)
25  * / mu mu
26  * ---
27  * mu=0
28  *
29  * Nd-1
30  * ---
31  * \ +
32  * + > U (x-mu) (1 + isign gamma ) psi(x-mu)
33  * / mu mu
34  * ---
35  * mu=0
36  *
37  */
38 
39 
40  //! Creation routine
42  {
43  multi1d<Real> cf(Nd);
44  cf = 1.0;
45  create(state, N5_, cf);
46  }
47 
48 
49  //! Creation routine with anisotropy
51  const AnisoParam_t& anisoParam)
52  {
53  START_CODE();
54 
55  create(state, N5_, makeFermCoeffs(anisoParam));
56 
57  END_CODE();
58  }
59 
60  //! Creation routine
62  const multi1d<Real>& coeffs_)
63  {
64  START_CODE();
65 
66  N5 = N5_;
67  coeffs = coeffs_;
68 
69  // Save a copy of the fermbc
70  fbc = state->getFermBC();
71 
72  // Sanity check
73  if (fbc.operator->() == 0)
74  {
75  QDPIO::cerr << "WilsonDslashArray: error: fbc is null" << std::endl;
76  QDP_abort(1);
77  }
78 
79  // Get links
80  u = state->getLinks();
81 
82  // Rescale the u fields by the anisotropy
83  for(int mu=0; mu < u.size(); ++mu)
84  {
85  u[mu] *= coeffs[mu];
86  }
87 
88  END_CODE();
89  }
90 
91 
92  //! General Wilson-Dirac dslash
93  /*! \ingroup linop
94  * Wilson dslash
95  *
96  * Arguments:
97  *
98  * \param chi Result (Write)
99  * \param psi Pseudofermion field (Read)
100  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
101  * \param cb Checkerboard of OUTPUT std::vector (Read)
102  */
103  void
104  QDPWilsonDslashArray::apply (multi1d<LatticeFermion>& chi,
105  const multi1d<LatticeFermion>& psi,
106  enum PlusMinus isign, int cb) const
107  {
108  START_CODE();
109 
110  if( chi.size() != N5 ) chi.resize(N5);
111 
112  for(int n=0; n < N5; ++n)
113  apply(chi[n], psi[n], isign, cb);
114 
115  END_CODE();
116  }
117 
118 
119 
120  //! General Wilson-Dirac dslash
121  /*! \ingroup linop
122  * Wilson dslash
123  *
124  * Arguments:
125  *
126  * \param chi Result (Write)
127  * \param psi Pseudofermion field (Read)
128  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
129  * \param cb Checkerboard of OUTPUT std::vector (Read)
130  */
131  void
132  QDPWilsonDslashArray::apply (LatticeFermion& chi, const LatticeFermion& psi,
133  enum PlusMinus isign, int cb) const
134  {
135  START_CODE();
136 #if QDP_NC == 3
137  /* F
138  * a2 (x) := U (x) (1 - isign gamma ) psi(x)
139  * mu mu mu
140  */
141  /* B +
142  * a2 (x) := U (x-mu) (1 + isign gamma ) psi(x-mu)
143  * mu mu mu
144  */
145  // Recontruct the bottom two spinor components from the top two
146  /* F B
147  * chi(x) := sum_mu a2 (x) + a2 (x)
148  * mu mu
149  */
150 
151  /* Why are these lines split? An array syntax would help, but the problem is deeper.
152  * The expression templates require NO variable args (like int's) to a function
153  * and all args must be known at compile time. Hence, the function names carry
154  * (as functions usually do) the meaning (and implicit args) to a function.
155  */
156  switch (isign)
157  {
158  case PLUS:
159  chi[rb[cb]] = spinReconstructDir0Minus(u[0] * shift(spinProjectDir0Minus(psi), FORWARD, 0))
160  + spinReconstructDir0Plus(shift(adj(u[0]) * spinProjectDir0Plus(psi), BACKWARD, 0))
161 #if QDP_ND >= 2
162  + spinReconstructDir1Minus(u[1] * shift(spinProjectDir1Minus(psi), FORWARD, 1))
163  + spinReconstructDir1Plus(shift(adj(u[1]) * spinProjectDir1Plus(psi), BACKWARD, 1))
164 #endif
165 #if QDP_ND >= 3
166  + spinReconstructDir2Minus(u[2] * shift(spinProjectDir2Minus(psi), FORWARD, 2))
167  + spinReconstructDir2Plus(shift(adj(u[2]) * spinProjectDir2Plus(psi), BACKWARD, 2))
168 #endif
169 #if QDP_ND >= 4
170  + spinReconstructDir3Minus(u[3] * shift(spinProjectDir3Minus(psi), FORWARD, 3))
171  + spinReconstructDir3Plus(shift(adj(u[3]) * spinProjectDir3Plus(psi), BACKWARD, 3))
172 #endif
173 #if QDP_ND >= 5
174 #error "Unsupported number of dimensions"
175 #endif
176  ;
177  break;
178 
179  case MINUS:
180  chi[rb[cb]] = spinReconstructDir0Plus(u[0] * shift(spinProjectDir0Plus(psi), FORWARD, 0))
181  + spinReconstructDir0Minus(shift(adj(u[0]) * spinProjectDir0Minus(psi), BACKWARD, 0))
182 #if QDP_ND >= 2
183  + spinReconstructDir1Plus(u[1] * shift(spinProjectDir1Plus(psi), FORWARD, 1))
184  + spinReconstructDir1Minus(shift(adj(u[1]) * spinProjectDir1Minus(psi), BACKWARD, 1))
185 #endif
186 #if QDP_ND >= 3
187  + spinReconstructDir2Plus(u[2] * shift(spinProjectDir2Plus(psi), FORWARD, 2))
188  + spinReconstructDir2Minus(shift(adj(u[2]) * spinProjectDir2Minus(psi), BACKWARD, 2))
189 #endif
190 #if QDP_ND >= 4
191  + spinReconstructDir3Plus(u[3] * shift(spinProjectDir3Plus(psi), FORWARD, 3))
192  + spinReconstructDir3Minus(shift(adj(u[3]) * spinProjectDir3Minus(psi), BACKWARD, 3))
193 #endif
194 #if QDP_ND >= 5
195 #error "Unsupported number of dimensions"
196 #endif
197  ;
198  break;
199 
200  }
201 
202  getFermBC().modifyF(chi, QDP::rb[cb]);
203 #else
204  QDPIO::cerr<<"lwldslash_array_w: not implemented for NC!=3\n";
205  QDP_abort(13) ;
206 #endif
207 
208  END_CODE();
209  }
210 
211 } // End Namespace Chroma
212 
Primary include file for CHROMA library code.
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Handle< FermBC< T, P, Q > > fbc
multi1d< LatticeColorMatrix > u
int mu
Definition: cool.cc:24
void apply(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, int cb) const
General Wilson-Dirac dslash.
void create(Handle< FermState< T, P, Q > > state, int N5_)
Creation routine.
unsigned n
Definition: ldumul_w.cc:36
Wilson Dslash linear operator over arrays.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ 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
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
multi1d< Real > makeFermCoeffs(const AnisoParam_t &aniso)
Make fermion coefficients.
Definition: aniso_io.cc:63
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Parameters for anisotropy.
Definition: aniso_io.h:24