CHROMA
iluprec_s_cprec_t_clover_linop_w.h
Go to the documentation of this file.
1 #ifndef ILUPREC_S_CPREC_T_CLOVER_LINOP_W_H
2 #define ILUPREC_S_CPREC_T_CLOVER_LINOP_W_H
3 #include "qdp_config.h"
4 #if QDP_NS == 4
5 #if QDP_ND == 4
6 #if QDP_NC == 3
7 
8 #include "linearop.h"
9 #include "central_tprec_linop.h"
15 
16 namespace Chroma
17 {
18  //! Clover Dirac Operator - Unpreconditioned in Space, Centrally Preconditioned in time
19  /*!
20  * \ingroup linop
21  *
22  * This routine is specific to Clover fermions!
23  *
24  * ~ ~+
25  */
26 
27  class ILUPrecSCprecTCloverLinOp : public ILUPrecSCprecTWilsonLikeLinOp
28  {
29  public:
30  // Typedefs to save typing
31  typedef LatticeFermion T;
32  typedef multi1d<LatticeColorMatrix> P;
33  typedef multi1d<LatticeColorMatrix> Q;
34  typedef PScalar<PColorMatrix<RComplex<REAL>, 3> > CMat; // Useful type: ColorMat with no Outer<>
35  typedef PSpinVector<PColorVector<RComplex<REAL>, 3>, 2> HVec_site; // Useful type: Half Vec with no Outer<>
36  //! Partial constructor
37  ILUPrecSCprecTCloverLinOp() {}
38 
39 
40  //! Full constructor with Anisotropy
41  ILUPrecSCprecTCloverLinOp(Handle< FermState<T,P,Q> > fs_,
42  const CloverFermActParams& param_ )
43  {create(fs_,param_);}
44 
45  //! Destructor is automatic
46  ~ILUPrecSCprecTCloverLinOp() {}
47 
48  //! Return the fermion BC object for this linear operator
49  const FermBC<T,P,Q>& getFermBC() const {return fs->getBC();}
50 
51 
52  //! Creation routine with Anisotropy
53  void create(Handle< FermState<T,P,Q> > fs_,
54  const CloverFermActParams& param_);
55 
56 
57  protected:
58 
59  //! Apply the the space block onto a source std::vector
60  // cb3d is the 3d (rb3) checkerboard of the target
61  void spaceLinOp(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
62  Real mhalf=Real(-0.5);
63  Dw3D.apply(chi, psi, isign, cb3d);
64  chi[ rb3[cb3d] ] *= mhalf;
65  getFermBC().modifyF(chi, rb3[cb3d]);
66  }
67 
68  //! Derivative of the spatial operator
69  void derivSpaceOp(P& ds_u, const T& X, const T& Y, enum PlusMinus isign, int cb3d) const
70  {
71  Real mhalf=Real(-0.5);
72  Dw3D.deriv(ds_u, X, Y, isign, cb3d);
73  for(int mu=0; mu < 3; mu++) {
74  ds_u[mu]*= mhalf;
75  }
76  ds_u[3]=zero;
77  getFermBC().zero(ds_u);
78  }
79 
80  //! Do chi = (A - 1) psi with A = -(c_sw/4) sigma_munu F_munu
81  inline
82  void AMinusOneOp(T& chi, const T& psi, enum PlusMinus isign) const {
83  T tmp1;
84 
85  // The clover term does A_plus_fact = factI - (c_sw/4) sigma_munu F_munu = A + fact
86  // where the desired A is just A = - (c_sw/4) sigma_munu F_munu
87 
88  // I need to get rid of the factI. Luckily, since I already
89  // have to do A - 1, I can just change this to A-(1 + fact)I
90 
91  // 1 + fact
92  Real ftmp = Real(1) + fact;
93 
94  // tmp = (A + fact) psi
95  APlusFact(tmp1, psi, isign);
96 
97  // chi
98  chi = tmp1 - ftmp*psi;
99  getFermBC().modifyF(chi);
100  }
101 
102  //! Derivative of clover term
103  void derivAMinusOne(P& ds_u, const T& X, const T& Y, enum PlusMinus isign) const {
104  APlusFact.deriv(ds_u, X, Y, isign);
105  getFermBC().zero(ds_u);
106  }
107 
108  //! Get log det ( T^\dag T )
109  Double logDetTDagT(void) const {
110  return logDetTSq;
111  }
112 
113 
114  //! Flopcounter
115  unsigned long nFlops() const
116  {
117  // QDPIO::cout << "Flopcount Not Yet Implemented " << std::endl;
118  return 0;
119  }
120 
121  // Fill out the blanks
122  const multi3d< int >& getTsiteArray(void) const
123  {
124  return tsite;
125  }
126 
127  const multi3d< CMat >& getPMatrixArray(void) const
128  {
129  return P_mat;
130  }
131 
132  const multi3d< CMat >& getPMatrixDaggerArray(void) const
133  {
134  return P_mat_dag;
135  }
136 
137  const multi2d< CMat >& getQMatrixInvArray(void) const
138  {
139  return Q_mat_inv;
140  }
141 
142  const multi2d< CMat >& getQMatrixDaggerInvArray(void) const
143  {
144  return Q_mat_dag_inv;
145  }
146 
147  const Real& getFactor() const
148  {
149  return fact;
150  }
151 
152  const Real& getInvFactor() const
153  {
154  return invfact;
155  }
156 
157  const multi1d<LatticeColorMatrix>& getLinks(void) const {
158  return u;
159  }
160 
161  inline int getTMax(void) const {
162  return t_max;
163  }
164  private:
165  bool schrTP;
166 
167  Real fact; // tmp holding Nd+Mass
168  Real invfact;
169  Handle< FermState<T,P,Q> > fs;
170  multi1d<LatticeColorMatrix> u;
171 
172  multi3d< int > tsite; // Tsite array - 3d even sites
173 
174  multi3d< CMat > P_mat; // 3d even sites
175  multi3d< CMat > P_mat_dag;
176 
177  multi2d< CMat > Q_mat_inv; // Just one matrix for each spatial site ( 1+P[t=0] )^{-1}
178  multi2d< CMat > Q_mat_dag_inv; // Just one matrix for each spatial site ( 1+P_dag[t=Nt-1])^{-1}
179 
180 
181  CloverTerm APlusFact;
182  CloverFermActParams param;
183 
184  WilsonDslash3D Dw3D;
185  Double logDetTSq;
186  int t_max;
187  };
188 
189 } // End Namespace Chroma
190 
191 #endif
192 #endif
193 #endif
194 
195 #endif
Time-preconditioned Linear Operators.
Support for time preconditioning.
Parameters for Clover fermion action.
Include possibly optimized Clover terms.
int mu
Definition: cool.cc:24
Include possibly optimized Wilson dslash.
Linear Operators.
multi1d< LatticeColorMatrix > P
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
QDPCloverTerm CloverTerm
Definition: clover_term_w.h:92
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
Double zero
Definition: invbicg.cc:106
FloatingPoint< double > Double
Definition: gtest.h:7351
LatticeFermion T
Definition: t_clover.cc:11
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13