CHROMA
eoprec_ovlap_contfrac5d_pv_linop_array_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Even-odd preconditioned Pauli-Villars Continued Fraction 5D
4  */
5 
6 #ifndef __prec_ovlap_contfrac5d_pv_linop_array_w_h__
7 #define __prec_ovlap_contfrac5d_pv_linop_array_w_h__
8 
10 #include "state.h"
11 #include "dslash_array_w.h"
12 
13 namespace Chroma
14 {
15  //! Even-odd preconditioned Pauli-Villars Continued Fraction 5D
16  /*!
17  * \ingroup linop
18  *
19  * Even-odd precond. Pauli-Villars Cont. Frac. linop
20  */
21 
23  LatticeFermion, 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
32  /*! Pretty darn the same as for the unprec case
33  except that the auxiliary linop M is no longer supplied,
34  but is created here
35  */
37  const Real& _m_q,
38  const Real& _OverMass,
39  int _N5,
40  const Real& _scale_fac,
41  const multi1d<Real>& _alpha,
42  const multi1d<Real>& _beta,
43  const bool _isLastZeroP );
44 
45 
46  //! Length of DW flavor index/space
47  int size() const {return N5;}
48 
49  //! Destructor is automatic
51 
52  //! Return the fermion BC object for this linear operator
53  const FermBC<T,P,Q>& getFermBC() const {return Dslash.getFermBC();}
54 
55  //! Apply the even-even block onto a source std::vector
56  inline
57  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
58  const multi1d<LatticeFermion>& psi,
59  enum PlusMinus isign) const
60  {
61  applyDiag(chi, psi, isign, 0);
62  }
63 
64  //! Apply the the odd-odd block onto a source std::vector
65  inline
66  void oddOddLinOp(multi1d<LatticeFermion>& chi,
67  const multi1d<LatticeFermion>& psi,
68  enum PlusMinus isign) const
69  {
70  applyDiag(chi, psi, isign, 1);
71  }
72 
73 
74  //! Apply the the even-odd block onto a source std::vector
75  void evenOddLinOp(multi1d<LatticeFermion>& chi,
76  const multi1d<LatticeFermion>& psi,
77  enum PlusMinus isign) const
78  {
79  applyOffDiag(chi, psi, isign, 0);
80  }
81 
82  //! Apply the the odd-even block onto a source std::vector
83  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
84  const multi1d<LatticeFermion>& psi,
85  enum PlusMinus isign) const
86  {
87  applyOffDiag(chi, psi, isign, 1);
88  }
89 
90  //! Apply the inverse of the even-even block onto a source std::vector
91  inline
92  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
93  const multi1d<LatticeFermion>& psi,
94  enum PlusMinus isign) const
95  {
96  applyDiagInv(chi, psi, isign, 0);
97  }
98 
99  //! Apply the inverse of the odd-odd block onto a source std::vector
100  inline
101  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
102  const multi1d<LatticeFermion>& psi,
103  enum PlusMinus isign) const
104  {
105  applyDiagInv(chi, psi, isign, 1);
106  }
107 
108  //! Apply the even-even block onto a source std::vector
109  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
110  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
111  enum PlusMinus isign) const
112  {
113  ds_u.resize(Nd);
114  ds_u = zero;
115  }
116 
117  //! Apply the the odd-odd block onto a source std::vector
118  void derivOddOddLinOp(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 even-odd block onto a source std::vector
127  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
128  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
129  enum PlusMinus isign) const
130  {
131  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
132  }
133 
134  //! Apply the the odd-even block onto a source std::vector
135  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
136  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
137  enum PlusMinus isign) const
138  {
139  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
140  }
141 
142 
143  //! Return flops performed by the evenEvenLinOp
144  unsigned long evenEvenNFlops(void) const {
145  return diagNFlops();
146  }
147 
148  //! Return flops performed by the oddOddLinOp
149  unsigned long oddOddNFlops(void) const {
150  return diagNFlops();
151  }
152 
153  //! Return flops performed by the evenOddLinOp
154  unsigned long evenOddNFlops(void) const {
155  return offDiagNFlops();
156  }
157 
158  //! Return flops performed by the oddEvenLinOp
159  unsigned long oddEvenNFlops(void) const {
160  return offDiagNFlops();
161  }
162 
163  //! Return flops performed by the evenEvenInvLinOp
164  unsigned long evenEvenInvNFlops(void) const {
165  return diagInvNFlops();
166  }
167 
168  //! Return flops performed by the operator()
169  unsigned long nFlops() const {
170  // Flopcount is the oddEven EvenEvenInv evenOdd
171  // the oddOdd
172  // and the subtraction OddOdd - ( )
173  unsigned long flops=oddEvenNFlops()
174  + evenEvenInvNFlops()
175  + evenOddNFlops()
176  + oddOddNFlops()
177  + (2*Nc*Ns*N5*(Layout::sitesOnNode()/2));
178 
179  return flops;
180  }
181 
182  protected:
183 
184  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
185  /*!
186  * \param chi result (Modify)
187  * \param psi source (Read)
188  * \param isign Flag ( PLUS | MINUS ) (Read)
189  * \param cb checkerboard ( 0 | 1 ) (Read)
190  */
191  void applyDiag(multi1d<LatticeFermion>& chi,
192  const multi1d<LatticeFermion>& psi,
193  enum PlusMinus isign,
194  const int cb) const;
195 
196  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
197  /*!
198  * \param chi result (Modify)
199  * \param psi source (Read)
200  * \param isign Flag ( PLUS | MINUS ) (Read)
201  * \param cb checkerboard ( 0 | 1 ) (Read)
202  */
203  void applyDiagInv(multi1d<LatticeFermion>& chi,
204  const multi1d<LatticeFermion>& psi,
205  enum PlusMinus isign,
206  const int cb) const;
207 
208  //! Apply the off diagonal block
209  /*!
210  * \param chi result (Modify)
211  * \param psi source (Read)
212  * \param isign Flag ( PLUS | MINUS ) (Read)
213  * \param cb checkerboard ( 0 | 1 ) (Read)
214  */
215  void applyOffDiag(multi1d<LatticeFermion>& chi,
216  const multi1d<LatticeFermion>& psi,
217  enum PlusMinus isign,
218  const int cb) const;
219 
220  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
221  /*!
222  * \param ds_u conjugate momenta (Read)
223  * \param psi left pseudofermion field (Read)
224  * \param psi right pseudofermion field (Read)
225  * \param isign Flag ( PLUS | MINUS ) (Read)
226  * \param cb checkerboard ( 0 | 1 ) (Read)
227  */
228  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
229  const multi1d<LatticeFermion>& chi,
230  const multi1d<LatticeFermion>& psi,
231  enum PlusMinus isign,
232  int cb) const;
233 
234  //! Return flops performed by the diagonal part
235  unsigned long diagNFlops(void) const {
236  unsigned long cbsite_flops = (10*N5-18)*Nc*Ns;
237  return cbsite_flops*(Layout::sitesOnNode()/2);
238  }
239 
240  //! Return flops performed by the diagonal part
241  unsigned long offDiagNFlops(void) const {
242  unsigned long cbsite_flops;
243  cbsite_flops = (N5-1)*(1320+2*Nc*Ns);
244  return cbsite_flops*(Layout::sitesOnNode()/2);
245  }
246 
247  //! Return flops performed by the diagonal part
248  unsigned long diagInvNFlops(void) const {
249  unsigned long cbsite_flops = (10*N5-18)*Nc*Ns;
250  return cbsite_flops*(Layout::sitesOnNode()/2);
251  }
252 
253  protected:
254  //! Hide partial constructor
255 // EvenOddPrecOvlapContFrac5DPVLinOpArray() {}
256  //! Hide partial constructor
258 
259  private:
260  WilsonDslashArray Dslash; // Dslash Op
261  const Real m_q;
262  const Real OverMass;
263  const int N5; // Size of the 5th dimension
264  const Real scale_fac;
265  const multi1d<Real> alpha;
266  const multi1d<Real> beta;
267  const bool isLastZeroP;
268  multi1d<Real> beta_tilde; // The beta_tilde_i
269  multi1d<Real> a; // The a_i
270  multi1d<Real> dinv; // The d_i
271  multi1d<Real> u; // The u_i = l_i
272  multi1d<Real> off_diag_coeff;
273  };
274 
275 } // End Namespace Chroma
276 
277 
278 #endif
Even-odd preconditioned linear operator including derivatives for arrays.
Even-odd preconditioned Pauli-Villars Continued Fraction 5D.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
void evenEvenLinOp(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()
void applyOffDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, const int cb) const
Apply the off diagonal block.
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.
unsigned long oddOddNFlops(void) const
Return flops performed by the oddOddLinOp.
unsigned long evenEvenInvNFlops(void) const
Return flops performed by the evenEvenInvLinOp.
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 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 evenOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-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.
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 diagInvNFlops(void) const
Return flops performed by the diagonal part.
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 oddEvenNFlops(void) const
Return flops performed by the oddEvenLinOp.
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 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.
EvenOddPrecOvlapContFrac5DPVLinOpArray(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 operator=(const EvenOddPrecOvlapContFrac5DPVLinOpArray &)
Hide partial constructor.
unsigned long diagNFlops(void) const
Return flops performed by the diagonal part.
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 evenEvenNFlops(void) const
Return flops performed by the evenEvenLinOp.
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 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.
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.
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.