CHROMA
unprec_dwftransf_linop_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Wilson linear operator
3  */
4 
5 #include "chromabase.h"
9 
10 using namespace QDP::Hints;
11 
12 namespace Chroma
13 {
14  void UnprecDWFTransfLinOp::create(Handle< FermState<T,P,Q> > fs,
15  const Real& Mass_,
16  const Real& b5_,
17  const Real& c5_,
18  const SysSolverCGParams& invParam_)
19  {
20  Mass = Mass_;
21  b5 = b5_;
22  c5 = c5_;
23  invParam = invParam_;
24 
25  // Need to create a handle for a wilson linop
26  QDPIO::cout << "Creating UnprecDWFTransfLinOp with ";
27  QDPIO::cout << " b5=" << b5 << " c5=" << c5 << " Mass=" << Mass;
28  QDPIO::cout << " RsdCG=" << invParam.RsdCG << std::endl;
29 
30 
31  Real b5_minus_c5 = b5 - c5;
32  D_w = new UnprecWilsonLinOp(fs, Mass_);
33  D_denum = new UnprecDWFTransfDenLinOp(b5_minus_c5, D_w);
34  fbc = fs->getFermBC();
35  }
36 
37 
38 
39  void UnprecDWFTransfLinOp::operator() (LatticeFermion& chi, const LatticeFermion& psi,
40  enum PlusMinus isign) const
41  {
42  START_CODE();
43 
45 
46  // OK Copy from SZIN Code. DOn't DO hermitian op... just do the D's
47  switch(isign)
48  {
49  case PLUS:
50  {
51  // Apply chi = (b5+c5)* gamma_5 * D_w * [ D_denum ]^{-1} * psi
52  (*D_denum)(chi, psi, MINUS);
53  LatticeFermion tmp; moveToFastMemoryHint(tmp);
54 
55  tmp = psi;
56 
57  res = InvCG2(*D_denum,
58  chi,
59  tmp,
60  invParam.RsdCG,
61  invParam.MaxCG);
62  (*D_w)(chi, tmp, PLUS);
63 
64  break;
65  }
66  case MINUS:
67  {
68  // Apply chi = (b5+c5) * gamma_5 * D_w * [D_denum]^(-1) * gamma_5 * psi
69  LatticeFermion tmp; moveToFastMemoryHint(tmp);
70  chi = GammaConst<Ns,Ns*Ns-1>()*psi;
71  (*D_denum)(tmp, chi, MINUS);
72 
73  res = InvCG2(*D_denum,
74  tmp,
75  chi,
76  invParam.RsdCG,
77  invParam.MaxCG);
78 
79  (*D_w)(tmp, chi, PLUS);
80  chi = GammaConst<Ns,Ns*Ns-1>()*tmp;
81  break;
82  }
83  default:
84  {
85  QDPIO::cerr << "Bad option " << isign << std::endl;
86  QDP_abort(1);
87  break;
88  }
89  }
90 
91  chi *= (b5 + c5);
92  QDPIO::cout << "UnprecDWFTransfLinOp: ncount= " << res.n_count << std::endl;
93  END_CODE();
94  }
95 
96 
97 
98  //------------------------------------------------------------------------
99 
100  void UnprecDWFTransfMdagMLinOp::create(Handle< FermState<T,P,Q> > fs,
101  const Real& Mass_,
102  const Real& b5_,
103  const Real& c5_,
104  const SysSolverCGParams& invParam_)
105  {
106  Mass = Mass_;
107  b5 = b5_;
108  c5 = c5_;
109  invParam = invParam_;
110 
111  // Need to create a handle for a wilson linop
112  QDPIO::cout << "Creating UnprecDWFTransfMdagMLinOp with ";
113  QDPIO::cout << " b5=" << b5 << " c5=" << c5 << " Mass=" << Mass;
114  QDPIO::cout << " RsdCG=" << invParam.RsdCG << std::endl;
115 
116  Real b5_minus_c5 = b5 - c5;
117  D_w = new UnprecWilsonLinOp(fs, Mass_);
118  D_denum = new UnprecDWFTransfDenLinOp(b5_minus_c5, D_w);
119  fbc = fs->getFermBC();
120  }
121 
122 
123 
124  void UnprecDWFTransfMdagMLinOp::operator() (LatticeFermion& chi, const LatticeFermion& psi,
125  enum PlusMinus isign) const
126  {
127  START_CODE();
128 
129  int n_count;
130 
131  // Apply chi = (b5+c5)^2 * gamma_5 * D_w * [ D_denum^dag * D_denum ]^{-1} * gamma_5 * D_w * psi
132  LatticeFermion tmp; moveToFastMemoryHint(tmp);
133  (*D_w)(chi, psi, PLUS);
134  tmp = GammaConst<Ns,Ns*Ns-1>()*chi;
135 
136  chi = tmp;
137  InvCG2(*D_denum,
138  tmp,
139  chi,
140  invParam.RsdCG,
141  invParam.MaxCG);
142 
143  (*D_w)(tmp, chi, PLUS);
144  chi = GammaConst<Ns,Ns*Ns-1>()*tmp;
145  chi *= Real((b5 + c5)*(b5 + c5));
146 
147  QDPIO::cout << "UnprecDWFTransfMdagMLinOp: ncount= " << n_count << std::endl;
148  END_CODE();
149  }
150 
151 } // End Namespace Chroma
152 
Primary include file for CHROMA library code.
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Operator to apply the denominator.
Unpreconditioned Wilson-Dirac operator.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Definition: invcg2.cc:240
Real Mass
Conjugate-Gradient algorithm for a generic Linear Operator.
Double tmp
Definition: meslate.cc:60
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
int n_count
Definition: pade_trln_w.cc:69
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Unpreconditioned Wilson fermion linear operator.
Unpreconditioned Wilson fermion linear operator.