CHROMA
scalar_loops_s.cc
Go to the documentation of this file.
1 
2 #include "chromabase.h"
3 #include"scalar_loops_s.h"
5 
6 namespace Chroma
7 {
8 
9  // Anonymous namespace
10  namespace
11  {
12  // Standard Time Slicery
13  class TimeSliceFunc : public SetFunc
14  {
15  public:
16  TimeSliceFunc(int dir): dir_decay(dir) {}
17 
18  int operator() (const multi1d<int>& coordinate) const {return coordinate[dir_decay];}
19  int numSubsets() const {return Layout::lattSize()[dir_decay];}
20 
21  int dir_decay;
22 
23  private:
24  TimeSliceFunc() {} // hide default constructor
25  };
26  }
27 
28 
29  void local_scalar_loop::compute(LatticeStaggeredFermion & q_source,
30  LatticeStaggeredFermion & psi, int isample)
31  {
32  Set timeslice;
33  timeslice.make(TimeSliceFunc(Nd-1));
34 
35  LatticeComplex TrG_s0 ;
36  TrG_s0 = localInnerProduct(q_source, psi);
37 
38  corr_fn[isample] = sumMulti(TrG_s0, timeslice);
39  corr += corr_fn[isample] ;
40  }
41 
42  //!Calculates the \f$1\otimes1\f$ KS loop using the VKVR trick
43  /* \param psi \f$\psi=M^{-1}\eta\f$
44  \param isample Which noise std::vector \f$\psi\f$ was computed on
45  \param Mass Mass for the Kilcup trick
46  */
47  void local_scalar_kilcup_loop::compute(LatticeStaggeredFermion& psi,
48  int isample, Real mass)
49  {
50  Set timeslice;
51  timeslice.make(TimeSliceFunc(Nd-1));
52 
53  using namespace StagPhases;
54 
55  LatticeComplex TrG_s0;
56  TrG_s0 = 2*mass*localInnerProduct(psi, psi);
57 
58  corr_fn[isample] = sumMulti(TrG_s0, timeslice);
59  corr += corr_fn[isample];
60  }
61 
62 
63  void non_local_scalar_loop::compute(LatticeStaggeredFermion & q_source,
64  LatticeStaggeredFermion & psi, int isample)
65  {
66  Set timeslice;
67  timeslice.make(TimeSliceFunc(Nd-1));
68 
69  LatticeStaggeredFermion psi_sca1 ;
70 
71  // Array to describe shifts in cube
72  multi1d<int> delta(Nd);
73  delta = 0;
74  delta[3] = 1;
75  psi_sca1 = shift_deltaProp(delta, psi);
76  LatticeComplex TrG_s1 ;
77 
78  using namespace StagPhases;
79  TrG_s1 = localInnerProduct(q_source, psi_sca1);
80  // TrG_s1 = alpha(3)*localInnerProduct(q_source, psi_sca1);
81 
82  corr_fn[isample] = sumMulti(TrG_s1, timeslice);
83  corr += corr_fn[isample] ;
84 
85  }
86 
87  void fourlink_scalar_loop::compute(LatticeStaggeredFermion & q_source,
88  LatticeStaggeredFermion & psi, int isample)
89  {
90  Set timeslice;
91  timeslice.make(TimeSliceFunc(Nd-1));
92 
93  LatticeStaggeredFermion psi_sca4;
94  multi1d<int> delta(Nd);
95  delta[0] = delta[1] = delta[2] = delta[3] = 1;
96  psi_sca4 = shift_deltaProp(delta, psi);
97 
98  LatticeComplex TrG_s4;
99  using namespace StagPhases;
100  TrG_s4 = beta(0)*beta(1)*beta(2)*beta(3)*localInnerProduct(q_source, psi_sca4);
101 
102  corr_fn[isample] = sumMulti(TrG_s4, timeslice);
103  corr += corr_fn[isample];
104  }
105 
106  void fourlink_scalar_kilcup_loop::compute(LatticeStaggeredFermion& psi,
107  int isample, Real Mass)
108  {
109  Set timeslice;
110  timeslice.make(TimeSliceFunc(Nd-1));
111 
112  LatticeStaggeredFermion psi_sca4;
113  multi1d<int> delta(Nd);
114  delta[0] = delta[1] = delta[2] = delta[3] = 1;
115  psi_sca4 = shift_deltaProp(delta, psi);
116 
117  LatticeComplex TrG_s4;
118  using namespace StagPhases;
119  TrG_s4 = 2*Mass*beta(0)*beta(1)*beta(2)*beta(3)*localInnerProduct(psi_sca4, psi);
120 
121  corr_fn[isample] = sumMulti(TrG_s4, timeslice);
122  corr += corr_fn[isample];
123  }
124 
125  //now the fuzzed computes, which are the same, basically
126 
127  void local_scalar_loop_fuzz::compute(LatticeStaggeredFermion & q_source,
128  LatticeStaggeredFermion & psi_fuzz,
129  int isample)
130  {
131  Set timeslice;
132  timeslice.make(TimeSliceFunc(Nd-1));
133 
134  LatticeComplex TrG_s0 ;
135  TrG_s0 = localInnerProduct(q_source, psi_fuzz);
136 
137  corr_fn[isample] = sumMulti(TrG_s0, timeslice);
138  corr += corr_fn[isample] ;
139 
140  }
141 
142  /* \brief Calculates the \f$1\otimes1\f$ KS loop using the VKVR trick, with fuzzing
143  \param psi_fuzz \f$\psi_\mathrm{fuzz}=(M^{-1}\eta)_\mathrm{fuzz}\f$
144  \param psi
145  \param isample Which noise std::vector \f$\psi\f$ was computed on
146  \param Mass Mass for the Kilcup trick
147  */
148  void local_scalar_kilcup_loop_fuzz::compute(LatticeStaggeredFermion& psi_fuzz,
149  LatticeStaggeredFermion& psi,
150  int isample, Real mass)
151  {
152  Set timeslice;
153  timeslice.make(TimeSliceFunc(Nd-1));
154 
155  LatticeStaggeredFermion psi_scalar0;
156  psi_scalar0 = psi;
157 
158  using namespace StagPhases;
159 
160  LatticeComplex TrG_s0;
161  TrG_s0 = 2*mass*localInnerProduct(psi_scalar0, psi_fuzz);
162 
163  corr_fn[isample] = sumMulti(TrG_s0, timeslice);
164  corr += corr_fn[isample];
165  }
166 
167  void non_local_scalar_loop_fuzz::compute(LatticeStaggeredFermion & q_source,
168  LatticeStaggeredFermion & psi_fuzz,
169  int isample)
170  {
171  Set timeslice;
172  timeslice.make(TimeSliceFunc(Nd-1));
173 
174  LatticeStaggeredFermion psi_sca1 ;
175 
176  // Array to describe shifts in cube
177  multi1d<int> delta(Nd);
178  delta = 0;
179  delta[3] = 1;
180  psi_sca1 = shift_deltaProp(delta, psi_fuzz);
181  LatticeComplex TrG_s1 ;
182 
183  using namespace StagPhases;
184  TrG_s1 = localInnerProduct(q_source, psi_sca1);
185  // TrG_s1 = alpha(3)*localInnerProduct(q_source, psi_sca1);
186 
187  corr_fn[isample] = sumMulti(TrG_s1, timeslice);
188  corr += corr_fn[isample] ;
189 
190  }
191 
192 } // end namespace Chroma
Primary include file for CHROMA library code.
Function object used for constructing the time-slice set.
Definition: barQll_w.h:95
int numSubsets() const
Definition: barQll_w.h:108
int operator()(const multi1d< int > &coordinate) const
Definition: barQll_w.h:99
void compute(LatticeStaggeredFermion &psi_fuzz, LatticeStaggeredFermion &psi, int isample, Real mass)
Do the measurement (with VKVR)
void compute(LatticeStaggeredFermion &psi, int isample, Real mass)
Do the measurement (needs psi, not q_source!)
void compute(LatticeStaggeredFermion &q_source, LatticeStaggeredFermion &psi, int isample)
void compute(LatticeStaggeredFermion &q_source, LatticeStaggeredFermion &psi, int isample)
void compute(LatticeStaggeredFermion &q_source, LatticeStaggeredFermion &psi, int isample)
void compute(LatticeStaggeredFermion &q_source, LatticeStaggeredFermion &psi, int isample)
multi1d< DComplex > corr
Definition: loops_s.h:177
multi2d< DComplex > corr_fn
Definition: loops_s.h:176
LatticeStaggeredFermion shift_deltaProp(multi1d< int > &delta, const LatticeStaggeredFermion &src)
Definition: loops_s.h:120
Function object used for constructing the time-slice set.
Nd
Definition: meslate.cc:74
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
static const LatticeInteger & beta(const int dim)
Definition: stag_phases_s.h:47
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
Definition: pbg5p_w.cc:29
Double mass
Definition: pbg5p_w.cc:54
LatticeFermion psi
Definition: mespbg5p_w.cc:35