CHROMA
eoprec_clover_extfield_linop_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Even-odd preconditioned Clover fermion linear operator in an external field
3  */
4 
5 #include "chromabase.h"
8 
9 using namespace QDP::Hints;
10 
11 namespace Chroma
12 {
13 
14  //! Creation routine with Anisotropy
15  /*!
16  * \param u_ gauge field (Read)
17  * \param param_ fermion kappa (Read)
18  */
19  void EvenOddPrecCloverExtFieldLinOp::create(Handle< FermState<T,P,Q> > fs,
20  const CloverFermActParams& param_)
21  {
22  // QDPIO::cout << __PRETTY_FUNCTION__ << ": enter" << std::endl;
23 
25 
26  param = param_;
27 
28  clov.create(efs->getOriginalState(), param);
29 
30  invclov.create(efs->getOriginalState(),param, clov); // make a copy
31  invclov.choles(0); // invert the cb=0 part
32 
33  D.create(efs->getU1State(), param.anisoParam);
34 
35  // QDPIO::cout << __PRETTY_FUNCTION__ << ": exit" << std::endl;
36  }
37 
38  //! Apply the the odd-odd block onto a source std::vector
39  void
40  EvenOddPrecCloverExtFieldLinOp::oddOddLinOp(LatticeFermion& chi, const LatticeFermion& psi,
41  enum PlusMinus isign) const
42  {
43  clov.apply(chi, psi, isign, 1);
44  }
45 
46 
47  //! Apply the the even-even block onto a source std::vector
48  void
49  EvenOddPrecCloverExtFieldLinOp::evenEvenLinOp(LatticeFermion& chi, const LatticeFermion& psi,
50  enum PlusMinus isign) const
51  {
52  // Nuke for testing
53  clov.apply(chi, psi, isign, 0);
54  }
55 
56  //! Apply the inverse of the even-even block onto a source std::vector
57  void
58  EvenOddPrecCloverExtFieldLinOp::evenEvenInvLinOp(LatticeFermion& chi, const LatticeFermion& psi,
59  enum PlusMinus isign) const
60  {
61  invclov.apply(chi, psi, isign, 0);
62  }
63 
64 
65  //! Apply even-odd linop component
66  /*!
67  * The operator acts on the entire even sublattice
68  *
69  * \param chi Pseudofermion field (Write)
70  * \param psi Pseudofermion field (Read)
71  * \param isign Flag ( PLUS | MINUS ) (Read)
72  */
73  void
74  EvenOddPrecCloverExtFieldLinOp::evenOddLinOp(LatticeFermion& chi,
75  const LatticeFermion& psi,
76  enum PlusMinus isign) const
77  {
78  START_CODE();
79 
80  Real mhalf = -0.5;
81 
82  D.apply(chi, psi, isign, 0);
83  chi[rb[0]] *= mhalf;
84 
85  END_CODE();
86  }
87 
88  //! Apply odd-even linop component
89  /*!
90  * The operator acts on the entire odd sublattice
91  *
92  * \param chi Pseudofermion field (Write)
93  * \param psi Pseudofermion field (Read)
94  * \param isign Flag ( PLUS | MINUS ) (Read)
95  */
96  void
97  EvenOddPrecCloverExtFieldLinOp::oddEvenLinOp(LatticeFermion& chi,
98  const LatticeFermion& psi,
99  enum PlusMinus isign) const
100  {
101  START_CODE();
102 
103  Real mhalf = -0.5;
104 
105  D.apply(chi, psi, isign, 1);
106  chi[rb[1]] *= mhalf;
107 
108  END_CODE();
109  }
110 
111 
112  //! Apply even-odd preconditioned Clover fermion linear operator
113  /*!
114  * \param chi Pseudofermion field (Write)
115  * \param psi Pseudofermion field (Read)
116  * \param isign Flag ( PLUS | MINUS ) (Read)
117  */
119  const LatticeFermion& psi,
120  enum PlusMinus isign) const
121  {
122 
123  LatticeFermion tmp1; moveToFastMemoryHint(tmp1);
124  LatticeFermion tmp2; moveToFastMemoryHint(tmp2);
125  Real mquarter = -0.25;
126 
127  // tmp1_o = D_oe A^(-1)_ee D_eo psi_o
128  D.apply(tmp1, psi, isign, 0);
129  invclov.apply(tmp2, tmp1, isign, 0);
130  D.apply(tmp1, tmp2, isign, 1);
131 
132  // chi_o = A_oo psi_o - tmp1_o
133  clov.apply(chi, psi, isign, 1);
134 
135 
136  chi[rb[1]] += mquarter*tmp1;
137  }
138 
139 
140  //! Return flops performed by the operator()
141  unsigned long EvenOddPrecCloverExtFieldLinOp::nFlops() const
142  {
143  unsigned long cbsite_flops = 2*D.nFlops()+2*clov.nFlops()+4*Nc*Ns;
144  return cbsite_flops*(Layout::sitesOnNode()/2);
145  }
146 
147  //! Get the log det of the even even part
148  // BUt for now, return zero for testing.
149  Double EvenOddPrecCloverExtFieldLinOp::logDetEvenEvenLinOp(void) const {
150  return invclov.cholesDet(0);
151  }
152 } // 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
Handle< Q > cast()
RGE's addition. A cast function to morph the actual type.
Definition: handle.h:61
Even-odd preconditioned Clover fermion linear operator in an external field.
Fermion external field state and a creator.
Double tmp2
Definition: mesq.cc:30
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
FloatingPoint< double > Double
Definition: gtest.h:7351
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Params for clover ferm acts.