CHROMA
eoprec_ht_contfrac5d_linop_array_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator
4  */
5 
6 #ifndef __prec_ht_contfrac5d_linop_array_w_h__
7 #define __prec_ht_contfrac5d_linop_array_w_h__
8 
10 #include "state.h"
11 #include "dslash_array_w.h"
12 
13 namespace Chroma
14 {
15  //! Even odd preconditioned Continued Fraction with H=H_t (Shamir Kernel)
16  /*!
17  * \ingroup linop
18  *
19  * This operator applies the extended version of the hermitian overlap operator
20  * Chi = ((1+m_q)/(1-m_q)*gamma_5 + B) . Psi
21  * where B is the continued fraction of the pole approx. to eps(H(m))
22  *
23  * and H(m) is H_t = (2 + (b5-c5)H_w gamma_5 )^{-1} [ (b5+c5) H_w ]
24  *
25  * = (2 + (b5-c5) D^{dagger} )^{-1} [ (b5+c5) g5 D_w ]
26  *
27  */
28 
30  multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
31  {
32  public:
33  // Typedefs to save typing
34  typedef LatticeFermion T;
35  typedef multi1d<LatticeColorMatrix> P;
36  typedef multi1d<LatticeColorMatrix> Q;
37 
38  //! Full constructor
39  /*! Pretty darn the same as for the unprec case
40  except that the auxiliary linop M is no longer supplied,
41  but is created here
42  */
44  const Real& _m_q,
45  const Real& _OverMass,
46  int _N5,
47  const Real& _scale_fac,
48  const multi1d<Real>& _alpha,
49  const multi1d<Real>& _beta,
50  const Real& _b5,
51  const Real& _c5,
52  const bool _isLastZeroP );
53 
54 
55  //! Length of DW flavor index/space
56  int size() const {return N5;}
57 
58  //! Destructor is automatic
60 
61  //! Only defined on the entire lattice
62  // INHERIT THIS?
63  // const Subset& subset() const {return all;}
64 
65  //! Apply the even-even block onto a source std::vector
66  inline
67  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
68  const multi1d<LatticeFermion>& psi,
69  enum PlusMinus isign) const
70  {
71  applyDiag(chi, psi, isign, 0);
72  }
73 
74  //! Apply the the odd-odd block onto a source std::vector
75  inline
76  void oddOddLinOp(multi1d<LatticeFermion>& chi,
77  const multi1d<LatticeFermion>& psi,
78  enum PlusMinus isign) const
79  {
80  applyDiag(chi, psi, isign, 1);
81  }
82 
83 
84  //! Apply the the even-odd block onto a source std::vector
85  void evenOddLinOp(multi1d<LatticeFermion>& chi,
86  const multi1d<LatticeFermion>& psi,
87  enum PlusMinus isign) const
88  {
89  applyOffDiag(chi, psi, isign, 0);
90  }
91 
92  //! Apply the the odd-even block onto a source std::vector
93  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
94  const multi1d<LatticeFermion>& psi,
95  enum PlusMinus isign) const
96  {
97  applyOffDiag(chi, psi, isign, 1);
98  }
99 
100  //! Apply the inverse of the even-even block onto a source std::vector
101  inline
102  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
103  const multi1d<LatticeFermion>& psi,
104  enum PlusMinus isign) const
105  {
106  applyDiagInv(chi, psi, isign, 0);
107  }
108 
109  //! Apply the inverse of the odd-odd block onto a source std::vector
110  inline
111  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
112  const multi1d<LatticeFermion>& psi,
113  enum PlusMinus isign) const
114  {
115  applyDiagInv(chi, psi, isign, 1);
116  }
117 
118  //! Apply the even-even block onto a source std::vector
119  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
120  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
121  enum PlusMinus isign) const
122  {
123  ds_u.resize(Nd);
124  ds_u = zero;
125  }
126 
127  //! Apply the the odd-odd block onto a source std::vector
128  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
129  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
130  enum PlusMinus isign) const
131  {
132  ds_u.resize(Nd);
133  ds_u = zero;
134  }
135 
136  //! Apply the the even-odd block onto a source std::vector
137  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
138  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
139  enum PlusMinus isign) const
140  {
141  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
142  }
143 
144  //! Apply the the odd-even block onto a source std::vector
145  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
146  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
147  enum PlusMinus isign) const
148  {
149  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
150  }
151 
152  //! Return flops performed by the evenEvenLinOp
153  unsigned long evenEvenNFlops(void) const {
154  return diagNFlops();
155  }
156 
157  //! Return flops performed by the oddOddLinOp
158  unsigned long oddOddNFlops(void) const {
159  return diagNFlops();
160  }
161 
162  //! Return flops performed by the evenOddLinOp
163  unsigned long evenOddNFlops(void) const {
164  return offDiagNFlops();
165  }
166 
167  //! Return flops performed by the oddEvenLinOp
168  unsigned long oddEvenNFlops(void) const {
169  return offDiagNFlops();
170  }
171 
172  //! Return flops performed by the evenEvenInvLinOp
173  unsigned long evenEvenInvNFlops(void) const {
174  return diagInvNFlops();
175  }
176 
177  //! Return flops performed by the operator()
178  unsigned long nFlops() const {
179  // Flopcount is the oddEven EvenEvenInv evenOdd
180  // the oddOdd
181  // and the subtraction OddOdd - ( )
182  unsigned long flops=oddEvenNFlops() + evenEvenInvNFlops() + evenOddNFlops() + oddOddNFlops() + (2*Nc*Ns*N5*(Layout::sitesOnNode()/2));
183 
184  return flops;
185  }
186  protected:
187 
188  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
189  /*!
190  * \param chi result (Modify)
191  * \param psi source (Read)
192  * \param isign Flag ( PLUS | MINUS ) (Read)
193  * \param cb checkerboard ( 0 | 1 ) (Read)
194  */
195  void applyDiag(multi1d<LatticeFermion>& chi,
196  const multi1d<LatticeFermion>& psi,
197  enum PlusMinus isign,
198  const int cb) const;
199 
200  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
201  /*!
202  * \param chi result (Modify)
203  * \param psi source (Read)
204  * \param isign Flag ( PLUS | MINUS ) (Read)
205  * \param cb checkerboard ( 0 | 1 ) (Read)
206  */
207  void applyDiagInv(multi1d<LatticeFermion>& chi,
208  const multi1d<LatticeFermion>& psi,
209  enum PlusMinus isign,
210  const int cb) const;
211 
212  //! Apply the off diagonal block
213  /*!
214  * \param chi result (Modify)
215  * \param psi source (Read)
216  * \param isign Flag ( PLUS | MINUS ) (Read)
217  * \param cb checkerboard ( 0 | 1 ) (Read)
218  */
219  void applyOffDiag(multi1d<LatticeFermion>& chi,
220  const multi1d<LatticeFermion>& psi,
221  enum PlusMinus isign,
222  const int cb) const;
223 
224  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
225  /*!
226  * \param ds_u conjugate momenta (Read)
227  * \param psi left pseudofermion field (Read)
228  * \param psi right pseudofermion field (Read)
229  * \param isign Flag ( PLUS | MINUS ) (Read)
230  * \param cb checkerboard ( 0 | 1 ) (Read)
231  */
232  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
233  const multi1d<LatticeFermion>& chi,
234  const multi1d<LatticeFermion>& psi,
235  enum PlusMinus isign,
236  int cb) const;
237 
238  //! Return flops performed by the diagonal part
239  unsigned long diagNFlops(void) const {
240  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns;
241  return cbsite_flops*(Layout::sitesOnNode()/2);
242  }
243 
244  //! Return flops performed by the diagonal part
245  unsigned long offDiagNFlops(void) const {
246  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns + N5*1320;
247  return cbsite_flops*(Layout::sitesOnNode()/2);
248  }
249 
250  //! Return flops performed by the diagonal part
251  unsigned long diagInvNFlops(void) const {
252  unsigned long cbsite_flops = (10*N5-14)*Nc*Ns;
253  return cbsite_flops*(Layout::sitesOnNode()/2);
254  }
255 
256  //! Return the fermion BC object for this linear operator
257  const FermBC<T,P,Q>& getFermBC() const {return Dslash.getFermBC();}
258 
259  protected:
260  //! Hide partial constructor
261 // EvenOddPrecHtContFrac5DLinOpArray() {}
262  //! Hide =
264 
265  private:
267  const Real m_q;
268  const Real OverMass;
269  const int N5; // Size of the 5th dimension
270  const Real scale_fac;
271  const multi1d<Real> alpha;
272  const multi1d<Real> beta;
273  const bool isLastZeroP;
274  multi1d<Real> beta_tilde; // The beta_tilde_i
275  multi1d<Real> alpha_tilde; // The alpha_tilde_i
276 
277  multi1d<Real> a; // The a_i
278  multi1d<Real> d; // The d_i
279  multi1d<Real> u; // The u_i = l_i
280  multi1d<Real> invd;
281  const Real b5;
282  const Real c5;
283  Real f_plus;
284  Real f_minus;
285 
286  };
287 
288 } // End Namespace Chroma
289 
290 
291 #endif
Even-odd preconditioned linear operator including derivatives for arrays.
Even odd preconditioned Continued Fraction with H=H_t (Shamir Kernel)
unsigned long oddEvenNFlops(void) const
Return flops performed by the oddEvenLinOp.
unsigned long evenEvenNFlops(void) const
Return flops performed by the evenEvenLinOp.
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.
EvenOddPrecHtContFrac5DLinOpArray(Handle< FermState< T, P, Q > > fs, const Real &_m_q, const Real &_OverMass, int _N5, const Real &_scale_fac, const multi1d< Real > &_alpha, const multi1d< Real > &_beta, const Real &_b5, const Real &_c5, const bool _isLastZeroP)
Full constructor.
unsigned long diagInvNFlops(void) const
Return flops performed by the diagonal part.
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 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.
unsigned long oddOddNFlops(void) const
Return flops performed by the oddOddLinOp.
int size() const
Length of DW flavor index/space.
void oddOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
void operator=(const EvenOddPrecHtContFrac5DLinOpArray &)
Hide partial constructor.
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 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.
unsigned long evenOddNFlops(void) const
Return flops performed by the evenOddLinOp.
void applyOffDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the off diagonal block.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
unsigned long offDiagNFlops(void) const
Return flops performed by the diagonal part.
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 evenEvenInvNFlops(void) const
Return flops performed by the evenEvenInvLinOp.
void evenOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
unsigned long diagNFlops(void) const
Return flops performed by the diagonal part.
unsigned long nFlops() const
Return flops performed by the operator()
void oddEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
void evenEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Only defined on the entire lattice.
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.
Preconditioned 4D Linop with Gauge Independent Even-Even part.
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
Support class for fermion actions and linear operators.