CHROMA
eoprec_ovlap_contfrac5d_linop_base_array_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Base class for Even-odd prec. 5D continued fraction linop
4  */
5 
6 #ifndef __prec_ovlap_contfrac5d_linop_base_array_w_h__
7 #define __prec_ovlap_contfrac5d_linop_base_array_w_h__
8 
10 #include "state.h"
11 #include "dslash_array_w.h"
12 
13 namespace Chroma
14 {
15  //! Base class Even-odd prec. 5D continued fraction linop
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  * The details of this operator are in some lattice proceedings
24  * by Joo,Kennedy,Wenger
25  */
26 
28  LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
29  {
30  public:
31  // Typedefs to save typing
32  typedef LatticeFermion T;
33  typedef multi1d<LatticeColorMatrix> P;
34  typedef multi1d<LatticeColorMatrix> Q;
35 
36  //! Full constructor
37  /*! Pretty darn the same as for the unprec case
38  except that the auxiliary linop M is no longer supplied,
39  but is created here
40  */
42  const Real& _m_q,
43  const Real& _OverMass,
44  int _N5,
45  const Real& _scale_fac,
46  const multi1d<Real>& _alpha,
47  const multi1d<Real>& _beta,
48  const bool _isLastZeroP );
49 
50 
51  //! Length of DW flavor index/space
52  int size() const {return N5;}
53 
54  //! Destructor is automatic
56 
57  //! Return the fermion BC object for this linear operator
58  const FermBC<T,P,Q>& getFermBC() const {return Dslash.getFermBC();}
59 
60  //! Only defined on the entire lattice
61  // INHERIT THIS?
62  // const Subset& subset() const {return all;}
63 
64  //! Apply the even-even block onto a source std::vector
65  inline
66  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
67  const multi1d<LatticeFermion>& psi,
68  enum PlusMinus isign) const
69  {
70  applyDiag(chi, psi, isign, 0);
71  }
72 
73  //! Apply the the odd-odd block onto a source std::vector
74  inline
75  void oddOddLinOp(multi1d<LatticeFermion>& chi,
76  const multi1d<LatticeFermion>& psi,
77  enum PlusMinus isign) const
78  {
79  applyDiag(chi, psi, isign, 1);
80  }
81 
82 
83  //! Apply the the even-odd block onto a source std::vector
84  void evenOddLinOp(multi1d<LatticeFermion>& chi,
85  const multi1d<LatticeFermion>& psi,
86  enum PlusMinus isign) const
87  {
88  applyOffDiag(chi, psi, isign, 0);
89  }
90 
91  //! Apply the the odd-even block onto a source std::vector
92  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
93  const multi1d<LatticeFermion>& psi,
94  enum PlusMinus isign) const
95  {
96  applyOffDiag(chi, psi, isign, 1);
97  }
98 
99  //! Apply the inverse of the even-even block onto a source std::vector
100  inline
101  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
102  const multi1d<LatticeFermion>& psi,
103  enum PlusMinus isign) const
104  {
105  applyDiagInv(chi, psi, isign, 0);
106  }
107 
108  //! Apply the inverse of the odd-odd block onto a source std::vector
109  inline
110  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
111  const multi1d<LatticeFermion>& psi,
112  enum PlusMinus isign) const
113  {
114  applyDiagInv(chi, psi, isign, 1);
115  }
116 
117  //! Apply the even-even block onto a source std::vector
118  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
119  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
120  enum PlusMinus isign) const
121  {
122  ds_u.resize(Nd);
123  ds_u = zero;
124  }
125 
126  //! Apply the the odd-odd block onto a source std::vector
127  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
128  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
129  enum PlusMinus isign) const
130  {
131  ds_u.resize(Nd);
132  ds_u = zero;
133  }
134 
135  //! Apply the the even-odd block onto a source std::vector
136  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
137  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
138  enum PlusMinus isign) const
139  {
140  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
141  }
142 
143  //! Apply the the odd-even block onto a source std::vector
144  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
145  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
146  enum PlusMinus isign) const
147  {
148  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
149  }
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()
183  + evenEvenInvNFlops()
184  + evenOddNFlops()
185  + oddOddNFlops()
186  + (2*Nc*Ns*N5*(Layout::sitesOnNode()/2));
187 
188  return flops;
189  }
190 
191  protected:
192 
193  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
194  /*!
195  * \param chi result (Modify)
196  * \param psi source (Read)
197  * \param isign Flag ( PLUS | MINUS ) (Read)
198  * \param cb checkerboard ( 0 | 1 ) (Read)
199  */
200  virtual
201  void applyDiag(multi1d<LatticeFermion>& chi,
202  const multi1d<LatticeFermion>& psi,
203  enum PlusMinus isign,
204  const int cb) const;
205 
206  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
207  /*!
208  * \param chi result (Modify)
209  * \param psi source (Read)
210  * \param isign Flag ( PLUS | MINUS ) (Read)
211  * \param cb checkerboard ( 0 | 1 ) (Read)
212  */
213  virtual
214  void applyDiagInv(multi1d<LatticeFermion>& chi,
215  const multi1d<LatticeFermion>& psi,
216  enum PlusMinus isign,
217  const int cb) const;
218 
219  //! Apply the off diagonal block
220  /*!
221  * \param chi result (Modify)
222  * \param psi source (Read)
223  * \param isign Flag ( PLUS | MINUS ) (Read)
224  * \param cb checkerboard ( 0 | 1 ) (Read)
225  */
226  virtual
227  void applyOffDiag(multi1d<LatticeFermion>& chi,
228  const multi1d<LatticeFermion>& psi,
229  enum PlusMinus isign,
230  const int cb) const;
231 
232  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
233  /*!
234  * \param ds_u conjugate momenta (Read)
235  * \param psi left pseudofermion field (Read)
236  * \param psi right pseudofermion field (Read)
237  * \param isign Flag ( PLUS | MINUS ) (Read)
238  * \param cb checkerboard ( 0 | 1 ) (Read)
239  */
240  virtual
241  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
242  const multi1d<LatticeFermion>& chi,
243  const multi1d<LatticeFermion>& psi,
244  enum PlusMinus isign,
245  int cb) const;
246 
247  //! Return flops performed by the diagonal part
248  unsigned long diagNFlops(void) const {
249  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns;
250  return cbsite_flops*(Layout::sitesOnNode()/2);
251  }
252 
253  //! Return flops performed by the diagonal part
254  unsigned long offDiagNFlops(void) const {
255  unsigned long cbsite_flops;
256  if( isLastZeroP ) {
257  cbsite_flops=N5-1;
258  }
259  else {
260  cbsite_flops=N5;
261  }
262  cbsite_flops *= (1320+2*Nc*Ns);
263  return cbsite_flops*(Layout::sitesOnNode()/2);
264  }
265 
266  //! Return flops performed by the diagonal part
267  unsigned long diagInvNFlops(void) const {
268  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns;
269  return cbsite_flops*(Layout::sitesOnNode()/2);
270  }
271 
272 
273  protected:
275  const Real m_q;
276  const Real OverMass;
277  const int N5; // Size of the 5th dimension
278  const Real scale_fac;
279  const multi1d<Real> alpha;
280  const multi1d<Real> beta;
281  const bool isLastZeroP;
282  multi1d<Real> beta_tilde; // The beta_tilde_i
283  multi1d<Real> a; // The a_i
284  multi1d<Real> invd; // The 1/d_i
285  multi1d<Real> u; // The u_i = l_i
286  multi1d<Real> off_diag_coeff; // -0.5*beta_tilde[i]
287  };
288 
289 } // End Namespace Chroma
290 
291 
292 #endif
Even-odd preconditioned linear operator including derivatives for arrays.
Base class Even-odd prec. 5D continued fraction linop.
unsigned long diagInvNFlops(void) const
Return flops performed by the diagonal part.
void oddOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
virtual void applyOffDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the off diagonal block.
unsigned long evenEvenInvNFlops(void) const
Return flops performed by the evenEvenInvLinOp.
unsigned long evenEvenNFlops(void) const
Return flops performed by the evenEvenLinOp.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
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 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 oddOddNFlops(void) const
Return flops performed by the oddOddLinOp.
EvenOddPrecOvlapContFrac5DLinOpBaseArray(Handle< FermState< T, P, Q > > state, const Real &_m_q, const Real &_OverMass, int _N5, const Real &_scale_fac, const multi1d< Real > &_alpha, const multi1d< Real > &_beta, const bool _isLastZeroP)
Full constructor.
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.
unsigned long nFlops() const
Return flops performed by the operator()
unsigned long diagNFlops(void) const
Return flops performed by the diagonal part.
unsigned long offDiagNFlops(void) const
Return flops performed by the diagonal part.
virtual 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 oddEvenNFlops(void) const
Return flops performed by the oddEvenLinOp.
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 evenOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-odd 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.
unsigned long evenOddNFlops(void) const
Return flops performed by the evenOddLinOp.
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.
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.
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.
virtual 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.
virtual 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
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
Support class for fermion actions and linear operators.