CHROMA
unprec_ovlap_contfrac5d_nonhermop_array_w.cc
Go to the documentation of this file.
1 /* $Id: unprec_ovlap_contfrac5d_nonhermop_array_w.cc,v 3.0 2006-04-03 04:58:52 edwards Exp $
2 * \file
3 * \brief Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator
4 */
5 
6 #include "chromabase.h"
7 #include "linearop.h"
8 
10 
11 namespace Chroma
12 {
13 
14  //! Apply the operator onto a source std::vector
15  /*!
16  * The operator acts on the entire lattice
17  *
18  * \param psi Pseudofermion field (Read)
19  * \param isign Flag ( PLUS | MINUS ) (Read)
20  */
21  void
23  const multi1d<LatticeFermion>& psi,
24  enum PlusMinus isign) const
25  {
26  START_CODE();
27 
28  if ( chi.size() != N5 ) chi.resize(N5);
29 
30  int G5 = Ns*Ns - 1;
31 
32  // This is the upper limit for the index of the 5th dimension, i.e.
33  // it runs from 0 to TwoN. (altogether TwoN + 1 numbers. This
34  // makes sense since N5 is meant to be odd)
35  int TwoN = N5 - 1;
36 
37  // This is our scaling: we evaluate
38  // ( 1 + m_q ) / ( 1 - m_q ) gamma5 + eps
39  //
40  Real mass = ( Real(1) + m_q ) / (Real(1) - m_q);
41 
42  // The sign of the diagonal terms.
43  enum PlusMinus Hsign = isign;
44 
45  /*
46  if( N5%2 == 0 ) {
47  Hsign = 1;
48  }
49  else {
50  Hsign = -1;
51  }
52  */
53 
54  // Run through all the pseudofermion fields:
55  // chi(0) = beta(0)*H*psi(0) + alpha(0)*psi(1)
56  // chi(n) = alpha(n-1)*psi(n-1)
57  // + (-)^n*beta(n)*H*psi(n) + alpha(n)*psi(n+1)
58  // chi(TwoN) = alpha(TwoN-1)*psi(TwoN-1)
59  // + (-)^TwoN*beta(TwoN)*H*psi(TwoN)
60 
61  LatticeFermion tmp;
62  Real pmscale;
63 
64  for(int n = 0; n < TwoN; ++n) {
65  (*M)(tmp, psi[n], Hsign); // tmp1 = M psi[n]
66 
67  // Scale factor and sign for the diagonal term proportional to H
68  // The scale factor should be chosen in conszolotarev5d_w.m such
69  // that scale_fac * gamma5 * M has eigenvalues between -1 and 1
70 
71  // Hsign = -Hsign;
72 
73  pmscale = beta[n]*scale_fac;
74 
75 
76  chi[n] = pmscale*tmp;
77 
78 
79  if( isign == PLUS ) {
80  chi[n] -= alpha[n] * psi[n+1];
81 
82  if( n > 0 ) {
83  chi[n] += alpha[n-1]*psi[n-1];
84  }
85 
86  }
87  else {
88  chi[n] += alpha[n] * psi[n+1];
89 
90  if( n > 0 ) {
91  chi[n] -= alpha[n-1]*psi[n-1];
92  }
93  }
94 
95  if( Hsign == PLUS ) {
96  Hsign = MINUS;
97  }
98  else {
99  Hsign = PLUS;
100  }
101 
102  }
103 
104  // Last Component
105  // chi[N] = mass*gamma5*psi[N] + alpha[N-1]*psi[N-1]
106  chi[TwoN] = mass*psi[TwoN];
107 
108  if( isign == PLUS ) {
109  chi[TwoN] += alpha[TwoN-1]*psi[ TwoN -1 ];
110  }
111  else {
112  chi[TwoN] -= alpha[TwoN-1]*psi[ TwoN -1 ];
113  }
114 
115  // Project out eigenvectors from Source if desired
116  //
117  // (What does this do then? Urs????)
118  LatticeFermion psi_proj;
119  psi_proj = zero;
120 
121  if( NEig > 0 ) {
122  Complex cconsts;
123  for(int i = 0 ; i < NEig; i++) {
124 
125  // Project out eigenvectors in psi_{2N} */
126  cconsts = innerProduct(EigVec[i],psi[TwoN]);
127  psi_proj -= EigVec[i]*cconsts;
128 
129  // The vectors are added into chi_2N
130  chi[TwoN] += cconsts*EigValFunc[i]*EigVec[i];
131 
132  // Project out the eigenvectors from psi_{2N-1} and subtract from chi[N]
133  cconsts = innerProduct(EigVec[i],psi[TwoN-1]);
134  chi[TwoN] -= alpha[TwoN-1]*cconsts*EigVec[i];
135  }
136 
137  // Subtract out projected psi_{N} from chi_{N-1} */
138  chi[TwoN-1] += psi_proj * alpha[TwoN-1];
139  }
140 
141  // Complete the last component
142  // chi(N) = chi(N) + beta_{N}*gamma_5*M*psi_{N}
143  // The other two contributions
144  // chi[N] = mass * gamma[5]*psi[N] + alpha[N-1] * psi[N-1]
145  // have been already calculated above
146 
147  // The contribution beta_{N}*gamma_5*M*psi_{N} is
148  // caluclated only if betaa_{N} != 0 */
149 
150 
151  if( toBool( beta[TwoN] != Real(0) ) ) {
152 
153  // Complete psi_proj
154  psi_proj += psi[TwoN];
155 
156  (*M)(tmp, psi_proj, isign);
157  pmscale = beta[TwoN]*scale_fac;
158  chi[TwoN] += pmscale*tmp;
159 
160  }
161 
162  END_CODE();
163  }
164 
165 } // End Namespace Chroma
166 
Primary include file for CHROMA library code.
void operator()(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
unsigned n
Definition: ldumul_w.cc:36
Linear Operators.
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
int i
Definition: pbg5p_w.cc:55
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()
Double zero
Definition: invbicg.cc:106
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator.