CHROMA
ilu2prec_s_cprec_t_clover_linop_w.h
Go to the documentation of this file.
1 #ifndef ILU2PREC_S_CPREC_T_CLOVER_LINOP_W_H
2 #define ILU2PREC_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 ILU2PrecSCprecTCloverLinOp : public ILU2PrecSCprecTWilsonLikeLinOp
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  ILU2PrecSCprecTCloverLinOp() {}
38 
39 
40  //! Full constructor with Anisotropy
41  ILU2PrecSCprecTCloverLinOp(Handle< FermState<T,P,Q> > fs_,
42  const CloverFermActParams& param_ )
43  {create(fs_,param_);}
44 
45  //! Destructor is automatic
46  ~ILU2PrecSCprecTCloverLinOp() {}
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 Dslash3D(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
62  Real mhalf=Real(0.5); // - sign is now in preconditioners
63  Dw3D.apply(chi, psi, isign, cb3d);
64  chi[ rb3[cb3d] ] *= mhalf;
65  getFermBC().modifyF(chi, rb3[cb3d]);
66  }
67 
68  //! Do chi = (A - 1) psi with A = -(c_sw/4) sigma_munu F_munu
69  inline
70  void AH(T& chi, const T& psi, enum PlusMinus isign, int cb3d) const {
71  T tmp1;
72 
73  // The clover term does A_plus_fact = factI - (c_sw/4) sigma_munu F_munu = A + fact
74  // where the desired A is just A = - (c_sw/4) sigma_munu F_munu
75 
76  // I need to get rid of the factI. Luckily, since I already
77  // have to do A - 1, I can just change this to A-(1 + fact)I
78 
79  // tmp = (A + fact) psi
80  // Yucky...
81  const int *tab = rb3[cb3d].siteTable().slice();
82  for(int j=0; j < rb3[cb3d].siteTable().size(); j++) {
83  int site = tab[j];
84  APlusFact.applySite(tmp1, psi, isign, site);
85  }
86 
87  // chi
88  chi[rb3[cb3d]] = tmp1 - fact*psi;
89  getFermBC().modifyF(chi);
90  }
91 
92  //! Flopcounter
93  unsigned long nFlops() const
94  {
95  // QDPIO::cout << "Flopcount Not Yet Implemented " << std::endl;
96  return 0;
97  }
98 
99  // Fill out the blanks
100  const multi3d< int >& getTsiteArray(void) const
101  {
102  return tsite;
103  }
104 
105  const multi3d< CMat >& getPMatrixArray(void) const
106  {
107  return P_mat;
108  }
109 
110  const multi3d< CMat >& getPMatrixDaggerArray(void) const
111  {
112  return P_mat_dag;
113  }
114 
115  const multi2d< CMat >& getQMatrixInvArray(void) const
116  {
117  return Q_mat_inv;
118  }
119 
120  const multi2d< CMat >& getQMatrixDaggerInvArray(void) const
121  {
122  return Q_mat_dag_inv;
123  }
124 
125  const Real& getFactor() const
126  {
127  return fact;
128  }
129 
130  const Real& getInvFactor() const
131  {
132  return invfact;
133  }
134 
135  const multi1d<LatticeColorMatrix>& getLinks(void) const {
136  return u;
137  }
138 
139  inline int getTMax(void) const {
140  return t_max;
141  }
142  private:
143  bool schrTP;
144 
145  Real fact; // tmp holding Nd+Mass
146  Real invfact;
147  Handle< FermState<T,P,Q> > fs;
148  multi1d<LatticeColorMatrix> u;
149 
150  multi3d< int > tsite; // Tsite array - 3d even sites
151 
152  multi3d< CMat > P_mat; // 3d even sites
153  multi3d< CMat > P_mat_dag;
154 
155  multi2d< CMat > Q_mat_inv; // Just one matrix for each spatial site ( 1+P[t=0] )^{-1}
156  multi2d< CMat > Q_mat_dag_inv; // Just one matrix for each spatial site ( 1+P_dag[t=Nt-1])^{-1}
157 
158 
159  CloverTerm APlusFact;
160  CloverFermActParams param;
161 
162  WilsonDslash3D Dw3D;
163  Double logDetTSq;
164  int t_max;
165  };
166 
167 } // End Namespace Chroma
168 
169 #endif
170 #endif
171 #endif
172 
173 #endif
Time-preconditioned Linear Operators.
Support for time preconditioning.
Parameters for Clover fermion action.
Include possibly optimized Clover terms.
Include possibly optimized Wilson dslash.
unsigned j
Definition: ldumul_w.cc:35
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
FloatingPoint< double > Double
Definition: gtest.h:7351
LatticeFermion T
Definition: t_clover.cc:11