CHROMA
unprec_ht_contfrac5d_linop_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned H_T kernel continued fraction (5D) operator
3  */
4 
5 #include "chromabase.h"
9 
10 
11 namespace Chroma
12 {
13  // Initialize
14  void
16  const Real& b5, const Real& c5)
17  {
18  scale_fac = b5 + c5;
19  a5 = b5 - c5;
20 
21  D_w = new UnprecWilsonLinOp(state, Real(-OverMass));
23  fbc = state->getFermBC();
24  }
25 
26 
27  //! Apply the operator onto a source std::vector
28  /*!
29  * The operator acts on the entire lattice
30  *
31  * \param psi Pseudofermion field (Read)
32  * \param isign Flag ( PLUS | MINUS ) (Read)
33  */
34  void
36  const multi1d<LatticeFermion>& psi,
37  enum PlusMinus isign) const
38  {
39  START_CODE();
40 
41  if( chi.size() != N5 ) chi.resize(N5);
42 
43  int G5 = Ns*Ns - 1;
44  enum PlusMinus msign = (isign == PLUS) ? MINUS : PLUS;
45 
46  // This is the upper limit for the index of the 5th dimension, i.e.
47  // it runs from 0 to TwoN. (altogether TwoN + 1 numbers. This
48  // makes sense since N5 is ALWAYS odd. )
49  int TwoN = N5 - 1;
50 
51  // This is our scaling: we evaluate
52  // ( 1 + m_q ) / ( 1 - m_q ) gamma5 + eps
53  //
54  Real mass = ( Real(1) + m_q ) / (Real(1) - m_q);
55 
56  // The sign of the diagonal terms.
57  // We flip Hsign BEFORE using it
58  // This makes the first element always have a PLUS sign
59  int Hsign=-1;
60 
61  /* N5 is ALWAYS ODD hence the explicit setting above */
62  /*
63  if( N5%2 == 0 ) {
64  Hsign = 1;
65  }
66  else {
67  Hsign = -1;
68  }
69  */
70 
71  // Run through all the pseudofermion fields:
72  // chi(0) = beta(0)*H*psi(0) + alpha(0)*psi(1)
73  // chi(n) = alpha(n-1)*psi(n-1)
74  // + (-)^n*beta(n)*H*psi(n) + alpha(n)*psi(n+1)
75  // chi(TwoN) = alpha(TwoN-1)*psi(TwoN-1)
76  // + (-)^TwoN*beta(TwoN)*H*psi(TwoN)
77 
78  LatticeFermion tmp1, tmp2; moveToFastMemoryHint(tmp1);
79  moveToFastMemoryHint(tmp2);
80 
81  Real pmscale;
82 
83  for(int n = 0; n < TwoN; ++n) {
84  (*D_w)(tmp1, psi[n], PLUS); // tmp1 = D_w psi[n]
85  tmp2 = Gamma(G5)*tmp1; // tmp2 = gamma_5 D_w psi
86 
87  // Scale factor and sign for the diagonal term proportional to H
88  // The scale factor should be chosen in conszolotarev5d_w.m such
89  // that scale_fac * gamma5 * M has eigenvalues between -1 and 1
90  Hsign = -Hsign;
91  pmscale = beta[n]*Hsign*scale_fac;
92  chi[n] = pmscale*tmp2;
93 
94  if( N5 > 1 ) {
95  (*D_denum)(tmp1, psi[n+1], msign); // tmp1 = D_denum^dag psi[n+1]
96  chi[n] += alpha[n] * tmp1;
97  }
98 
99  if( n > 0 ) {
100  (*D_denum)(tmp1, psi[n-1], msign); // tmp1 = D_denum^dag psi[n-1]
101  chi[n] += alpha[n-1]*tmp1;
102  }
103  }
104 
105  // Last Component
106  // chi[N] = D_denum^msign*(mass*gamma5*psi[N] + alpha[N-1]*psi[N-1])
107  tmp1 = Gamma(G5)*psi[TwoN];
108  (*D_denum)(tmp2, tmp1, MINUS); // NOTE FIXED SIGN HERE
109  chi[TwoN] = mass*tmp2;
110 
111  (*D_denum)(tmp1, psi[TwoN-1], msign); // tmp2 = alpha[TwoN-1]*D_denum^msign * psi[TwoN-1]
112  chi[TwoN] += alpha[TwoN-1]*tmp1;
113 
114  // Complete the last component
115  // chi(N) += beta_{N}*gamma_5*M*psi_{N}
116  // The other two contributions
117  // chi[N] = mass * gamma[5]*psi[N] + alpha[N-1] * psi[N-1]
118  // have been already calculated above
119 
120  // The contribution beta_{N}*gamma_5*M*psi_{N} is
121  // calculated only if beta_{N} != 0 */
122 
123  if( !isLastZeroP )
124  {
125  (*D_w)(tmp1, psi[TwoN], PLUS);
126  pmscale = beta[TwoN]*scale_fac;
127  tmp2 = Gamma(G5)*tmp1;
128  chi[TwoN] += pmscale*tmp2;
129  }
130 
131  getFermBC().modifyF(chi);
132 
133  END_CODE();
134  }
135 
136 } // End Namespace Chroma
137 
138 
Primary include file for CHROMA library code.
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.
void init(Handle< FermState< T, P, Q > > fs, const Real &b5, const Real &c5)
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
void operator()(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
Unpreconditioned Wilson-Dirac operator.
unsigned n
Definition: ldumul_w.cc:36
Double tmp2
Definition: mesq.cc:30
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
Double mass
Definition: pbg5p_w.cc:54
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Unpreconditioned Wilson fermion linear operator.
Unpreconditioned H_T kernel continued fraction (5D) operator.
Unpreconditioned Wilson fermion linear operator.