CHROMA
transf.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Insertion/Extraction utilities for vectors/fermions/propagators
3  */
4 
5 #include "chromabase.h"
6 #include "util/ferm/transf.h"
7 
8 namespace Chroma
9 {
10  //! Convert (insert) a LatticeColorVector into a LatticeFermion
11  /*!
12  * \ingroup ferm
13  *
14  * \param a Source color std::vector
15  * \param b Destination fermion
16  * \param spin_index Spin index
17  */
18  void CvToFerm(const LatticeColorVectorF& a, LatticeFermionF& b,
19  int spin_index)
20  {
21  pokeSpin(b, a, spin_index);
22  }
23 
24  //! Convert (insert) a LatticeColorVector into a LatticeFermion
25  /*!
26  * \ingroup ferm
27  *
28  * \param a Source color std::vector
29  * \param b Destination fermion
30  * \param spin_index Spin index
31  */
32  void CvToFerm(const LatticeColorVectorD& a, LatticeFermionD& b,
33  int spin_index)
34  {
35  pokeSpin(b, a, spin_index);
36  }
37 
38 
39  //! Convert (insert) a LatticeColorVector into a LatticeStaggeredFermion
40  /*!
41  * \ingroup ferm
42  *
43  * \param a Source color std::vector
44  * \param b Destination fermion
45  */
46  void CvToFerm(const LatticeColorVectorF& a, LatticeStaggeredFermionF& b)
47  {
48  pokeSpin(b, a, 0);
49  }
50 
51  //! Convert (insert) a LatticeColorVector into a LatticeStaggeredFermion
52  /*!
53  * \ingroup ferm
54  *
55  * \param a Source color std::vector
56  * \param b Destination fermion
57  */
58  void CvToFerm(const LatticeColorVectorD& a, LatticeStaggeredFermionD& b)
59  {
60  pokeSpin(b, a, 0);
61  }
62 
63  //! Convert a LatticeStaggeredFermion into a LatticeColorVector (extract)
64  /*!
65  * \ingroup ferm
66  *
67  * \param a Source Fermion
68  * \param b Destination ColorVector
69  */
70  void FermToCv(const LatticeStaggeredFermionD& a, LatticeColorVectorD& b)
71  {
72  b = peekSpin(a, 0);
73  }
74 
75  //! Convert a LatticeStaggeredFermion into a LatticeColorVector (extract)
76  /*!
77  * \ingroup ferm
78  *
79  * \param a Source Fermion
80  * \param b Destination ColorVector
81  */
82  void FermToCv(const LatticeStaggeredFermionF& a, LatticeColorVectorF& b)
83  {
84  b = peekSpin(a,0);
85  }
86 
87 
88 
89  //! Insert a LatticeFermion into a LatticePropagator
90  /*!
91  * \ingroup ferm
92  *
93  * \param a Source fermion
94  * \param b Destination propagator
95  * \param color_index Color index
96  * \param spin_index Spin index
97  */
98  void FermToProp(const LatticeFermionF& a, LatticePropagatorF& b,
99  int color_index, int spin_index)
100  {
101  for(int j = 0; j < Ns; ++j)
102  {
103  LatticeColorMatrixF bb = peekSpin(b, j, spin_index);
104  LatticeColorVectorF aa = peekSpin(a, j);
105 
106  for(int i = 0; i < Nc; ++i)
107  pokeColor(bb, peekColor(aa, i), i, color_index);
108 
109  pokeSpin(b, bb, j, spin_index);
110  }
111  }
112 
113  //! Insert a LatticeFermion into a LatticePropagator
114  /*!
115  * \ingroup ferm
116  *
117  * \param a Source fermion
118  * \param b Destination propagator
119  * \param color_index Color index
120  * \param spin_index Spin index
121  */
122  void FermToProp(const LatticeFermionD& a, LatticePropagatorD& b,
123  int color_index, int spin_index)
124  {
125  for(int j = 0; j < Ns; ++j)
126  {
127  LatticeColorMatrixD bb = peekSpin(b, j, spin_index);
128  LatticeColorVectorD aa = peekSpin(a, j);
129 
130  for(int i = 0; i < Nc; ++i)
131  pokeColor(bb, peekColor(aa, i), i, color_index);
132 
133  pokeSpin(b, bb, j, spin_index);
134  }
135  }
136 
137 #ifndef QDP_IS_QDPJIT_NO_NVPTX
138  //-------------------------------------------------------------------------------
139  //! Insert a LatticeFermion into a LatticeColorVectorSpinMatrix
140  /*!
141  * \ingroup ferm
142  *
143  * \param a Source fermion
144  * \param b Destination propagator
145  * \param color_index Color index
146  * \param spin_index Spin index
147  */
148  void FermToProp(const LatticeFermionF& a, LatticeColorVectorSpinMatrixF& b,
149  int spin_index)
150  {
151  for(int j = 0; j < Ns; ++j)
152  pokeSpin(b, peekSpin(a, j), j, spin_index);
153  }
154 
155 
156  //-------------------------------------------------------------------------------
157  //! Insert a LatticeFermion into a LatticeColorVectorSpinMatrix
158  /*!
159  * \ingroup ferm
160  *
161  * \param a Source fermion
162  * \param b Destination propagator
163  * \param color_index Color index
164  * \param spin_index Spin index
165  */
166  void FermToProp(const LatticeFermionD& a, LatticeColorVectorSpinMatrixD& b,
167  int spin_index)
168  {
169  for(int j = 0; j < Ns; ++j)
170  pokeSpin(b, peekSpin(a, j), j, spin_index);
171  }
172 #endif
173 
174  //! Insert a LatticeStaggeredFermion into a LatticeStaggeredPropagator
175  /*!
176  * \ingroup ferm
177  *
178  * \param a Source fermion
179  * \param b Destination propagator
180  * \param color_index Color index
181  */
182  void FermToProp(const LatticeStaggeredFermionF& a, LatticeStaggeredPropagatorF& b,
183  int color_index)
184  {
185  LatticeColorMatrixF bb = peekSpin(b, 0, 0);
186  LatticeColorVectorF aa = peekSpin(a, 0);
187 
188  for(int i = 0; i < Nc; ++i)
189  pokeColor(bb, peekColor(aa, i), i, color_index);
190 
191  pokeSpin(b, bb, 0, 0);
192  }
193 
194  //! Insert a LatticeStaggeredFermion into a LatticeStaggeredPropagator
195  /*!
196  * \ingroup ferm
197  *
198  * \param a Source fermion
199  * \param b Destination propagator
200  * \param color_index Color index
201  */
202  void FermToProp(const LatticeStaggeredFermionD& a, LatticeStaggeredPropagatorD& b,
203  int color_index)
204  {
205  LatticeColorMatrixD bb = peekSpin(b, 0, 0);
206  LatticeColorVectorD aa = peekSpin(a, 0);
207 
208  for(int i = 0; i < Nc; ++i)
209  pokeColor(bb, peekColor(aa, i), i, color_index);
210 
211  pokeSpin(b, bb, 0, 0);
212  }
213 
214 
215 
216 
217  //! Extract a LatticeFermion from a LatticePropagator
218  /*!
219  * \ingroup ferm
220  *
221  * \param a Source propagator
222  * \param b Destination fermion
223  * \param color_index Color index
224  * \param spin_index Spin index
225  */
226  void PropToFerm(const LatticePropagatorF& b, LatticeFermionF& a,
227  int color_index, int spin_index)
228  {
229  for(int j = 0; j < Ns; ++j)
230  {
231  LatticeColorMatrixF bb = peekSpin(b, j, spin_index);
232  LatticeColorVectorF aa = peekSpin(a, j);
233 
234  for(int i = 0; i < Nc; ++i)
235  pokeColor(aa, peekColor(bb, i, color_index), i);
236 
237  pokeSpin(a, aa, j);
238  }
239  }
240 
241  //! Extract a LatticeFermion from a LatticePropagator
242  /*!
243  * \ingroup ferm
244  *
245  * \param a Source propagator
246  * \param b Destination fermion
247  * \param color_index Color index
248  * \param spin_index Spin index
249  */
250  void PropToFerm(const LatticePropagatorD& b, LatticeFermionD& a,
251  int color_index, int spin_index)
252  {
253  for(int j = 0; j < Ns; ++j)
254  {
255  LatticeColorMatrixD bb = peekSpin(b, j, spin_index);
256  LatticeColorVectorD aa = peekSpin(a, j);
257 
258  for(int i = 0; i < Nc; ++i)
259  pokeColor(aa, peekColor(bb, i, color_index), i);
260 
261  pokeSpin(a, aa, j);
262  }
263  }
264 
265 
266 
267  //! Extract a LatticeStaggeredFermion from a LatticeStaggeredPropagator
268  /*!
269  * \ingroup ferm
270  *
271  * \param a Source propagator
272  * \param b Destination fermion
273  * \param color_index Color index
274  */
275  void PropToFerm(const LatticeStaggeredPropagatorF& b, LatticeStaggeredFermionF& a,
276  int color_index)
277  {
278  LatticeColorMatrixF bb = peekSpin(b, 0, 0);
279  LatticeColorVectorF aa = peekSpin(a, 0);
280 
281  for(int i = 0; i < Nc; ++i)
282  pokeColor(aa, peekColor(bb, i, color_index), i);
283 
284  pokeSpin(a, aa, 0);
285  }
286 
287  //! Extract a LatticeStaggeredFermion from a LatticeStaggeredPropagator
288  /*!
289  * \ingroup ferm
290  *
291  * \param a Source propagator
292  * \param b Destination fermion
293  * \param color_index Color index
294  */
295  void PropToFerm(const LatticeStaggeredPropagatorD& b, LatticeStaggeredFermionD& a,
296  int color_index)
297  {
298  LatticeColorMatrixD bb = peekSpin(b, 0, 0);
299  LatticeColorVectorD aa = peekSpin(a, 0);
300 
301  for(int i = 0; i < Nc; ++i)
302  pokeColor(aa, peekColor(bb, i, color_index), i);
303 
304  pokeSpin(a, aa, 0);
305  }
306 
307 }
Primary include file for CHROMA library code.
void CvToFerm(const LatticeColorVectorF &a, LatticeFermionF &b, int spin_index)
Convert (insert) a LatticeColorVector into a LatticeFermion.
Definition: transf.cc:18
void FermToCv(const LatticeStaggeredFermionD &a, LatticeColorVectorD &b)
Convert a LatticeStaggeredFermion into a LatticeColorVector (extract)
Definition: transf.cc:70
void PropToFerm(const LatticePropagatorF &b, LatticeFermionF &a, int color_index, int spin_index)
Extract a LatticeFermion from a LatticePropagator.
Definition: transf.cc:226
void FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
Definition: transf.cc:98
unsigned j
Definition: ldumul_w.cc:35
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int i
Definition: pbg5p_w.cc:55
Complex a
Definition: invbicg.cc:95
Complex b
Definition: invbicg.cc:96