CHROMA
eoprec_dwf_linop_array_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief 4D Even Odd preconditioned domain-wall fermion linear operator
4  */
5 
6 #ifndef __prec_dwf_linop_array_w_h__
7 #define __prec_dwf_linop_array_w_h__
8 
9 #include "eoprec_linop.h"
12 #include "io/aniso_io.h"
13 
14 namespace Chroma
15 {
16  //! 4D Even Odd preconditioned domain-wall Dirac operator
17  /*!
18  * \ingroup linop
19  *
20  * This routine is specific to Wilson fermions!
21  */
23  multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
24  {
25  public:
26  // Typedefs to save typing
27  typedef LatticeFermion T;
28  typedef multi1d<LatticeColorMatrix> P;
29  typedef multi1d<LatticeColorMatrix> Q;
30 
31  //! Full constructor
33  const Real& WilsonMass_, const Real& m_q, int N5_,
34  const AnisoParam_t& aniso_);
35 
36  //! Destructor is automatic
38 
39  //! Return the fermion BC object for this linear operator
40  const FermBC<T,P,Q>& getFermBC() const {return D.getFermBC();}
41 
42  //! Length of DW flavor index/space
43  int size() const {return N5;}
44 
45  //! Apply the even-even block onto a source std::vector
46  inline
47  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
48  const multi1d<LatticeFermion>& psi,
49  enum PlusMinus isign) const
50  {
51  applyDiag(chi, psi, isign, 0);
52  }
53 
54  //! Apply the inverse of the even-even block onto a source std::vector
55  inline
56  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
57  const multi1d<LatticeFermion>& psi,
58  enum PlusMinus isign) const
59  {
60  applyDiagInv(chi, psi, isign, 0);
61  }
62 
63  //! Apply the the even-odd block onto a source std::vector
64  void evenOddLinOp(multi1d<LatticeFermion>& chi,
65  const multi1d<LatticeFermion>& psi,
66  enum PlusMinus isign) const
67  {
68  applyOffDiag(chi, psi, isign, 0);
69  }
70 
71  //! Apply the the odd-even block onto a source std::vector
72  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
73  const multi1d<LatticeFermion>& psi,
74  enum PlusMinus isign) const
75  {
76  applyOffDiag(chi, psi, isign, 1);
77  }
78 
79  //! Apply the the odd-odd block onto a source std::vector
80  inline
81  void oddOddLinOp(multi1d<LatticeFermion>& chi,
82  const multi1d<LatticeFermion>& psi,
83  enum PlusMinus isign) const
84  {
85  applyDiag(chi, psi, isign, 1);
86  }
87 
88  //! Apply the inverse of the odd-odd block onto a source std::vector
89  inline
90  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
91  const multi1d<LatticeFermion>& psi,
92  enum PlusMinus isign) const
93  {
94  applyDiagInv(chi, psi, isign, 1);
95  }
96 
97 
98  //! Apply the Dminus operator on a lattice fermion.
99  void Dminus(LatticeFermion& chi,
100  const LatticeFermion& psi,
101  enum PlusMinus isign,
102  int s5) const;
103 
104 
105  //! Apply the even-even block onto a source std::vector
106  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
107  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
108  enum PlusMinus isign) const
109  {
110  ds_u.resize(Nd);
111  ds_u = zero;
112  }
113 
114  //! Apply the the odd-odd block onto a source std::vector
115  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
116  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
117  enum PlusMinus isign) const
118  {
119  ds_u.resize(Nd);
120  ds_u = zero;
121  }
122 
123  //! Apply the the even-odd block onto a source std::vector
124  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
125  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
126  enum PlusMinus isign) const
127  {
128  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
129  }
130 
131  //! Apply the the odd-even block onto a source std::vector
132  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
133  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
134  enum PlusMinus isign) const
135  {
136  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
137  }
138 
139 
140  //! Return flops performed by the evenEvenLinOp
141  unsigned long evenEvenNFlops(void) const {
142  return diagNFlops();
143  }
144 
145  //! Return flops performed by the oddOddLinOp
146  unsigned long oddOddNFlops(void) const {
147  return diagNFlops();
148  }
149 
150  //! Return flops performed by the evenOddLinOp
151  unsigned long evenOddNFlops(void) const {
152  return offDiagNFlops();
153  }
154 
155  //! Return flops performed by the oddEvenLinOp
156  unsigned long oddEvenNFlops(void) const {
157  return offDiagNFlops();
158  }
159 
160  //! Return flops performed by the evenEvenInvLinOp
161  unsigned long evenEvenInvNFlops(void) const {
162  return diagInvNFlops();
163  }
164 
165  //! Return flops performed by the operator()
166  unsigned long nFlops() const {
167  // Flopcount is the oddEven EvenEvenInv evenOdd
168  // the oddOdd
169  // and the subtraction OddOdd - ( )
170  unsigned long flops=oddEvenNFlops() + evenEvenInvNFlops() + evenOddNFlops() + oddOddNFlops() + (2*Nc*Ns*N5*(Layout::sitesOnNode()/2));
171 
172  return flops;
173  }
174  protected:
175  //! Partial constructor
177 
178 
179  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
180  /*!
181  * \param chi result (Modify)
182  * \param psi source (Read)
183  * \param isign Flag ( PLUS | MINUS ) (Read)
184  * \param cb checkerboard ( 0 | 1 ) (Read)
185  */
186  void applyDiag(multi1d<LatticeFermion>& chi,
187  const multi1d<LatticeFermion>& psi,
188  enum PlusMinus isign,
189  const int cb) const;
190 
191  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
192  /*!
193  * \param chi result (Modify)
194  * \param psi source (Read)
195  * \param isign Flag ( PLUS | MINUS ) (Read)
196  * \param cb checkerboard ( 0 | 1 ) (Read)
197  */
198  void applyDiagInv(multi1d<LatticeFermion>& chi,
199  const multi1d<LatticeFermion>& psi,
200  enum PlusMinus isign,
201  const int cb) const;
202 
203  //! Apply the off diagonal block
204  /*!
205  * \param chi result (Modify)
206  * \param psi source (Read)
207  * \param isign Flag ( PLUS | MINUS ) (Read)
208  * \param cb checkerboard ( 0 | 1 ) (Read)
209  */
210  void applyOffDiag(multi1d<LatticeFermion>& chi,
211  const multi1d<LatticeFermion>& psi,
212  enum PlusMinus isign,
213  const int cb) const;
214 
215  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
216  /*!
217  * \param ds_u conjugate momenta (Read)
218  * \param psi left pseudofermion field (Read)
219  * \param psi right pseudofermion field (Read)
220  * \param isign Flag ( PLUS | MINUS ) (Read)
221  * \param cb checkerboard ( 0 | 1 ) (Read)
222  */
223  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
224  const multi1d<LatticeFermion>& chi,
225  const multi1d<LatticeFermion>& psi,
226  enum PlusMinus isign,
227  int cb) const;
228 
229 
230  //! Return flops performed by the diagonal part
231  unsigned long diagNFlops(void) const {
232  unsigned long cbsite_flops = (4*N5+2)*Nc*Ns;
233  return cbsite_flops*(Layout::sitesOnNode()/2);
234  }
235 
236  //! Return flops performed by the diagonal part
237  unsigned long offDiagNFlops(void) const {
238  unsigned long cbsite_flops = N5*(1320+2*Nc*Ns);
239  return cbsite_flops*(Layout::sitesOnNode()/2);
240  }
241 
242  //! Return flops performed by the diagonal part
243  unsigned long diagInvNFlops(void) const {
244  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns;
245  return cbsite_flops*(Layout::sitesOnNode()/2);
246  }
247 
248  private:
250  Real m_q;
251  Real a5;
252  int N5;
253 
254  Real InvTwoKappa ;
255  Real TwoKappa ;
256  Real Kappa;
257  Real invDfactor ;
258 
260  };
261 
262 
263 } // End Namespace Chroma
264 
265 
266 #endif
Anisotropy parameters.
4D Even Odd preconditioned domain-wall Dirac operator
4D Even Odd preconditioned domain-wall Dirac operator
unsigned long oddOddNFlops(void) const
Return flops performed by the oddOddLinOp.
void derivOddOddLinOp(multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
void oddOddInvLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the inverse of the odd-odd block onto a source std::vector.
void oddOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
unsigned long diagInvNFlops(void) const
Return flops performed by the diagonal part.
void applyOffDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the off diagonal block.
void derivEvenEvenLinOp(multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the even-even block onto a source std::vector.
void evenEvenInvLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the inverse of the even-even block onto a source std::vector.
multi1d< LatticeColorMatrix > P
int size() const
Length of DW flavor index/space.
unsigned long nFlops() const
Return flops performed by the operator()
void evenEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the even-even block onto a source std::vector.
~EvenOddPrecDWLinOpArray()
Destructor is automatic.
unsigned long oddEvenNFlops(void) const
Return flops performed by the oddEvenLinOp.
unsigned long offDiagNFlops(void) const
Return flops performed by the diagonal part.
void oddEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
unsigned long diagNFlops(void) const
Return flops performed by the diagonal part.
void evenOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
void Dminus(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign, int s5) const
Apply the Dminus operator on a lattice fermion.
multi1d< LatticeColorMatrix > Q
unsigned long evenEvenInvNFlops(void) const
Return flops performed by the evenEvenInvLinOp.
void applyDerivOffDiag(multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, int cb) const
Apply the even-odd (odd-even) coupling piece of the NEF operator.
void derivEvenOddLinOp(multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
void derivOddEvenLinOp(multi1d< LatticeColorMatrix > &ds_u, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
unsigned long evenEvenNFlops(void) const
Return flops performed by the evenEvenLinOp.
unsigned long evenOddNFlops(void) const
Return flops performed by the evenOddLinOp.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
General Wilson-Dirac dslash of arrays.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Include possibly optimized Wilson dslash.
Base class for even-odd preconditioned domain-wall-like linops.
Base class for even-odd preconditioned 4D and 5D Linop.
void applyDiagInv(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator.
void applyDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106
Parameters for anisotropy.
Definition: aniso_io.h:24