CHROMA
unprec_wilson_linop_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Wilson linear operator
3  */
4 
5 #include "chromabase.h"
7 
8 using namespace QDP::Hints;
9 
10 namespace Chroma
11 {
12 
13  //! Creation routine
14  /*!
15  * \param u_ gauge field (Read)
16  * \param Mass_ fermion kappa (Read)
17  */
18  void UnprecWilsonLinOp::create(Handle< FermState<T,P,Q> > fs,
19  const Real& Mass_)
20  {
21  AnisoParam_t anisoParam;
22  create(fs, Mass_, anisoParam);
23  }
24 
25 
26  //! Creation routine with Anisotropy
27  /*!
28  * \param u_ gauge field (Read)
29  * \param Mass_ fermion kappa (Read)
30  * \param aniso anisotropy struct (Read)
31  */
32  void UnprecWilsonLinOp::create(Handle< FermState<T,P,Q> > fs,
33  const Real& Mass_,
34  const AnisoParam_t& anisoParam)
35  {
36  START_CODE();
37 
38  D.create(fs,anisoParam);
39 
40  Mass = Mass_;
41  Real ff = where(anisoParam.anisoP, anisoParam.nu / anisoParam.xi_0, Real(1));
42  fact = 1 + (Nd-1)*ff + Mass;
43 
44  END_CODE();
45  }
46 
47 
48  //! Apply unpreconditioned Wilson fermion linear operator
49  /*!
50  * \ingroup linop
51  *
52  * The operator acts on the entire lattice
53  *
54  * \param chi Pseudofermion field (Read)
55  * \param psi Pseudofermion field (Read)
56  * \param isign Flag ( PLUS | MINUS ) (Read)
57  */
58  void UnprecWilsonLinOp::operator() (LatticeFermion& chi, const LatticeFermion& psi,
59  enum PlusMinus isign) const
60  {
61  START_CODE();
62 
63  //
64  // Chi = (Nd+Mass)*Psi - (1/2) * D' Psi
65  //
66  LatticeFermion tmp; moveToFastMemoryHint(tmp);
67  Real mhalf = -0.5;
68 
69  // D is a Dslash - must apply to both CB-s
70  D(tmp, psi, isign);
71 
72  chi = fact*psi + mhalf*tmp;
73 
74  getFermBC().modifyF(chi);
75 
76  END_CODE();
77  }
78 
79 
80 
81  //! Derivative of unpreconditioned Wilson dM/dU
82  /*!
83  * \param chi left std::vector on cb (Read)
84  * \param psi right std::vector on 1-cb (Read)
85  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
86  * \param cb Checkerboard of chi std::vector (Read)
87  *
88  * \return Computes \f$\chi^\dag * \dot(D} * \psi\f$
89  */
90  void
91  UnprecWilsonLinOp::deriv(multi1d<LatticeColorMatrix>& ds_u,
92  const LatticeFermion& chi, const LatticeFermion& psi,
93  enum PlusMinus isign) const
94  {
95  START_CODE();
96 
97  // This does both parities
98  D.deriv(ds_u, chi, psi, isign);
99 
100  // Factor from the -1/2 in front of the dslash
101  for(int mu = 0; mu < Nd; ++mu)
102  ds_u[mu] *= Real(-0.5);
103 
104  END_CODE();
105  }
106 
107 
108  //! Return flops performed by the operator()
109  unsigned long UnprecWilsonLinOp::nFlops() const
110  {
111  unsigned long site_flops = D.nFlops()+4*Nc*Ns;
112  return site_flops*Layout::sitesOnNode();
113  }
114 
115 } // End Namespace Chroma
Primary include file for CHROMA library code.
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
int mu
Definition: cool.cc:24
Real Mass
Double tmp
Definition: meslate.cc:60
Nd
Definition: meslate.cc:74
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Parameters for anisotropy.
Definition: aniso_io.h:24
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.
Unpreconditioned Wilson fermion linear operator.