CHROMA
eoprec_nef_general_linop_array_w.h
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 /*! \file
4  * \brief 4D Even Odd preconditioned NEF domain-wall fermion linear operator
5  * generalised to take array of b_5 and c_5
6  */
7 
8 #ifndef __prec_nef_general_linop_array_w_h__
9 #define __prec_nef_general_linop_array_w_h__
10 
13 
14 
15 namespace Chroma
16 {
17  //! 4D Even Odd preconditioned NEF domain-wall Dirac operator
18  /*!
19  * \ingroup linop
20  *
21  * This routine is specific to Wilson fermions!
22  */
24  multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
25  {
26  public:
27  // Typedefs to save typing
28  typedef LatticeFermion T;
29  typedef multi1d<LatticeColorMatrix> P;
30  typedef multi1d<LatticeColorMatrix> Q;
31 
32  // ***** HACK *****
34  const Real& WilsonMass_,
35  const multi1d<Real>& b5_,
36  const multi1d<Real>& c5_,
37  const Real& m_q_,
38  int N5_)
39  {create(fs, WilsonMass_, m_q_, b5_, c5_, N5_);}
40  // ***** HACK *****
41 
42 
43 
44  /*!
45  Full constructor
46  Set b5 = 1.0 and c5=0.0 to get Shamir DWF with a5=1.
47  Set b5 = 1.0 and c5=1.0 to get Borichi DWF.
48  */
50  const Real& WilsonMass_,
51  const Real &b5_,
52  const Real &c5_,
53  const Real& m_q_,
54  int N5_)
55  {
56  multi1d<Real> b5_arr(N5_);
57  multi1d<Real> c5_arr(N5_);
58  for(int i=0; i < N5_; i++) {
59  b5_arr[i] = b5_;
60  c5_arr[i] = c5_;
61  }
62 
63  create(fs,WilsonMass_,m_q_, b5_arr, c5_arr, N5_);
64  }
65 
66  //! Creation routine
67  void create(Handle< FermState<T,P,Q> > fs,
68  const Real& WilsonMass_,
69  const Real& m_q_,
70  const multi1d<Real>& b5_,
71  const multi1d<Real>& c5_,
72  int N5_);
73 
74 
75  //! set b5 and c5 given kappa and a5
76  //void set_b5_c5(const Real &kappa_, const Real &a5_);
77 
78  //! Return the fermion BC object for this linear operator
79  const FermBC<T,P,Q>& getFermBC() const {return D.getFermBC();}
80 
81  //! Destructor is automatic
83 
84  //! Length of DW flavor index/space
85  int size() const {return N5;}
86 
87  //! Apply the even-even block onto a source std::vector
88  inline
89  void evenEvenLinOp(multi1d<LatticeFermion>& chi,
90  const multi1d<LatticeFermion>& psi,
91  enum PlusMinus isign) const
92  {
93  applyDiag(chi, psi, isign, 0);
94  }
95 
96  //! Apply the inverse of the even-even block onto a source std::vector
97  inline
98  void evenEvenInvLinOp(multi1d<LatticeFermion>& chi,
99  const multi1d<LatticeFermion>& psi,
100  enum PlusMinus isign) const
101  {
102  applyDiagInv(chi, psi, isign, 0);
103  }
104 
105  //! Apply the the even-odd block onto a source std::vector
106  void evenOddLinOp(multi1d<LatticeFermion>& chi,
107  const multi1d<LatticeFermion>& psi,
108  enum PlusMinus isign) const
109  {
110  applyOffDiag(chi, psi, isign, 0);
111  }
112 
113  //! Apply the the odd-even block onto a source std::vector
114  void oddEvenLinOp(multi1d<LatticeFermion>& chi,
115  const multi1d<LatticeFermion>& psi,
116  enum PlusMinus isign) const
117  {
118  applyOffDiag(chi, psi, isign, 1);
119  }
120 
121  //! Apply the the odd-odd block onto a source std::vector
122  inline
123  void oddOddLinOp(multi1d<LatticeFermion>& chi,
124  const multi1d<LatticeFermion>& psi,
125  enum PlusMinus isign) const
126  {
127  applyDiag(chi, psi, isign, 1);
128  }
129 
130  //! Apply the inverse of the odd-odd block onto a source std::vector
131  inline
132  void oddOddInvLinOp(multi1d<LatticeFermion>& chi,
133  const multi1d<LatticeFermion>& psi,
134  enum PlusMinus isign) const
135  {
136  applyDiagInv(chi, psi, isign, 1);
137  }
138 
139 
140  //! Apply the even-even block onto a source std::vector
141  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
142  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
143  enum PlusMinus isign) const
144  {
145  ds_u.resize(Nd);
146  ds_u = zero;
147  }
148 
149  //! Apply the the odd-odd block onto a source std::vector
150  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
151  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
152  enum PlusMinus isign) const
153  {
154  ds_u.resize(Nd);
155  ds_u = zero;
156  }
157 
158  //! Apply the the even-odd block onto a source std::vector
159  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
160  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
161  enum PlusMinus isign) const
162  {
163  applyDerivOffDiag(ds_u, chi, psi, isign, 0);
164  }
165 
166  //! Apply the the odd-even block onto a source std::vector
167  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
168  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
169  enum PlusMinus isign) const
170  {
171  applyDerivOffDiag(ds_u, chi, psi, isign, 1);
172  }
173 
174 
175  protected:
176 
177  //! Apply the even-even (odd-odd) coupling piece of the domain-wall fermion operator
178  /*!
179  * \param chi result (Modify)
180  * \param psi source (Read)
181  * \param isign Flag ( PLUS | MINUS ) (Read)
182  * \param cb checkerboard ( 0 | 1 ) (Read)
183  */
184  void applyDiag(multi1d<LatticeFermion>& chi,
185  const multi1d<LatticeFermion>& psi,
186  enum PlusMinus isign,
187  int cb) const;
188 
189  //! Apply the inverse even-even (odd-odd) coupling piece of the domain-wall fermion operator
190  /*!
191  * \param chi result (Modify)
192  * \param psi source (Read)
193  * \param isign Flag ( PLUS | MINUS ) (Read)
194  * \param cb checkerboard ( 0 | 1 ) (Read)
195  */
196  void applyDiagInv(multi1d<LatticeFermion>& chi,
197  const multi1d<LatticeFermion>& psi,
198  enum PlusMinus isign,
199  int cb) const;
200 
201 
202  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
203  /*!
204  * \ingroup linop
205  *
206  * The operator acts on the entire lattice
207  *
208  * \param psi Pseudofermion field (Read)
209  * \param isign Flag ( PLUS | MINUS ) (Read)
210  * \param cb checkerboard ( 0 | 1 ) (Read)
211  */
212  void applyOffDiag(multi1d<LatticeFermion>& chi,
213  const multi1d<LatticeFermion>& psi,
214  enum PlusMinus isign,
215  int cb) const ;
216 
217  //! Apply the Dminus operator on a lattice fermion. See my notes ;-)
218  void Dminus(LatticeFermion& chi,
219  const LatticeFermion& psi,
220  enum PlusMinus isign,
221  int s5) const;
222 
223 
224 
225  //! Apply the even-odd (odd-even) coupling piece of the NEF operator
226  /*!
227  * \param ds_u conjugate momenta (Read)
228  * \param psi left pseudofermion field (Read)
229  * \param psi right pseudofermion field (Read)
230  * \param isign Flag ( PLUS | MINUS ) (Read)
231  * \param cb checkerboard ( 0 | 1 ) (Read)
232  */
233  void applyDerivOffDiag(multi1d<LatticeColorMatrix>& ds_u,
234  const multi1d<LatticeFermion>& chi,
235  const multi1d<LatticeFermion>& psi,
236  enum PlusMinus isign,
237  int cb) const ;
238 
239  protected:
240  //! Partial constructor
242  //! Partial constructor
244 
245  private:
247  multi1d<Real> c5; // Nef Param Array
248  multi1d<Real> b5; // Nef Param Array
249  Real m_q;
250  int N5;
251 
252  // Derived quantities and constants
253  multi1d<Real> f_plus; // f_{+}[i] = b_5[i]*(Nd - WilsonMass) + 1;
254  multi1d<Real> f_minus; // f_{-}[i] = c_5[i]*(Nd - WilsonMass) - 1;
255 
256  multi1d<Real> l; // lowest row of L (left) array (N5-1 elems)
257  multi1d<Real> r; // rightmost col of R (right) array (N5-1 elems)
258 
259  multi1d<Real> a; // Subdiag elements of L'
260  // where L' is L in the LDU decomp of Tridiagonal
261  // T
262 
263  multi1d<Real> b; // Superdiag elements of U'
264  // where U' is U in LDU decomp of Tridiagonal
265  // T
266 
267  multi1d<Real> d; // Diag elems of D, where D is diagonal matrix
268  // in the LDU decomp of Tridiag T
269 
270 
272  };
273 
274 } // End Namespace Chroma
275 
276 
277 
278 #endif
4D Even Odd preconditioned domain-wall Dirac operator
4D Even Odd preconditioned NEF domain-wall Dirac operator
void Dminus(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign, int s5) const
Apply the Dminus operator on a lattice fermion. See my notes ;-)
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 operator=(const EvenOddPrecGenNEFDWLinOpArray &)
Partial constructor.
EvenOddPrecGenNEFDWLinOpArray(Handle< FermState< T, P, Q > > fs, const Real &WilsonMass_, const multi1d< Real > &b5_, const multi1d< Real > &c5_, const Real &m_q_, int N5_)
void evenEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the even-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 oddOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
const FermBC< T, P, Q > & getFermBC() const
set b5 and c5 given kappa and a5
EvenOddPrecGenNEFDWLinOpArray(Handle< FermState< T, P, Q > > fs, const Real &WilsonMass_, const Real &b5_, const Real &c5_, const Real &m_q_, int N5_)
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 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 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 oddEvenLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the odd-even 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.
void evenOddLinOp(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
int size() const
Length of DW flavor index/space.
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.
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.
void create(Handle< FermState< T, P, Q > > fs, const Real &WilsonMass_, const Real &m_q_, const multi1d< Real > &b5_, const multi1d< Real > &c5_, int N5_)
Creation routine.
void applyOffDiag(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 applyDiag(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, 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, 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
int i
Definition: pbg5p_w.cc:55
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
int cb
Definition: invbicg.cc:120
Double zero
Definition: invbicg.cc:106