CHROMA
ilu2prec_s_cprec_t_wilson_linop_w.h
Go to the documentation of this file.
1 #ifndef ILU2PREC_S_CPREC_T_WILSON_LINOP_W_H
2 #define ILU2PREC_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 ILU2PrecSCprecTWilsonLinOp :
29  public ILU2PrecSCprecTWilsonLikeLinOp
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  ILU2PrecSCprecTWilsonLinOp() {}
40 
41 
42  //! Full constructor with Anisotropy
43  ILU2PrecSCprecTWilsonLinOp(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  ~ILU2PrecSCprecTWilsonLinOp() {}
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 #if 0
61  void operator() (T& chi, const T& psi, enum PlusMinus isign) const
62  {
63  QDPIO::cout << "Foo" << std::endl;
64  T tmp1, tmp2,tmp3; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(tmp2);
65 
66  switch (isign)
67  {
68  case PLUS:
69  chi = psi;
70  DBar(tmp1, psi, PLUS, 0);
71  DBar(tmp2, tmp1, PLUS, 1);
72  chi[rb3[1]] -= tmp2;
73 
74  break;
75 
76 
77  case MINUS:
78  chi = psi;
79  DBar(tmp1, psi, MINUS, 0);
80  DBar(tmp2, tmp1, MINUS, 1);
81  chi[rb3[1]] -= tmp2;
82 
83  break;
84 
85  default:
86  QDPIO::cerr << "unknown sign" << std::endl;
87  QDP_abort(1);
88  }
89  getFermBC().modifyF(chi);
90 
91  }
92 #endif
93  //! Apply the the space block onto a source std::vector
94  // cb3d is the 3d (rb3) checkerboard of the target
95  void Dslash3D(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
96  Real mhalf=Real(0.5); // Minus sign explicit in the preconditioner. But factor of 2
97  // Still here...
98  Dw3D.apply(chi, psi, isign, cb3d);
99  chi[ rb3[cb3d] ] *= mhalf;
100  getFermBC().modifyF(chi);
101 
102  }
103 
104  inline
105  void ABar(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
106  chi[rb3[cb3d]] = zero;
107  getFermBC().modifyF(chi);
108  }
109 
110  inline
111  void AH(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
112  chi[rb3[cb3d]] = zero;
113  getFermBC().modifyF(chi);
114  }
115 
116 
117  const multi3d< int >& getTsiteArray(void) const
118  {
119  return tsite;
120  }
121 
122  const multi3d< CMat >& getPMatrixArray(void) const
123  {
124  return P_mat;
125  }
126 
127  const multi3d< CMat >& getPMatrixDaggerArray(void) const
128  {
129  return P_mat_dag;
130  }
131 
132  const multi2d< CMat >& getQMatrixInvArray(void) const
133  {
134  return Q_mat_inv;
135  }
136 
137  const multi2d< CMat >& getQMatrixDaggerInvArray(void) const
138  {
139  return Q_mat_dag_inv;
140  }
141 
142  const Real& getFactor() const
143  {
144  return fact;
145  }
146 
147  const Real& getInvFactor() const
148  {
149  return invfact;
150  }
151 
152  const multi1d<LatticeColorMatrix>& getLinks(void) const {
153  return u;
154  }
155 
156  inline bool schroedingerTP() const {
157  return schrTP;
158  }
159 
160  protected:
161  inline int getTMax(void) const {
162  // Always return Nt for now
163  return Layout::lattSize()[Nd-1];
164  }
165  private:
166  bool schrTP;
167  AnisoParam_t aniso;
168  Real fact; // tmp holding Nd+Mass
169  Real invfact;
170  Real Mass;
171  Handle< FermState<T,P,Q> > fs;
172  multi1d<LatticeColorMatrix> u;
173 
174  multi3d< int > tsite; // Tsite array - 3d even sites
175 
176  multi3d< CMat > P_mat; // 3d even sites
177  multi3d< CMat > P_mat_dag;
178 
179  multi2d< CMat > Q_mat_inv; // Just one matrix for each spatial site ( 1+P[t=0] )^{-1}
180  multi2d< CMat > Q_mat_dag_inv; // Just one matrix for each spatial site ( 1+P_dag[t=Nt-1])^{-1}
181 
182  WilsonDslash3D Dw3D;
183  Double logDetTSq;
184  };
185 
186 } // End Namespace Chroma
187 
188 #endif
189 
190 #endif
191 #endif
192 #endif
Time-preconditioned Linear Operators.
Support for time preconditioning.
Include possibly optimized Wilson dslash.
Linear Operators.
Nd
Definition: meslate.cc:74
Double tmp2
Definition: mesq.cc:30
Double tmp3
Definition: mesq.cc:31
multi1d< LatticeColorMatrix > P
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
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
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
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