CHROMA
iluprec_s_cprec_t_wilson_linop_w.h
Go to the documentation of this file.
1 #ifndef ILUPREC_S_CPREC_T_WILSON_LINOP_W_H
2 #define ILUPREC_S_CPREC_T_WILSON_LINOP_W_H
3 
4 #include "qdp_config.h"
5 #if QDP_NS == 4
6 #if QDP_ND == 4
7 #if QDP_NC == 3
8 
9 #include "linearop.h"
10 #include "central_tprec_linop.h"
11 
14 
16 
17 namespace Chroma
18 {
19  //! Wilson Dirac Operator - Unpreconditioned in Space, Centrally Preconditioned in time
20  /*!
21  * \ingroup linop
22  *
23  * This routine is specific to Wilson fermions!
24  *
25  * ~ ~+
26  */
27 
28  class ILUPrecSCprecTWilsonLinOp :
29  public ILUPrecSCprecTWilsonLikeLinOp
30  {
31  public:
32  // Typedefs to save typing
33  typedef LatticeFermion T;
34  typedef multi1d<LatticeColorMatrix> P;
35  typedef multi1d<LatticeColorMatrix> Q;
36  typedef PScalar<PColorMatrix<RComplex<REAL>, 3> > CMat; // Useful type: ColorMat with no Outer<>
37  typedef PSpinVector<PColorVector<RComplex<REAL>, 3>, 2> HVec_site; // Useful type: Half Vec with no Outer<>
38  //! Partial constructor
39  ILUPrecSCprecTWilsonLinOp() {}
40 
41 
42  //! Full constructor with Anisotropy
43  ILUPrecSCprecTWilsonLinOp(Handle< FermState<T,P,Q> > fs_,
44  const Real& Mass_,
45  const AnisoParam_t& aniso_)
46  {create(fs_,Mass_,aniso_);}
47 
48  //! Destructor is automatic
49  ~ILUPrecSCprecTWilsonLinOp() {}
50 
51  //! Return the fermion BC object for this linear operator
52  const FermBC<T,P,Q>& getFermBC() const {return fs->getBC();}
53 
54 
55  //! Creation routine with Anisotropy
56  void create(Handle< FermState<T,P,Q> > fs_,
57  const Real& Mass_,
58  const AnisoParam_t& aniso_);
59 
60 
61  //! Apply the the space block onto a source std::vector
62  // cb3d is the 3d (rb3) checkerboard of the target
63  void spaceLinOp(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
64  Real mhalf=Real(-0.5);
65  Dw3D.apply(chi, psi, isign, cb3d);
66  chi[ rb3[cb3d] ] *= mhalf;
67  getFermBC().modifyF(chi);
68 
69  }
70 
71  void derivSpaceOp(P& ds_u, const T& X, const T& Y, enum PlusMinus isign, int cb3d) const
72  {
73  Real mhalf=Real(-0.5);
74  Dw3D.deriv(ds_u, X, Y, isign, cb3d);
75  for(int mu=0; mu < 3; mu++) {
76  ds_u[mu]*= mhalf;
77  }
78  ds_u[3]=zero;
79  getFermBC().zero(ds_u);
80 
81  }
82 
83  // A = 0 so A-1 = -1 => (A-1) psi = -psi and also for the dagger.
84  inline
85  void AMinusOneOp(T& chi, const T& psi, enum PlusMinus isign) const {
86  chi = Real(-1)*psi;
87  getFermBC().modifyF(chi);
88  }
89 
90  inline
91  void derivAMinusOne(P& ds_u, const T& X, const T& Y, enum PlusMinus isign) const
92  {
93  // Trivial for Wilson Case
94  ds_u.resize(Nd);
95  for(int mu = 0; mu < Nd; mu++) {
96  ds_u[mu] = zero;
97  }
98  getFermBC().zero(ds_u);
99  }
100 
101  //! Get log det ( T^\dag T )
102  Double logDetTDagT(void) const {
103  return logDetTSq;
104  }
105 
106  const multi3d< int >& getTsiteArray(void) const
107  {
108  return tsite;
109  }
110 
111  const multi3d< CMat >& getPMatrixArray(void) const
112  {
113  return P_mat;
114  }
115 
116  const multi3d< CMat >& getPMatrixDaggerArray(void) const
117  {
118  return P_mat_dag;
119  }
120 
121  const multi2d< CMat >& getQMatrixInvArray(void) const
122  {
123  return Q_mat_inv;
124  }
125 
126  const multi2d< CMat >& getQMatrixDaggerInvArray(void) const
127  {
128  return Q_mat_dag_inv;
129  }
130 
131  const Real& getFactor() const
132  {
133  return fact;
134  }
135 
136  const Real& getInvFactor() const
137  {
138  return invfact;
139  }
140 
141  const multi1d<LatticeColorMatrix>& getLinks(void) const {
142  return u;
143  }
144 
145  inline bool schroedingerTP() const {
146  return schrTP;
147  }
148 
149  protected:
150  inline int getTMax(void) const {
151  // Always return Nt for now
152  return Layout::lattSize()[Nd-1];
153  }
154  private:
155  bool schrTP;
156  AnisoParam_t aniso;
157  Real fact; // tmp holding Nd+Mass
158  Real invfact;
159  Real Mass;
160  Handle< FermState<T,P,Q> > fs;
161  multi1d<LatticeColorMatrix> u;
162 
163  multi3d< int > tsite; // Tsite array - 3d even sites
164 
165  multi3d< CMat > P_mat; // 3d even sites
166  multi3d< CMat > P_mat_dag;
167 
168  multi2d< CMat > Q_mat_inv; // Just one matrix for each spatial site ( 1+P[t=0] )^{-1}
169  multi2d< CMat > Q_mat_dag_inv; // Just one matrix for each spatial site ( 1+P_dag[t=Nt-1])^{-1}
170 
171  WilsonDslash3D Dw3D;
172  Double logDetTSq;
173  };
174 
175 } // End Namespace Chroma
176 
177 #endif
178 
179 #endif
180 #endif
181 #endif
Time-preconditioned Linear Operators.
Support for time preconditioning.
int mu
Definition: cool.cc:24
Include possibly optimized Wilson dslash.
Linear Operators.
Nd
Definition: meslate.cc:74
multi1d< LatticeColorMatrix > P
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
Definition: pbg5p_w.cc:29
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