CHROMA
eoprec_clover_dumb_linop_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Even-odd preconditioned Clover fermion linear operator
4  */
5 
6 #ifndef __prec_clover_dumb_linop_w_h__
7 #define __prec_clover_dumb_linop_w_h__
8 
9 #include "state.h"
10 #include "fermbc.h"
11 #include "eoprec_logdet_linop.h"
15 
16 
17 namespace Chroma
18 {
19 
20 #if 1
21  //! Even-odd preconditioned Clover-Dirac operator
22  /*!
23  * \ingroup linop
24  *
25  * This routine is specific to Wilson fermions!
26  *
27  * The kernel for Clover fermions is
28  *
29  * M = A + (d+M) - (1/2) D'
30 
31  * This is a dumb version with only a constructor and an
32  * apply method. It is also fixed to single precision
33  */
34  class EvenOddPrecDumbCloverFLinOp : public LinearOperator<LatticeFermionF>
35  {
36  public:
37  typedef LatticeFermionF T;
38  typedef LatticeColorMatrixF U;
39  typedef multi1d<U> P;
40  typedef multi1d<U> Q;
41 
42  //! Full constructor
44  const CloverFermActParams& param_)
45  {create(fs,param_);}
46 
47  //! Destructor is automatic
49 
50  //! Return the fermion BC object for this linear operator
51  const FermBC<LatticeFermionF,P,Q>& getFermBC() const {return D.getFermBC();}
52 
53  //! Creation routine
55  const CloverFermActParams& param_) {
56 
57  param = param_;
58  clov.create(fs, param);
59  invclov.create(fs,param,clov); // make a copy
60  invclov.choles(0); // invert the cb=0 part
61  D.create(fs, param.anisoParam);
62 
63  }
64 
65 
66  // Override inherited one with a few more funkies
67  void operator()(LatticeFermionF& chi, const LatticeFermionF& psi,
68  enum PlusMinus isign) const
69  {
70  START_CODE();
71 
72  LatticeFermionF tmp1;
73  LatticeFermionF tmp2;
74  Real mquarter = -0.25;
75 
76  // tmp1_o = D_oe A^(-1)_ee D_eo psi_o
77  D.apply(tmp1, psi, isign, 0);
78 
79  invclov.apply(tmp2, tmp1, isign, 0);
80 
81  D.apply(tmp1, tmp2, isign, 1);
82 
83  // chi_o = A_oo psi_o - tmp1_o
84  clov.apply(chi, psi, isign, 1);
85 
86  chi[rb[1]] += mquarter*tmp1;
87 
88  // Twisted Term?
89  if( param.twisted_m_usedP ){
90  // tmp1 = i mu gamma_5 tmp1
91  tmp1[rb[1]] = (GammaConst<Ns,Ns*Ns-1>() * timesI(psi));
92 
93  if( isign == PLUS ) {
94  chi[rb[1]] += param.twisted_m * tmp1;
95  }
96  else {
97  chi[rb[1]] -= param.twisted_m * tmp1;
98  }
99  }
100 
101  END_CODE();
102 
103  }
104 
105 
106  //! Return flops performed by the operator()
107  unsigned long nFlops() const
108  {
109  unsigned long cbsite_flops = 2*D.nFlops()+2*clov.nFlops()+4*Nc*Ns;
110  if( param.twisted_m_usedP ) {
111  cbsite_flops += 4*Nc*Ns; // a + mu*b : a = chi, b = g_5 I psi
112  }
113  return cbsite_flops*(Layout::sitesOnNode()/2);
114  }
115 
116  const Subset& subset() const
117  {
118  return rb[1];
119  }
120 
121  private:
125  CloverTermF invclov; // uggh, only needed for evenEvenLinOp
126  };
127 
128 #endif
129 #if 1
130  //! Even-odd preconditioned Clover-Dirac operator
131  /*!
132  * \ingroup linop
133  *
134  * This routine is specific to Wilson fermions!
135  *
136  * The kernel for Clover fermions is
137  *
138  * M = A + (d+M) - (1/2) D'
139 
140  * This is a dumb version with only a constructor and an
141  * apply method. It is also fixed to double precision
142  */
143  class EvenOddPrecDumbCloverDLinOp : public LinearOperator<LatticeFermionD>
144  {
145  public:
146  typedef LatticeFermionD T;
147  typedef LatticeColorMatrixD U;
148  typedef multi1d<U> P;
149  typedef multi1d<U> Q;
150 
151  //! Full constructor
153  const CloverFermActParams& param_)
154  {create(fs,param_);}
155 
156  //! Destructor is automatic
158 
159  //! Return the fermion BC object for this linear operator
160  const FermBC<T,P,Q>& getFermBC() const {return D.getFermBC();}
161 
162  //! Creation routine
164  const CloverFermActParams& param_) {
165  START_CODE();
166 
167  // QDPIO::cout << __PRETTY_FUNCTION__ << ": enter" << std::endl;
168 
169  param = param_;
170  clov.create(fs, param);
171  invclov.create(fs,param,clov); // make a copy
172  invclov.choles(0); // invert the cb=0 part
173  D.create(fs, param.anisoParam);
174 
175  // QDPIO::cout << __PRETTY_FUNCTION__ << ": exit" << std::endl;
176  END_CODE();
177 
178  }
179 
180 
181  // Override inherited one with a few more funkies
182  void operator()(T& chi, const T& psi,
183  enum PlusMinus isign) const
184  {
185 
186  START_CODE();
187 
188  T tmp1;
189  T tmp2;
190  Real mquarter = -0.25;
191 
192  // tmp1_o = D_oe A^(-1)_ee D_eo psi_o
193  D.apply(tmp1, psi, isign, 0);
194 
195  invclov.apply(tmp2, tmp1, isign, 0);
196 
197  D.apply(tmp1, tmp2, isign, 1);
198 
199  // chi_o = A_oo psi_o - tmp1_o
200  clov.apply(chi, psi, isign, 1);
201 
202  chi[rb[1]] += mquarter*tmp1;
203 
204  // Twisted Term?
205  if( param.twisted_m_usedP ){
206  // tmp1 = i mu gamma_5 tmp1
207  tmp1[rb[1]] = (GammaConst<Ns,Ns*Ns-1>() * timesI(psi));
208 
209  if( isign == PLUS ) {
210  chi[rb[1]] += param.twisted_m * tmp1;
211  }
212  else {
213  chi[rb[1]] -= param.twisted_m * tmp1;
214  }
215  }
216 
217  END_CODE();
218 
219  }
220 
221 
222  //! Return flops performed by the operator()
223  unsigned long nFlops() const
224  {
225  unsigned long cbsite_flops = 2*D.nFlops()+2*clov.nFlops()+4*Nc*Ns;
226  if( param.twisted_m_usedP ) {
227  cbsite_flops += 4*Nc*Ns; // a + mu*b : a = chi, b = g_5 I psi
228  }
229  return cbsite_flops*(Layout::sitesOnNode()/2);
230  }
231 
232  const Subset& subset() const
233  {
234  return rb[1];
235  }
236 
237  private:
241  CloverTermD invclov; // uggh, only needed for evenEvenLinOp
242  };
243 
244 #endif
245 
246 } // End Namespace Chroma
247 
248 
249 #endif
unsigned long nFlops() const
Return flops performed by the operator()
Even-odd preconditioned Clover-Dirac operator.
~EvenOddPrecDumbCloverDLinOp()
Destructor is automatic.
void operator()(T &chi, const T &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
const Subset & subset() const
Return the subset on which the operator acts.
unsigned long nFlops() const
Return flops performed by the operator()
EvenOddPrecDumbCloverDLinOp(Handle< FermState< T, P, Q > > fs, const CloverFermActParams &param_)
Full constructor.
void create(Handle< FermState< T, P, Q > > fs, const CloverFermActParams &param_)
Creation routine.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Even-odd preconditioned Clover-Dirac operator.
unsigned long nFlops() const
Return flops performed by the operator()
const Subset & subset() const
Return the subset on which the operator acts.
void operator()(LatticeFermionF &chi, const LatticeFermionF &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
const FermBC< LatticeFermionF, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
void create(Handle< FermState< LatticeFermionF, P, Q > > fs, const CloverFermActParams &param_)
Creation routine.
~EvenOddPrecDumbCloverFLinOp()
Destructor is automatic.
EvenOddPrecDumbCloverFLinOp(Handle< FermState< LatticeFermionF, P, Q > > fs, const CloverFermActParams &param_)
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
Linear Operator.
Definition: linearop.h:27
void create(Handle< FermState< T, multi1d< U >, multi1d< U > > > fs, const CloverFermActParams &param_)
Creation routine.
void apply(T &chi, const T &psi, enum PlusMinus isign, int cb) const
void choles(int cb)
Computes the inverse of the term on cb using Cholesky.
General Wilson-Dirac dslash.
Definition: lwldslash_w.h:48
void create(Handle< FermState< T, P, Q > > state)
Creation routine.
Definition: lwldslash_w.h:161
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
Definition: lwldslash_w.h:92
unsigned long nFlops() const
Return flops performed by the operator()
Parameters for Clover fermion action.
Include possibly optimized Clover terms.
Include possibly optimized Wilson dslash.
Preconditioned Linear Operators where the Even Even part depends on the gauge field.
Fermion action boundary conditions.
void apply(T &chi, const T &psi, enum PlusMinus isign, int cb) const
General Wilson-Dirac dslash.
Definition: lwldslash_w.h:228
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
Support class for fermion actions and linear operators.
Params for clover ferm acts.