QDP++
generic_spin_proj.h
Go to the documentation of this file.
1#ifndef GENERIC_SPIN_PROJ_H
2#define GENERIC_SPIN_PROJ_H
3
4#include <stdio.h>
5
6namespace QDP {
9
10//-------------------------
11// Proj Dir=0 Minus
12//-------------------------
13template<>
17
18template<>
21{
23
24 inlineSpinProjDir0Minus(&(s1.elem(0).elem(0).real()),
25 &(d.elem(0).elem(0).real()),
26 1);
27
28
29 return d;
30}
31
32//-------------------------
33// Proj Dir=0 Plus
34//-------------------------
35template<>
39
40template<>
43{
45
46
47 inlineSpinProjDir0Plus(&(s1.elem(0).elem(0).real()),
48 &(d.elem(0).elem(0).real()),
49 1);
50
51
52
53 return d;
54}
55
56//-------------------------
57// Proj Dir=1 Minus
58//-------------------------
59template<>
63
64template<>
67{
69
70 inlineSpinProjDir1Minus(&(s1.elem(0).elem(0).real()),
71 &(d.elem(0).elem(0).real()),
72 1);
73
74
75 return d;
76}
77
78
79//-------------------------
80// Proj Dir=1 Plus
81//-------------------------
82template<>
86
87template<>
90{
92
93 inlineSpinProjDir1Plus(&(s1.elem(0).elem(0).real()),
94 &(d.elem(0).elem(0).real()),
95 1);
96 return d;
97}
98
99
100//-------------------------
101// Proj Dir=2 Minus
102//-------------------------
103template<>
107
108template<>
111{
113
114 /* 1 - \gamma_2 = 1 0 -i 0
115 0 1 0 +i
116 +i 0 1 0
117 0 -i 0 1
118
119
120 * ( b0r + i b0i ) = ( {a0r + a2i} + i{a0i - a2r} )
121 * ( b1r + i b1i ) ( {a1r - a3i} + i{a1i + a3r} )
122 */
123 inlineSpinProjDir2Minus(&(s1.elem(0).elem(0).real()),
124 &(d.elem(0).elem(0).real()),
125 1);
126
127
128 return d;
129}
130
131
132//-------------------------
133// Proj Dir=2 Plus
134//-------------------------
135template<>
139
140template<>
143{
145
146
147 inlineSpinProjDir2Plus(&(s1.elem(0).elem(0).real()),
148 &(d.elem(0).elem(0).real()),
149 1);
150
151
152 return d;
153}
154
155//-------------------------
156// Proj Dir=3 Minus
157//-------------------------
158template<>
162
163
164template<>
167{
169
170 inlineSpinProjDir3Minus(&(s1.elem(0).elem(0).real()),
171 &(d.elem(0).elem(0).real()),
172 1);
173
174 return d;
175}
176
177
178//-------------------------
179// Proj Dir=3 Plus
180//-------------------------
181template<>
185
186template<>
189{
191
192 inlineSpinProjDir3Plus(&(s1.elem(0).elem(0).real()),
193 &(d.elem(0).elem(0).real()),
194 1);
195
196 return d;
197}
198
199#if 0
200template<>
203{
205
206 for(int col=0; col < 3; col++) {
207 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
208 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
209 }
210
211 for(int col=0; col < 3; col++) {
212 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
213 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
214 }
215
216 /* ( 1 0 0 -i) ( a0 ) ( a0 - i a3 )
217 * B := ( 1 - Gamma ) A = ( 0 1 -i 0) ( a1 ) = ( a1 - i a2 )
218 * 0 ( 0 i 1 0) ( a2 ) ( a2 + i a1 )
219 * ( i 0 0 1) ( a3 ) ( a3 + i a0 )
220
221 * The bottom components of be may be reconstructed using the formula
222
223 * ( b2r + i b2i ) = ( {a2r - a1i} + i{a2i + a1r} ) = ( - b1i + i b1r )
224 * ( b3r + i b3i ) ( {a3r - a0i} + i{a3i + a0r} ) ( - b0i + i b0r )
225 */
226
227 for(int col=0; col < 3; col++) {
228 d.elem(2).elem(col).real() = -s1.elem(1).elem(col).imag();
229 d.elem(2).elem(col).imag() = s1.elem(1).elem(col).real();
230 }
231
232 for(int col=0; col < 3; col++) {
233 d.elem(3).elem(col).real() = -s1.elem(0).elem(col).imag();
234 d.elem(3).elem(col).imag() = s1.elem(0).elem(col).real();
235 }
236
237
238 return d;
239}
240
241template<>
244{
246
247 inlineSpinReconDir0Plus(&(s1.elem(0).elem(0).real()),
248 &(d.elem(0).elem(0).real()),
249 1);
250
251
252 return d;
253}
254
255
256template<>
259{
261
262 for(int col=0; col < 3; col++) {
263 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
264 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
265 }
266
267 for(int col=0; col < 3; col++) {
268 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
269 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
270 }
271
272 /* ( 1 0 0 1) ( a0 ) ( a0 + a3 )
273 * B := ( 1 - Gamma ) A = ( 0 1 -1 0) ( a1 ) = ( a1 - a2 )
274 * 1 ( 0 -1 1 0) ( a2 ) ( a2 - a1 )
275 * ( 1 0 0 1) ( a3 ) ( a3 + a0 )
276
277 * The bottom components of be may be reconstructed using the formula
278
279 * ( b2r + i b2i ) = ( {a2r - a1r} + i{a2i - a1i} ) = ( - b1r - i b1i )
280 * ( b3r + i b3i ) ( {a3r + a0r} + i{a3i + a0i} ) ( b0r + i b0i )
281 */
282
283 for(int col=0; col < 3; col++) {
284 d.elem(2).elem(col).real() = -s1.elem(1).elem(col).real();
285 d.elem(2).elem(col).imag() = -s1.elem(1).elem(col).imag();
286 }
287
288 for(int col=0; col < 3; col++) {
289 d.elem(3).elem(col).real() = s1.elem(0).elem(col).real();
290 d.elem(3).elem(col).imag() = s1.elem(0).elem(col).imag();
291 }
292
293
294 return d;
295}
296
297template<>
300{
302
303 for(int col=0; col < 3; col++) {
304 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
305 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
306 }
307
308 for(int col=0; col < 3; col++) {
309 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
310 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
311 }
312 /* 1 + \gamma_1 = 1 0 0 -1
313 0 1 1 0
314 0 1 1 0
315 -1 0 0 1
316
317
318 * ( b2r + i b2i ) = ( {a2r + a1r} + i{a2i + a1i} ) = ( b1r + i b1i )
319 * ( b3r + i b3i ) ( {a3r - a0r} + i{a3i - a0i} ) ( - b0r - i b0i )
320
321 */
322
323 for(int col=0; col < 3; col++) {
324 d.elem(2).elem(col).real() = s1.elem(1).elem(col).real();
325 d.elem(2).elem(col).imag() = s1.elem(1).elem(col).imag();
326 }
327
328 for(int col=0; col < 3; col++) {
329 d.elem(3).elem(col).real() = -s1.elem(0).elem(col).real();
330 d.elem(3).elem(col).imag() = -s1.elem(0).elem(col).imag();
331 }
332
333
334 return d;
335}
336
337
338template<>
341{
343
344 for(int col=0; col < 3; col++) {
345 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
346 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
347 }
348
349 for(int col=0; col < 3; col++) {
350 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
351 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
352 }
353
354 /* ( 1 0 -i 0) ( a0 ) ( a0 - i a2 )
355 * B := ( 1 - Gamma ) A = ( 0 1 0 i) ( a1 ) = ( a1 + i a3 )
356 * 2 ( i 0 1 0) ( a2 ) ( a2 + i a0 )
357 * ( 0 -i 0 1) ( a3 ) ( a3 - i a1 )
358
359 * The bottom components of be may be reconstructed using the formula
360 * ( b2r + i b2i ) = ( {a2r - a0i} + i{a2i + a0r} ) = ( - b0i + i b0r )
361 * ( b3r + i b3i ) ( {a3r + a1i} + i{a3i - a1r} ) ( b1i - i b1r )
362 */
363
364
365 for(int col=0; col < 3; col++) {
366 d.elem(2).elem(col).real() = -s1.elem(0).elem(col).imag();
367 d.elem(2).elem(col).imag() = s1.elem(0).elem(col).real();
368 }
369
370 for(int col=0; col < 3; col++) {
371 d.elem(3).elem(col).real() = s1.elem(1).elem(col).imag();
372 d.elem(3).elem(col).imag() = -s1.elem(1).elem(col).real();
373 }
374
375
376 return d;
377}
378
379template<>
382{
384
385 for(int col=0; col < 3; col++) {
386 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
387 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
388 }
389
390 for(int col=0; col < 3; col++) {
391 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
392 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
393 }
394
395
396 /* 1 + \gamma_2 = 1 0 i 0
397 0 1 0 -i
398 -i 0 1 0
399 0 i 0 1
400
401 * ( b2r + i b2i ) = ( {a2r + a0i} + i{a2i - a0r} ) = ( b0i - i b0r )
402 * ( b3r + i b3i ) ( {a3r - a1i} + i{a3i + a1r} ) ( - b1i + i b1r )
403 */
404
405 for(int col=0; col < 3; col++) {
406 d.elem(2).elem(col).real() = s1.elem(0).elem(col).imag();
407 d.elem(2).elem(col).imag() = -s1.elem(0).elem(col).real();
408 }
409
410 for(int col=0; col < 3; col++) {
411 d.elem(3).elem(col).real() = -s1.elem(1).elem(col).imag();
412 d.elem(3).elem(col).imag() = s1.elem(1).elem(col).real();
413 }
414
415
416 return d;
417}
418
419
420template<>
423{
425
426 for(int col=0; col < 3; col++) {
427 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
428 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
429 }
430
431 for(int col=0; col < 3; col++) {
432 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
433 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
434 }
435
436 /* ( 1 0 -1 0) ( a0 ) ( a0 - a2 )
437 * B := ( 1 - Gamma ) A = ( 0 1 0 -1) ( a1 ) = ( a1 - a3 )
438 * 3 (-1 0 1 0) ( a2 ) ( a2 - a0 )
439 * ( 0 -1 0 1) ( a3 ) ( a3 - a1 )
440
441 * The bottom components of be may be reconstructed using the formula
442 * ( b2r + i b2i ) = ( {a2r - a0r} + i{a2i - a0i} ) = ( - b0r - i b0i )
443 * ( b3r + i b3i ) ( {a3r - a1r} + i{a3i - a1i} ) ( - b1r - i b1i )
444 */
445
446 for(int col=0; col < 3; col++) {
447 d.elem(2).elem(col).real() = -s1.elem(0).elem(col).real();
448 d.elem(2).elem(col).imag() = -s1.elem(0).elem(col).imag();
449 }
450
451 for(int col=0; col < 3; col++) {
452 d.elem(3).elem(col).real() = -s1.elem(1).elem(col).real();
453 d.elem(3).elem(col).imag() = -s1.elem(1).elem(col).imag();
454 }
455
456
457 return d;
458}
459
460template<>
463{
465
466 for(int col=0; col < 3; col++) {
467 d.elem(0).elem(col).real() = s1.elem(0).elem(col).real();
468 d.elem(0).elem(col).imag() = s1.elem(0).elem(col).imag();
469 }
470
471 for(int col=0; col < 3; col++) {
472 d.elem(1).elem(col).real() = s1.elem(1).elem(col).real();
473 d.elem(1).elem(col).imag() = s1.elem(1).elem(col).imag();
474 }
475
476
477 /* ( 1 0 1 0) ( a0 ) ( a0 + a2 )
478 * B := ( 1 + Gamma ) A = ( 0 1 0 1) ( a1 ) = ( a1 + a3 )
479 * 3 ( 1 0 1 0) ( a2 ) ( a2 + a0 )
480 * ( 0 1 0 1) ( a3 ) ( a3 + a1 )
481
482 * The bottom components of be may be reconstructed using the formula
483
484 * ( b2r + i b2i ) = ( {a2r + a0r} + i{a2i + a0i} ) = ( b0r + i b0i )
485 * ( b3r + i b3i ) ( {a3r + a1r} + i{a3i + a1i} ) ( b1r + i b1i )
486 */
487
488 for(int col=0; col < 3; col++) {
489 d.elem(2).elem(col).real() = s1.elem(0).elem(col).real();
490 d.elem(2).elem(col).imag() = s1.elem(0).elem(col).imag();
491 }
492
493 for(int col=0; col < 3; col++) {
494 d.elem(3).elem(col).real() = s1.elem(1).elem(col).real();
495 d.elem(3).elem(col).imag() = s1.elem(1).elem(col).imag();
496 }
497
498
499 return d;
500}
501
502#endif
503
504} // namespace QDP;
505
506#endif
Primitive spin Vector class.
T & elem(int i)
Yet another random number generator.
MakeReturn< UnaryNode< FnSpinProjectDir2Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir2Minus >::Type_t >::Expression_t spinProjectDir2Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5128
MakeReturn< UnaryNode< FnSpinProjectDir1Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir1Minus >::Type_t >::Expression_t spinProjectDir1Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5115
MakeReturn< UnaryNode< FnSpinProjectDir0Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir0Plus >::Type_t >::Expression_t spinProjectDir0Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5050
MakeReturn< UnaryNode< FnSpinReconstructDir2Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir2Minus >::Type_t >::Expression_t spinReconstructDir2Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5232
MakeReturn< UnaryNode< FnSpinReconstructDir2Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir2Plus >::Type_t >::Expression_t spinReconstructDir2Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5180
MakeReturn< UnaryNode< FnSpinProjectDir3Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir3Minus >::Type_t >::Expression_t spinProjectDir3Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5141
PSpinVector< ColVec, 4 > Spin4
void inlineSpinProjDir0Minus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1-\gamma_0).
MakeReturn< UnaryNode< FnSpinReconstructDir0Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir0Plus >::Type_t >::Expression_t spinReconstructDir0Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5154
void inlineSpinProjDir0Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_0).
PSpinVector< ColVec, 2 > Spin2
MakeReturn< UnaryNode< FnSpinReconstructDir1Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir1Plus >::Type_t >::Expression_t spinReconstructDir1Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5167
MakeReturn< UnaryNode< FnSpinReconstructDir1Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir1Minus >::Type_t >::Expression_t spinReconstructDir1Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5219
MakeReturn< UnaryNode< FnSpinProjectDir2Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir2Plus >::Type_t >::Expression_t spinProjectDir2Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5076
void inlineSpinProjDir1Minus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1-\gamma_1).
void inlineSpinProjDir1Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_1).
void inlineSpinProjDir3Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_3).
MakeReturn< UnaryNode< FnSpinProjectDir3Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir3Plus >::Type_t >::Expression_t spinProjectDir3Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5089
void inlineSpinProjDir3Minus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1-\gamma_3).
void inlineSpinProjDir2Minus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1-\gamma_2).
MakeReturn< UnaryNode< FnSpinReconstructDir3Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir3Minus >::Type_t >::Expression_t spinReconstructDir3Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5245
MakeReturn< UnaryNode< FnSpinReconstructDir0Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir0Minus >::Type_t >::Expression_t spinReconstructDir0Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5206
void inlineSpinProjDir2Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_2).
MakeReturn< UnaryNode< FnSpinProjectDir0Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir0Minus >::Type_t >::Expression_t spinProjectDir0Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5102
void inlineSpinReconDir0Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin recon (1/2)(1+\gamma_0).
MakeReturn< UnaryNode< FnSpinReconstructDir3Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir3Plus >::Type_t >::Expression_t spinReconstructDir3Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5193
MakeReturn< UnaryNode< FnSpinProjectDir1Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir1Plus >::Type_t >::Expression_t spinProjectDir1Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5063