CHROMA
eoprec_wilson_linop_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Even-odd preconditioned Wilson fermion linear operator
4  */
5 
6 #ifndef __eoprec_wilson_linop_w_h__
7 #define __eoprec_wilson_linop_w_h__
8 
11 #include "io/aniso_io.h"
12 
13 
14 namespace Chroma
15 {
16  //! Even-odd preconditioned Wilson-Dirac operator
17  /*!
18  * \ingroup linop
19  *
20  * This routine is specific to Wilson fermions!
21  *
22  * The kernel for Wilson fermions is
23  *
24  * M = (d+M) - (1/2) D'
25  */
26 
28  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  //! Partial constructor
38 
39  //! Full constructor
41  const Real& Mass_)
42  {create(fs,Mass_);}
43 
44  //! Full constructor with Anisotropy
46  const Real& Mass_,
47  const AnisoParam_t& aniso)
48  {create(fs,Mass_,aniso);}
49 
50  //! Full constructor with array of coefficients
52  const Real& Mass_,
53  const multi1d<Real>& coeffs_)
54  {create(fs,Mass_,coeffs_);}
55 
56  //! Destructor is automatic
58 
59  //! Return the fermion BC object for this linear operator
60  const FermBC<T,P,Q>& getFermBC() const {return D.getFermBC();}
61 
62  //! Creation routine
63  void create(Handle< FermState<T,P,Q> > fs,
64  const Real& Mass_);
65 
66  //! Creation routine with Anisotropy
67  void create(Handle< FermState<T,P,Q> > fs,
68  const Real& Mass_,
69  const AnisoParam_t& aniso);
70 
71  //! Creation routine with general coefficients
72  void create(Handle< FermState<T,P,Q> > fs,
73  const Real& Mass_,
74  const multi1d<Real>& coeffs_);
75 
76  //! Apply the the even-even block onto a source std::vector
77  inline
78  void evenEvenLinOp(LatticeFermion& chi, const LatticeFermion& psi,
79  enum PlusMinus isign) const
80  {
81  chi[rb[0]] = fact*psi;
82  }
83 
84  //! Apply the inverse of the even-even block onto a source std::vector
85  inline
86  void evenEvenInvLinOp(LatticeFermion& chi, const LatticeFermion& psi,
87  enum PlusMinus isign) const
88  {
89  chi[rb[0]] = invfact*psi;
90  }
91 
92  //! Apply the the even-odd block onto a source std::vector
93  void evenOddLinOp(LatticeFermion& chi, const LatticeFermion& psi,
94  enum PlusMinus isign) const;
95 
96  //! Apply the the odd-even block onto a source std::vector
97  void oddEvenLinOp(LatticeFermion& chi, const LatticeFermion& psi,
98  enum PlusMinus isign) const;
99 
100  //! Apply the the odd-odd block onto a source std::vector
101  inline
102  void oddOddLinOp(LatticeFermion& chi, const LatticeFermion& psi,
103  enum PlusMinus isign) const
104  {
105  chi[rb[1]] = fact*psi;
106  }
107 
108  //! Override inherited one with a few more funkies
109  void operator()(LatticeFermion& chi, const LatticeFermion& psi,
110  enum PlusMinus isign) const;
111 
112 
113  //! Apply the even-even block onto a source std::vector
114  void derivEvenEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
115  const LatticeFermion& chi, const LatticeFermion& psi,
116  enum PlusMinus isign) const
117  {
118  ds_u.resize(Nd);
119  for(int mu=0; mu < Nd; mu++) {
120  ds_u[mu] = zero;
121  }
122  }
123 
124  //! Apply the the even-odd block onto a source std::vector
125  void derivEvenOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
126  const LatticeFermion& chi, const LatticeFermion& psi,
127  enum PlusMinus isign) const;
128 
129  //! Apply the the odd-even block onto a source std::vector
130  void derivOddEvenLinOp(multi1d<LatticeColorMatrix>& ds_u,
131  const LatticeFermion& chi, const LatticeFermion& psi,
132  enum PlusMinus isign) const;
133 
134  //! Apply the the odd-odd block onto a source std::vector
135  void derivOddOddLinOp(multi1d<LatticeColorMatrix>& ds_u,
136  const LatticeFermion& chi, const LatticeFermion& psi,
137  enum PlusMinus isign) const
138  {
139  ds_u.resize(Nd);
140  for(int mu=0; mu < Nd; mu++) {
141  ds_u[mu] = zero;
142  }
143  }
144 
145 
146  //! Return flops performed by the operator()
147  unsigned long nFlops() const;
148 
149  private:
150  Real Mass; /*!< yep, the mass */
151  multi1d<Real> coeffs; /*!< Nd array of coefficients of terms in the action */
152 
153  Real fact; /*<! tmp holding Nd+Mass */
154  Real invfact; /*!< tmp holding 1/(Nd+Mass) */
155 
156  WilsonDslash D; /*!< Wilson dslash term */
157  };
158 
159 } // End Namespace Chroma
160 
161 
162 #endif
Anisotropy parameters.
Even-odd preconditioned linear operator.
Even-odd preconditioned Wilson-Dirac operator.
EvenOddPrecWilsonLinOp(Handle< FermState< T, P, Q > > fs, const Real &Mass_, const AnisoParam_t &aniso)
Full constructor with Anisotropy.
unsigned long nFlops() const
Return flops performed by the operator()
multi1d< LatticeColorMatrix > Q
void derivEvenEvenLinOp(multi1d< LatticeColorMatrix > &ds_u, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the even-even block onto a source std::vector.
void derivOddOddLinOp(multi1d< LatticeColorMatrix > &ds_u, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
void derivEvenOddLinOp(multi1d< LatticeColorMatrix > &ds_u, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
multi1d< LatticeColorMatrix > P
void evenEvenInvLinOp(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the inverse of the even-even block onto a source std::vector.
~EvenOddPrecWilsonLinOp()
Destructor is automatic.
void oddOddLinOp(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the odd-odd block onto a source std::vector.
void oddEvenLinOp(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
EvenOddPrecWilsonLinOp()
Partial constructor.
void evenEvenLinOp(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the even-even block onto a source std::vector.
EvenOddPrecWilsonLinOp(Handle< FermState< T, P, Q > > fs, const Real &Mass_, const multi1d< Real > &coeffs_)
Full constructor with array of coefficients.
void create(Handle< FermState< T, P, Q > > fs, const Real &Mass_)
Creation routine.
void derivOddEvenLinOp(multi1d< LatticeColorMatrix > &ds_u, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the odd-even block onto a source std::vector.
void operator()(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Override inherited one with a few more funkies.
void evenOddLinOp(LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign) const
Apply the the even-odd block onto a source std::vector.
EvenOddPrecWilsonLinOp(Handle< FermState< T, P, Q > > fs, const Real &Mass_)
Full constructor.
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.
Definition: lwldslash_w.h:48
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Definition: lwldslash_w.h:92
int mu
Definition: cool.cc:24
Include possibly optimized Wilson dslash.
Preconditioned 4D Linop with Gauge Independent Even-Even part.
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
Double zero
Definition: invbicg.cc:106
Parameters for anisotropy.
Definition: aniso_io.h:24