CHROMA
unprec_s_cprec_t_wilson_linop_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Unpreconditioned Wilson fermion linear operator
4  */
5 
6 #ifndef UNPREC_S_CPREC_T_WILSON_LINOP_H
7 #define UNPREC_S_CPREC_T_WILSON_LINOP_H
8 
9 #include "qdp_config.h"
10 
11 #if QDP_NS == 4
12 #if QDP_ND == 4
13 #if QDP_NC == 3
14 
15 #include "linearop.h"
16 #include "central_tprec_linop.h"
19 
20 namespace Chroma
21 {
22  //! Wilson Dirac Operator - Unpreconditioned in Space, Centrally Preconditioned in time
23  /*!
24  * \ingroup linop
25  *
26  * This routine is specific to Wilson fermions!
27  *
28  * ~ ~+
29  * This subroutine applies the unpreconditioned matrix M or M the std::vector
30  * Psi,
31  *
32  * { ~
33  * { M(U) . Psi if ISign = PLUS
34  * Chi = {
35  * { ~ +
36  * { M(U) . Psi if ISign = MINUS
37  *
38  */
39 
40  class UnprecSCprecTWilsonLinOp :
41  public UnprecSpaceCentralPrecTimeLinearOperator<LatticeFermion,
42  multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
43  {
44  public:
45  // Typedefs to save typing
46  typedef LatticeFermion T;
47  typedef multi1d<LatticeColorMatrix> P;
48  typedef multi1d<LatticeColorMatrix> Q;
49  typedef PScalar<PColorMatrix<RComplex<REAL>, 3> > CMat; // Useful type: ColorMat with no Outer<>
50  typedef PSpinVector<PColorVector<RComplex<REAL>, 3>, 2> HVec_site; // Useful type: Half Vec with no Outer<>
51  //! Partial constructor
52  UnprecSCprecTWilsonLinOp() {}
53 
54 
55  //! Full constructor with Anisotropy
56  UnprecSCprecTWilsonLinOp(Handle< FermState<T,P,Q> > fs_,
57  const Real& Mass_,
58  const AnisoParam_t& aniso_)
59  {create(fs_,Mass_,aniso_);}
60 
61  //! Destructor is automatic
62  ~UnprecSCprecTWilsonLinOp() {}
63 
64  //! Return the fermion BC object for this linear operator
65  const FermBC<T,P,Q>& getFermBC() const {return fs->getBC();}
66 
67 
68  //! Creation routine with Anisotropy
69  void create(Handle< FermState<T,P,Q> > fs_,
70  const Real& Mass_,
71  const AnisoParam_t& aniso_);
72 
73 
74  //! The time direction
75  int tDir() const {
76  return 3;
77  }
78 
79  //! More efficient -- we discover it is Schroedinger in the
80  // create routine and set the bool. This is just a lookup
81  inline bool schroedingerTP(void) const {
82  return schrTP;
83  }
84 
85  //! Apply inv (C_L)^{-1}
86  void invCLeftLinOp(T& chi, const T& psi, enum PlusMinus isign) const;
87 
88  //! Apply inv (C_R)^{-1}
89  void invCRightLinOp(T& chi, const T& psi, enum PlusMinus isign) const;
90 
91  //! Apply C_L
92  void cLeftLinOp(T& chi, const T& psi, enum PlusMinus isign) const;
93 
94  //! Apply C_R
95  void cRightLinOp(T& chi, const T& psi, enum PlusMinus isign) const;
96 
97  //! Spatial LinOp
98  void spaceLinOp(T& chi, const T& psi, enum PlusMinus isign) const;
99 
100  void derivCLeft(P& ds_u, const T& X, const T& Y, enum PlusMinus isign) const;
101 
102  void derivCRight(P& ds_u, const T& X, const T& Y, enum PlusMinus isign) const;
103 
104  void derivSpace(P& ds_u, const T& X, const T& Y,
105  enum PlusMinus isign) const;
106 
107  void deriv(P& ds_u, const T& X, const T& Y, enum PlusMinus isign) const;
108 
109 
110  //! Flopcounter
111  unsigned long nFlops() const
112  {
113  // QDPIO::cout << "Flopcount Not Yet Implemented " << std::endl;
114  return 0;
115  }
116 
117 
118 
119 
120  //! Get log det ( T^\dag T )
121  Double logDetTDagT(void) const {
122  return logDetTSq;
123  }
124 
125 
126  //! Get the force due to the det T^\dag T bit
127  void derivLogDetTDagT(P& ds_u, enum PlusMinus isign) const;
128 
129  int getTMax() const {
130  return Layout::lattSize()[Nd-1];
131  }
132 
133  private:
134 
135  AnisoParam_t aniso;
136  Real fact; // tmp holding Nd+Mass
137  Real invfact;
138  Real Mass;
139  Handle< FermState<T,P,Q> > fs;
140  multi1d<LatticeColorMatrix> u;
141 
142  multi2d< int > tsite; // One row for each spatial site, one column for each timeslice
143  multi2d< CMat > P_mat; // Same thing but holding the matrices
144  multi2d< CMat > P_mat_dag; // Same thing but holding the matrices
145 
146  multi1d< CMat > Q_mat_inv; // Just one matrix for each spatial site ( 1+P[t=0] )^{-1}
147  multi1d< CMat > Q_mat_dag_inv; // Just one matrix for each spatial site ( 1+P_dag[t=Nt-1])^{-1}
148 
149  WilsonDslash3D Dw3D;
150 
151  Double logDetTSq;
152  bool schrTP;
153 
154  };
155 
156 } // End Namespace Chroma
157 
158 
159 #endif
160 #endif
161 #endif
162 
163 #endif
Time-preconditioned Linear Operators.
Support for time preconditioning.
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 int tDir()
Definition: coulgauge.cc:14
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
FloatingPoint< double > Double
Definition: gtest.h:7351
LatticeFermion T
Definition: t_clover.cc:11
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.