CHROMA
eoprec_ovext_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_ovext_linop_array_w_h__
7 #define __prec_ovext_linop_array_w_h__
8 
9 #include "handle.h"
10 #include "eoprec_constdet_linop.h"
13 
14 using namespace QDP;
15 
16 namespace Chroma
17 {
18  //! EvenOddPreconditioned Extended-Overlap (N&N) linear operator
19  /*!
20  * \ingroup linop
21  *
22  * This operator applies the extended version of the hermitian overlap operator
23  * Chi = ((1+m_q)/(1-m_q)*gamma_5 + B) . Psi
24  * where B is the continued fraction of the pole approx. to eps(H(m))
25  *
26  * This operator implements hep-lat/0005004
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
40  const int Npoles_,
41  const Real& coeffP_,
42  const multi1d<Real>& resP_,
43  const multi1d<Real>& rootQ_,
44  const multi1d<Real>& beta_,
45  const Real& OverMass_,
46  const Real& Mass_,
47  const Real& b5_,
48  const Real& c5_)
49  {create(fs,Npoles_, coeffP_, resP_, rootQ_, beta_,
50  OverMass_,Mass_,b5_,c5_);}
51 
52  //! Creation routine
53  void create(Handle< FermState<T,P,Q> > fs,
54  const int Npoles_,
55  const Real& coeffP_,
56  const multi1d<Real>& resP_,
57  const multi1d<Real>& rootQ_,
58  const multi1d<Real>& beta_,
59  const Real& OverMass_,
60  const Real& m_q_,
61  const Real& b5_,
62  const Real& c5_);
63 
64  //! Length of DW flavor index/space
65  int size() const {return N5;}
66 
67  //! Destructor is automatic
69 
70  //! Return the fermion BC object for this linear operator
71  const FermBC<T,P,Q>& getFermBC() const {return Dslash.getFermBC();}
72 
73  inline
74  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
75  const multi1d<LatticeFermion>& psi,
76  enum PlusMinus isign) const
77  {
78  applyDiag(chi, psi, isign, 0);
79  }
80 
81  //! Apply the the odd-odd block onto a source std::vector
82  inline
83  void oddOddLinOp(multi1d<LatticeFermion>& chi,
84  const multi1d<LatticeFermion>& psi,
85  enum PlusMinus isign) const
86  {
87  applyDiag(chi, psi, isign, 1);
88  }
89 
90  //! Apply the the even-odd block onto a source std::vector
91  void evenOddLinOp(multi1d<LatticeFermion>& chi,
92  const multi1d<LatticeFermion>& psi,
93  enum PlusMinus isign) const
94  {
95  applyOffDiag(chi, psi, isign, 0);
96  }
97 
98  //! Apply the the odd-even block onto a source std::vector
99  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
100  const multi1d<LatticeFermion>& psi,
101  enum PlusMinus isign) const
102  {
103  applyOffDiag(chi, psi, isign, 1);
104  }
105 
106  //! Apply the inverse of the odd-odd block onto a source std::vector
107  inline
108  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
109  const multi1d<LatticeFermion>& psi,
110  enum PlusMinus isign) const
111  {
112  applyDiagInv(chi, psi, isign, 0);
113  }
114 
115  //! Apply the inverse of the odd-odd block onto a source std::vector
116  inline
117  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
118  const multi1d<LatticeFermion>& psi,
119  enum PlusMinus isign) const
120  {
121  applyDiagInv(chi, psi, isign, 1);
122  }
123 
124 
125  //! Apply the even-even block onto a source std::vector
126  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
127  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
128  enum PlusMinus isign) const
129  {
130  ds_u.resize(Nd);
131  ds_u = zero;
132  }
133 
134 
135 
136  //! Apply the the odd-odd block onto a source std::vector
137  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
138  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
139  enum PlusMinus isign) const
140  {
141  ds_u.resize(Nd);
142  ds_u = zero;
143  }
144 
145  //! Apply the the even-odd block onto a source std::vector
146  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
147  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
148  enum PlusMinus isign) const
149  {
150  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
151  }
152 
153  //! Apply the the odd-even block onto a source std::vector
154  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
155  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
156  enum PlusMinus isign) const
157  {
158  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
159  }
160 
161 
162  //! Return flops performed by the evenEvenLinOp
163  unsigned long evenEvenNFlops(void) const {
164  return diagNFlops();
165  }
166 
167  //! Return flops performed by the oddOddLinOp
168  unsigned long oddOddNFlops(void) const {
169  return diagNFlops();
170  }
171 
172  //! Return flops performed by the evenOddLinOp
173  unsigned long evenOddNFlops(void) const {
174  return offDiagNFlops();
175  }
176 
177  //! Return flops performed by the oddEvenLinOp
178  unsigned long oddEvenNFlops(void) const {
179  return offDiagNFlops();
180  }
181 
182  //! Return flops performed by the evenEvenInvLinOp
183  unsigned long evenEvenInvNFlops(void) const {
184  return diagInvNFlops();
185  }
186 
187  //! Return flops performed by the operator()
188  unsigned long nFlops() const {
189  // Flopcount is the oddEven EvenEvenInv evenOdd
190  // the oddOdd
191  // and the subtraction OddOdd - ( )
192  unsigned long flops=oddEvenNFlops() + evenEvenInvNFlops() + evenOddNFlops() + oddOddNFlops() + (2*Nc*Ns*N5*(Layout::sitesOnNode()/2));
193 
194  return flops;
195  }
196  protected:
197 
198  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
199  /*!
200  * \param chi result (Modify)
201  * \param psi source (Read)
202  * \param isign Flag ( PLUS | MINUS ) (Read)
203  * \param cb checkerboard ( 0 | 1 ) (Read)
204  */
205  void applyDiag(multi1d<LatticeFermion>& chi,
206  const multi1d<LatticeFermion>& psi,
207  enum PlusMinus isign,
208  const int cb) const;
209 
210  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
211  /*!
212  * \param chi result (Modify)
213  * \param psi source (Read)
214  * \param isign Flag ( PLUS | MINUS ) (Read)
215  * \param cb checkerboard ( 0 | 1 ) (Read)
216  */
217  void applyDiagInv(multi1d<LatticeFermion>& chi,
218  const multi1d<LatticeFermion>& psi,
219  enum PlusMinus isign,
220  const int cb) const;
221 
222 
223  //! Apply the off diagonal block
224  /*!
225  * \param chi result (Modify)
226  * \param psi source (Read)
227  * \param isign Flag ( PLUS | MINUS ) (Read)
228  * \param cb checkerboard ( 0 | 1 ) (Read)
229  */
230  void applyOffDiag(multi1d<LatticeFermion>& chi,
231  const multi1d<LatticeFermion>& psi,
232  enum PlusMinus isign,
233  const int cb) const;
234 
235  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
236  /*!
237  * \param ds_u conjugate momenta (Read)
238  * \param psi left pseudofermion field (Read)
239  * \param psi right pseudofermion field (Read)
240  * \param isign Flag ( PLUS | MINUS ) (Read)
241  * \param cb checkerboard ( 0 | 1 ) (Read)
242  */
243  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
244  const multi1d<LatticeFermion>& chi,
245  const multi1d<LatticeFermion>& psi,
246  enum PlusMinus isign,
247  int cb) const;
248 
249  //! Return flops performed by the diagonal part
250  unsigned long diagNFlops(void) const {
251  unsigned long cbsite_flops = (10*N5-8)*Nc*Ns;
252  return cbsite_flops*(Layout::sitesOnNode()/2);
253  }
254 
255  //! Return flops performed by the off diagonal part
256  unsigned long offDiagNFlops(void) const {
257  unsigned long cbsite_flops = N5*1320+(10*N5-8)*Nc*Ns;
258  return cbsite_flops*(Layout::sitesOnNode()/2);
259  }
260 
261  //! Return flops performed by the diag inv part
262  unsigned long diagInvNFlops(void) const {
263  unsigned long cbsite_flops = (15*N5-13)*Nc*Ns;
264  return cbsite_flops*(Layout::sitesOnNode()/2);
265  }
266 
267  protected:
268  //! Partial constructor
270  //! Hide =
272 
273  private:
274  int Npoles;
275  int N5;
276 
277  // Needed for applying Even-Even
278 // Real QQ; // (Nd-m)
279  Real A; // -alpha Q
280  multi1d<Real> B; // B_p = sqrt(q_p beta_p) [ 2 + a5 Q ];
281  multi1d<Real> D; // D_p = sqrt(p_p beta_p) [ 2 + a5 Q ];
282  multi1d<Real> C; // C_p = alpha beta_p Q
283  Real E; // (2R + (Ra5 + alpha p0)Q)
285 
286  // Needed for applying Off Diag
287  Real Aprime; // -alpha/2
288  Real Eprime; // -(1/2)( Ra5 + p0 alpha )
289  multi1d<Real> Bprime; // -(1/2) a5 sqrt( q_p beta_p )
290  multi1d<Real> Dprime; // -(1/2) a5 sqrt( p_p beta_p )
291  multi1d<Real> Cprime; // -alpha beta_p / 2
292 
293  // Needed for applying diagInv
294  multi1d<Real> Atilde; // (1/det(Block_p) * A )
295  multi1d<Real> Btilde; // (1/det(Block_p) * B )
296  multi1d<Real> Ctilde; // (1/det(Block_p) * C )
297  multi1d<Real> D_bd_inv; // [ 0, D_N,...,0,D_0 ] Block Diag Inv
298  Real S; // Schur's complement: E + sum_p D_p^2 A tilde_p
299  };
300 
301 } // End Namespace Chroma
302 
303 
304 #endif
Even-odd preconditioned linear operator including derivatives for arrays.
EvenOddPreconditioned Extended-Overlap (N&N) linear 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 oddEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
~EvenOddPrecOvExtLinOpArray()
Destructor is automatic.
void evenEvenInvLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the inverse of the odd-odd block onto a source std::vector.
EvenOddPrecOvExtLinOpArray(Handle< FermState< T, P, Q > > fs, const int Npoles_, const Real &coeffP_, const multi1d< Real > &resP_, const multi1d< Real > &rootQ_, const multi1d< Real > &beta_, const Real &OverMass_, const Real &Mass_, const Real &b5_, const Real &c5_)
Full constructor.
void operator=(const EvenOddPrecOvExtLinOpArray &)
Hide =.
unsigned long offDiagNFlops(void) const
Return flops performed by the off 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.
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.
unsigned long evenEvenNFlops(void) const
Return flops performed by the evenEvenLinOp.
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.
unsigned long evenOddNFlops(void) const
Return flops performed by the evenOddLinOp.
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 oddEvenNFlops(void) const
Return flops performed by the oddEvenLinOp.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
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 diagNFlops(void) const
Return flops performed by the diagonal part.
int size() const
Length of DW flavor index/space.
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.
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 diagInvNFlops(void) const
Return flops performed by the diag inv part.
unsigned long evenEvenInvNFlops(void) const
Return flops performed by the evenEvenInvLinOp.
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.
Include possibly optimized Wilson dslash.
Include possibly optimized Wilson dslash.
Preconditioned 4D Linop with Gauge Independent Even-Even part.
Class for counted reference semantics.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191