QDP++
sse_fused_spin_proj.h
Go to the documentation of this file.
1#ifndef SSE_FUSED_SPIN_PROJ_H
2#define SSE_FUSED_SPIN_PROJ_H
3
4
5#include "sse_mult_adj_su3_mat_hwvec.h"
6
7#include <iostream>
8using namespace std;
9
10namespace QDP {
11
12// Convenience Types
17
18/* **************************************************************************
19 * **************************************************************************
20 * FUSED: adj(x)*spinProjectDir0Plus(y)
21 *
22 * All that is below is needed.
23 *
24 * **************************************************************************
25 * ************************************************************************* */
26// This is a struct for adj(x)*spinProjectDir0Plus(y)
27
29{
30 // Boilerplate
32
33 // OK This is an operator() so we can create instances of this
34 // object and treat them as functions()
35 template<class T1, class T2>
37 operator()(const T1 &a, const T2 &b) const
38 {
39 // Print Diagnostics
40 // cout << "FnAdjMultSprojDir0Plus" << endl << flush;
41
42 // Call the appropriate match
43 return (adjMultSprojDir0Plus(a,b));
44 }
45};
46#endif
47
48// This is an operator* that rewrites:
49//
50// from: adj(l)*spinProjectDir0Plus(r)
51// to: FnAdjMultSprojDir0Plus(l,r)
52//
53// The spinProjectDir0Plus gets grabbed and turned into an op identity
54// adj(l) gets grabbed and turned into an op identity
55// the operation is encoded in the FnAdjMultSprojDir0Plus
56//
57
58template<class T1,class C1,class T2,class C2>
59inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir0Plus,
61 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
63operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
64 const QDPExpr<UnaryNode<FnSpinProjectDir0Plus,T2>,C2> & r)
65{
66 // Print Diagnostics
67 // cout << "FnAdjMultSprojDir0Plus(l,r) <- adj(l)*FnSpinProjectDir0Plus(r)" << endl;
68
69 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
70 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
71
72 // A name for the new node: Tree_t
73 typedef BinaryNode<FnAdjMultSprojDir0Plus,
75 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
76
77 // Create the result: Tree_t = Binary node
78 // Return type is the return type defined in structs below
79 // The CreateLeaf-s do the rewriting -
80 // unwrap the previous expression and rewrap it as the new type
82 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
83 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
84 )
85 );
86}
87
88// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
89template<>
93
94// This is what you need to specialise now. It'll get called by
95// the operator() of the FnAdjMultSprojDir0Plus struct
96template<typename T1, typename T2>
97inline
99adjMultSprojDir0Plus(const T1& a, const T2& b)
100{
102
103 tmp = spinProjectDir0Plus(b);
104 return( adj(a)*tmp );
105}
106
107// This is what you need to specialise now. It'll get called by
108// the operator() of the FnAdjMultSprojDir0Plus struct
109template<>
110inline
111BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir0Plus >::Type_t
113{
116
117
118 inlineSpinProjDir0Plus(&(b.elem(0).elem(0).real()),
119 &(d.elem(0).elem(0).real()),
120 1);
121
122 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
123 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
124 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
125
126 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
127
128
129 return ret;
130}
131
132
133/* **************************************************************************
134 * **************************************************************************
135 * FUSED: adj(x)*spinProjectDir0Minus(y)
136 *
137 * All that is below is needed.
138 *
139 * **************************************************************************
140 * ************************************************************************* */
141
142// This is a struct for adj(x)*spinProjectDir0Minus(y)
143struct FnAdjMultSprojDir0Minus
144{
145 // Boilerplate
146 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir0Minus)
147
148 // OK This is an operator() so we can create instances of this
149 // object and treat them as functions()
150 template<class T1, class T2>
152 operator()(const T1 &a, const T2 &b) const
153 {
154 // Call the appropriate match
155 return (adjMultSprojDir0Minus(a,b));
156 }
157};
158
159
160// This is an operator* that rewrites:
161//
162// from: adj(l)*spinProjectDir0Minus(r)
163// to: FnAdjMultSprojDir0Minus(l,r)
164//
165// The spinProjectDir0Minus gets grabbed and turned into an op identity
166// adj(l) gets grabbed and turned into an op identity
167// the operation is encoded in the FnAdjMultSprojDir0Minus
168//
169
170template<class T1,class C1,class T2,class C2>
171inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir0Minus,
172 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
173 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
175operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
176 const QDPExpr<UnaryNode<FnSpinProjectDir0Minus,T2>,C2> & r)
177{
178 // Print Diagnostics
179 // cout << "FnAdjMultSprojDir0Minus(l,r) <- adj(l)*FnSpinProjectDir0Minus(r)" << endl;
180
181 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
182 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
183
184 // A name for the new node: Tree_t
185 typedef BinaryNode<FnAdjMultSprojDir0Minus,
186 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
187 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
188
189 // Create the result: Tree_t = Binary node
190 // Return type is the return type defined in structs below
191 // The CreateLeaf-s do the rewriting -
192 // unwrap the previous expression and rewrap it as the new type
194 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
195 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
196 )
197 );
198}
199
200// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
201template<>
205
206// This is what you need to specialise now. It'll get called by
207// the operator() of the FnAdjMultSprojDir0Minus struct
208template<typename T1, typename T2>
209inline
211adjMultSprojDir0Minus(const T1& a, const T2& b)
212{
214
215 tmp = spinProjectDir0Minus(b);
216 return( adj(a)*tmp );
217}
218
219// This is what you need to specialise now. It'll get called by
220// the operator() of the FnAdjMultSprojDir0Minus struct
221template<>
222inline
223BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir0Minus >::Type_t
225{
228
229 inlineSpinProjDir0Minus(&(b.elem(0).elem(0).real()),
230 &(d.elem(0).elem(0).real()),
231 1);
232
233 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
234 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
235 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
236
237 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
238
239 return ret;
240}
241
242
243/* **************************************************************************
244 * **************************************************************************
245 * FUSED: adj(x)*spinProjectDir1Plus(y)
246 *
247 * All that is below is needed.
248 *
249 * **************************************************************************
250 * ************************************************************************* */
251
252// This is a struct for adj(x)*spinProjectDir1Plus(y)
253struct FnAdjMultSprojDir1Plus
254{
255 // Boilerplate
256 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir1Plus)
257
258 // OK This is an operator() so we can create instances of this
259 // object and treat them as functions()
260 template<class T1, class T2>
262 operator()(const T1 &a, const T2 &b) const
263 {
264 // Call the appropriate match
265 return (adjMultSprojDir1Plus(a,b));
266 }
267};
268
269
270// This is an operator* that rewrites:
271//
272// from: adj(l)*spinProjectDir1Plus(r)
273// to: FnAdjMultSprojDir1Plus(l,r)
274//
275// The spinProjectDir1Plus gets grabbed and turned into an op identity
276// adj(l) gets grabbed and turned into an op identity
277// the operation is encoded in the FnAdjMultSprojDir1Plus
278//
279
280template<class T1,class C1,class T2,class C2>
281inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir1Plus,
282 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
283 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
285operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
286 const QDPExpr<UnaryNode<FnSpinProjectDir1Plus,T2>,C2> & r)
287{
288 // Print Diagnostics
289 // cout << "FnAdjMultSprojDir1Plus(l,r) <- adj(l)*FnSpinProjectDir1Plus(r)" << endl;
290
291 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
292 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
293
294 // A name for the new node: Tree_t
295 typedef BinaryNode<FnAdjMultSprojDir1Plus,
296 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
297 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
298
299 // Create the result: Tree_t = Binary node
300 // Return type is the return type defined in structs below
301 // The CreateLeaf-s do the rewriting -
302 // unwrap the previous expression and rewrap it as the new type
304 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
305 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
306 )
307 );
308}
309
310// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
311template<>
315
316// This is what you need to specialise now. It'll get called by
317// the operator() of the FnAdjMultSprojDir1Plus struct
318template<typename T1, typename T2>
319inline
321adjMultSprojDir1Plus(const T1& a, const T2& b)
322{
324
325 tmp = spinProjectDir1Plus(b);
326 return( adj(a)*tmp );
327}
328
329// This is what you need to specialise now. It'll get called by
330// the operator() of the FnAdjMultSprojDir1Plus struct
331template<>
332inline
333BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir1Plus >::Type_t
335{
338
339 inlineSpinProjDir1Plus(&(b.elem(0).elem(0).real()),
340 &(d.elem(0).elem(0).real()),
341 1);
342
343
344 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
345 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
346 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
347
348 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
349
350 return ret;
351}
352
353/* **************************************************************************
354 * **************************************************************************
355 * FUSED: adj(x)*spinProjectDir1Minus(y)
356 *
357 * All that is below is needed.
358 *
359 * **************************************************************************
360 * ************************************************************************* */
361
362
363// This is a struct for adj(x)*spinProjectDir1Minus(y)
364struct FnAdjMultSprojDir1Minus
365{
366 // Boilerplate
367 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir1Minus)
368
369 // OK This is an operator() so we can create instances of this
370 // object and treat them as functions()
371 template<class T1, class T2>
373 operator()(const T1 &a, const T2 &b) const
374 {
375
376 // Call the appropriate match
377 return (adjMultSprojDir1Minus(a,b));
378 }
379};
380
381
382// This is an operator* that rewrites:
383//
384// from: adj(l)*spinProjectDir1Minus(r)
385// to: FnAdjMultSprojDir1Minus(l,r)
386//
387// The spinProjectDir1Minus gets grabbed and turned into an op identity
388// adj(l) gets grabbed and turned into an op identity
389// the operation is encoded in the FnAdjMultSprojDir1Minus
390//
391
392template<class T1,class C1,class T2,class C2>
393inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir1Minus,
394 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
395 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
397operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
398 const QDPExpr<UnaryNode<FnSpinProjectDir1Minus,T2>,C2> & r)
399{
400 // Print Diagnostics
401 // cout << "FnAdjMultSprojDir1Minus(l,r) <- adj(l)*FnSpinProjectDir1Minus(r)" << endl;
402
403 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
404 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
405
406 // A name for the new node: Tree_t
407 typedef BinaryNode<FnAdjMultSprojDir1Minus,
408 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
409 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
410
411 // Create the result: Tree_t = Binary node
412 // Return type is the return type defined in structs below
413 // The CreateLeaf-s do the rewriting -
414 // unwrap the previous expression and rewrap it as the new type
416 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
417 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
418 )
419 );
420}
421
422// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
423template<>
427
428// This is what you need to specialise now. It'll get called by
429// the operator() of the FnAdjMultSprojDir1Minus struct
430template<typename T1, typename T2>
431inline
433adjMultSprojDir1Minus(const T1& a, const T2& b)
434{
436
437 tmp = spinProjectDir1Minus(b);
438 return( adj(a)*tmp );
439}
440
441// This is what you need to specialise now. It'll get called by
442// the operator() of the FnAdjMultSprojDir1Minus struct
443template<>
444inline
445BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir1Minus >::Type_t
447{
450
451
452 inlineSpinProjDir1Minus(&(b.elem(0).elem(0).real()),
453 &(d.elem(0).elem(0).real()),
454 1);
455
456 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
457 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
458 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
459
460 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
461
462 return ret;
463}
464
465/* **************************************************************************
466 * **************************************************************************
467 * FUSED: adj(x)*spinProjectDir2Plus(y)
468 *
469 * All that is below is needed.
470 *
471 * **************************************************************************
472 * ************************************************************************* */
473
474
475// This is a struct for adj(x)*spinProjectDir2Plus(y)
476struct FnAdjMultSprojDir2Plus
477{
478 // Boilerplate
479 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir2Plus)
480
481 // OK This is an operator() so we can create instances of this
482 // object and treat them as functions()
483 template<class T1, class T2>
485 operator()(const T1 &a, const T2 &b) const
486 {
487 // Call the appropriate match
488 return (adjMultSprojDir2Plus(a,b));
489 }
490};
491
492
493// This is an operator* that rewrites:
494//
495// from: adj(l)*spinProjectDir2Plus(r)
496// to: FnAdjMultSprojDir2Plus(l,r)
497//
498// The spinProjectDir2Plus gets grabbed and turned into an op identity
499// adj(l) gets grabbed and turned into an op identity
500// the operation is encoded in the FnAdjMultSprojDir2Plus
501//
502
503template<class T1,class C1,class T2,class C2>
504inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir2Plus,
505 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
506 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
508operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
509 const QDPExpr<UnaryNode<FnSpinProjectDir2Plus,T2>,C2> & r)
510{
511 // Print Diagnostics
512 // cout << "FnAdjMultSprojDir2Plus(l,r) <- adj(l)*FnSpinProjectDir2Plus(r)" << endl;
513
514 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
515 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
516
517 // A name for the new node: Tree_t
518 typedef BinaryNode<FnAdjMultSprojDir2Plus,
519 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
520 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
521
522 // Create the result: Tree_t = Binary node
523 // Return type is the return type defined in structs below
524 // The CreateLeaf-s do the rewriting -
525 // unwrap the previous expression and rewrap it as the new type
527 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
528 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
529 )
530 );
531}
532
533// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
534template<>
538
539// This is what you need to specialise now. It'll get called by
540// the operator() of the FnAdjMultSprojDir2Plus struct
541template<typename T1, typename T2>
542inline
544adjMultSprojDir2Plus(const T1& a, const T2& b)
545{
547
548 tmp = spinProjectDir2Plus(b);
549 return( adj(a)*tmp );
550}
551
552// This is what you need to specialise now. It'll get called by
553// the operator() of the FnAdjMultSprojDir2Plus struct
554template<>
555inline
556BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir2Plus >::Type_t
558{
561
562 inlineSpinProjDir2Plus(&(b.elem(0).elem(0).real()),
563 &(d.elem(0).elem(0).real()),
564 1);
565
566 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
567 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
568 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
569
570 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
571
572
573 return ret;
574}
575
576/* **************************************************************************
577 * **************************************************************************
578 * FUSED: adj(x)*spinProjectDir2Minus(y)
579 *
580 * All that is below is needed.
581 *
582 * **************************************************************************
583 * ************************************************************************* */
584// This is a struct for adj(x)*spinProjectDir2Minus(y)
585struct FnAdjMultSprojDir2Minus
586{
587 // Boilerplate
588 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir2Minus)
589
590 // OK This is an operator() so we can create instances of this
591 // object and treat them as functions()
592 template<class T1, class T2>
594 operator()(const T1 &a, const T2 &b) const
595 {
596
597 // Call the appropriate match
598 return (adjMultSprojDir2Minus(a,b));
599 }
600};
601
602
603// This is an operator* that rewrites:
604//
605// from: adj(l)*spinProjectDir2Minus(r)
606// to: FnAdjMultSprojDir2Minus(l,r)
607//
608// The spinProjectDir2Minus gets grabbed and turned into an op identity
609// adj(l) gets grabbed and turned into an op identity
610// the operation is encoded in the FnAdjMultSprojDir2Minus
611//
612
613template<class T1,class C1,class T2,class C2>
614inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir2Minus,
615 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
616 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
618operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
619 const QDPExpr<UnaryNode<FnSpinProjectDir2Minus,T2>,C2> & r)
620{
621 // Print Diagnostics
622 // cout << "FnAdjMultSprojDir2Minus(l,r) <- adj(l)*FnSpinProjectDir2Minus(r)" << endl;
623
624 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
625 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
626
627 // A name for the new node: Tree_t
628 typedef BinaryNode<FnAdjMultSprojDir2Minus,
629 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
630 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
631
632 // Create the result: Tree_t = Binary node
633 // Return type is the return type defined in structs below
634 // The CreateLeaf-s do the rewriting -
635 // unwrap the previous expression and rewrap it as the new type
637 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
638 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
639 )
640 );
641}
642
643// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
644template<>
648
649// This is what you need to specialise now. It'll get called by
650// the operator() of the FnAdjMultSprojDir2Minus struct
651template<typename T1, typename T2>
652inline
654adjMultSprojDir2Minus(const T1& a, const T2& b)
655{
657
658 tmp = spinProjectDir2Minus(b);
659 return( adj(a)*tmp );
660}
661
662// This is what you need to specialise now. It'll get called by
663// the operator() of the FnAdjMultSprojDir2Minus struct
664template<>
665inline
666BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir2Minus >::Type_t
668{
671
672 inlineSpinProjDir2Minus(&(b.elem(0).elem(0).real()),
673 &(d.elem(0).elem(0).real()),
674 1);
675
676 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
677 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
678 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
679
680 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
681
682 return ret;
683}
684
685/* **************************************************************************
686 * **************************************************************************
687 * FUSED: adj(x)*spinProjectDir3Plus(y)
688 *
689 * All that is below is needed.
690 *
691 * **************************************************************************
692 * ************************************************************************* */
693// This is a struct for adj(x)*spinProjectDir3Plus(y)
694struct FnAdjMultSprojDir3Plus
695{
696 // Boilerplate
697 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir3Plus)
698
699 // OK This is an operator() so we can create instances of this
700 // object and treat them as functions()
701 template<class T1, class T2>
703 operator()(const T1 &a, const T2 &b) const
704 {
705 // Call the appropriate match
706 return (adjMultSprojDir3Plus(a,b));
707 }
708};
709
710
711// This is an operator* that rewrites:
712//
713// from: adj(l)*spinProjectDir3Plus(r)
714// to: FnAdjMultSprojDir3Plus(l,r)
715//
716// The spinProjectDir3Plus gets grabbed and turned into an op identity
717// adj(l) gets grabbed and turned into an op identity
718// the operation is encoded in the FnAdjMultSprojDir3Plus
719//
720
721template<class T1,class C1,class T2,class C2>
722inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir3Plus,
723 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
724 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
726operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
727 const QDPExpr<UnaryNode<FnSpinProjectDir3Plus,T2>,C2> & r)
728{
729 // Print Diagnostics
730 // cout << "FnAdjMultSprojDir3Plus(l,r) <- adj(l)*FnSpinProjectDir3Plus(r)" << endl;
731
732 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
733 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
734
735 // A name for the new node: Tree_t
736 typedef BinaryNode<FnAdjMultSprojDir3Plus,
737 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
738 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
739
740 // Create the result: Tree_t = Binary node
741 // Return type is the return type defined in structs below
742 // The CreateLeaf-s do the rewriting -
743 // unwrap the previous expression and rewrap it as the new type
745 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
746 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
747 )
748 );
749}
750
751// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
752template<>
756
757// This is what you need to specialise now. It'll get called by
758// the operator() of the FnAdjMultSprojDir3Plus struct
759template<typename T1, typename T2>
760inline
762adjMultSprojDir3Plus(const T1& a, const T2& b)
763{
765
766 tmp = spinProjectDir3Plus(b);
767 return( adj(a)*tmp );
768}
769
770// This is what you need to specialise now. It'll get called by
771// the operator() of the FnAdjMultSprojDir3Plus struct
772template<>
773inline
774BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir3Plus >::Type_t
776{
779
780 inlineSpinProjDir3Plus(&(b.elem(0).elem(0).real()),
781 &(d.elem(0).elem(0).real()),
782 1);
783
784
785 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
786 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
787 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
788
789 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
790
791 return ret;
792}
793
794/* **************************************************************************
795 * **************************************************************************
796 * FUSED: adj(x)*spinProjectDir3Minus(y)
797 *
798 * All that is below is needed.
799 *
800 * **************************************************************************
801 * ************************************************************************* */
802
803// This is a struct for adj(x)*spinProjectDir3Minus(y)
804struct FnAdjMultSprojDir3Minus
805{
806 // Boilerplate
807 PETE_EMPTY_CONSTRUCTORS(FnAdjMultSprojDir3Minus)
808
809 // OK This is an operator() so we can create instances of this
810 // object and treat them as functions()
811 template<class T1, class T2>
813 operator()(const T1 &a, const T2 &b) const
814 {
815
816 // Call the appropriate match
817 return (adjMultSprojDir3Minus(a,b));
818 }
819};
820
821
822// This is an operator* that rewrites:
823//
824// from: adj(l)*spinProjectDir3Minus(r)
825// to: FnAdjMultSprojDir3Minus(l,r)
826//
827// The spinProjectDir3Minus gets grabbed and turned into an op identity
828// adj(l) gets grabbed and turned into an op identity
829// the operation is encoded in the FnAdjMultSprojDir3Minus
830//
831
832template<class T1,class C1,class T2,class C2>
833inline typename MakeReturn<BinaryNode<FnAdjMultSprojDir3Minus,
834 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
835 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t>,
837operator*(const QDPExpr<UnaryNode<FnAdjoint,T1>,C1> & l,
838 const QDPExpr<UnaryNode<FnSpinProjectDir3Minus,T2>,C2> & r)
839{
840 // Print Diagnostics
841 // cout << "FnAdjMultSprojDir3Minus(l,r) <- adj(l)*FnSpinProjectDir3Minus(r)" << endl;
842
843 typedef UnaryNode<OpIdentity,T1> NewExpr1_t; // Shorthand for the new type for adj(l)
844 typedef UnaryNode<OpIdentity,T2> NewExpr2_t; // Shorthand for the new type for spinProj
845
846 // A name for the new node: Tree_t
847 typedef BinaryNode<FnAdjMultSprojDir3Minus,
848 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T1>,C1> >::Leaf_t,
849 typename CreateLeaf<QDPExpr<UnaryNode<OpIdentity,T2>,C2> >::Leaf_t> Tree_t;
850
851 // Create the result: Tree_t = Binary node
852 // Return type is the return type defined in structs below
853 // The CreateLeaf-s do the rewriting -
854 // unwrap the previous expression and rewrap it as the new type
856 CreateLeaf<QDPExpr<NewExpr1_t,C1> >::make(NewExpr1_t(l.expression().child())),
857 CreateLeaf<QDPExpr<NewExpr2_t,C2> >::make(NewExpr2_t(r.expression().child()))
858 )
859 );
860}
861
862// Return types Fused su3*spinProj(Spin4_32)->Spin2_32
863template<>
867
868// This is what you need to specialise now. It'll get called by
869// the operator() of the FnAdjMultSprojDir3Minus struct
870template<typename T1, typename T2>
871inline
873adjMultSprojDir3Minus(const T1& a, const T2& b)
874{
876
877 tmp = spinProjectDir3Minus(b);
878 return( adj(a)*tmp );
879}
880
881// This is what you need to specialise now. It'll get called by
882// the operator() of the FnAdjMultSprojDir3Minus struct
883template<>
884inline
885BinaryReturn<PScalar<ColMat32>, Spin4_32, FnAdjMultSprojDir3Minus >::Type_t
887{
890
891 inlineSpinProjDir3Minus(&(b.elem(0).elem(0).real()),
892 &(d.elem(0).elem(0).real()),
893 1);
894
895 su3_matrixf *am = (su3_matrixf *)&(a.elem().elem(0,0).real());
896 half_wilson_vectorf *dh = (half_wilson_vectorf *)&(d.elem(0).elem(0).real());
897 half_wilson_vectorf *reth = (half_wilson_vectorf *)&(ret.elem(0).elem(0).real());
898
899 intrin_sse_mult_adj_su3_mat_hwvec(am, dh, reth);
900
901 return ret;
902}
903
904
905} // namespace QDP;
906
907#endif
#define PETE_EMPTY_CONSTRUCTORS(CLASS)
Definition PETE.h:58
Primitive color Matrix class.
Primitive color Vector class.
Primitive Scalar.
Primitive spin Vector class.
T & elem(int i)
Yet another random number generator.
MakeReturn< UnaryNode< FnAdjoint, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnAdjoint >::Type_t >::Expression_t adj(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4842
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
BinaryReturn< T1, T2, FnAdjMultSprojDir3Minus >::Type_t adjMultSprojDir3Minus(const T1 &a, const T2 &b)
PSpinVector< ColVec32, 2 > Spin2_32
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
BinaryReturn< T1, T2, FnAdjMultSprojDir0Minus >::Type_t adjMultSprojDir0Minus(const T1 &a, const T2 &b)
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
PColorMatrix< RComplex< REAL32 >, 3 > ColMat32
MakeReturn< BinaryNode< OpMultiply, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpMultiply >::Type_t >::Expression_t operator*(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2588
BinaryReturn< T1, T2, FnAdjMultSprojDir2Plus >::Type_t adjMultSprojDir2Plus(const T1 &a, const T2 &b)
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
BinaryReturn< T1, T2, FnAdjMultSprojDir1Minus >::Type_t adjMultSprojDir1Minus(const T1 &a, const T2 &b)
void inlineSpinProjDir0Minus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1-\gamma_0).
BinaryReturn< T1, T2, FnAdjMultSprojDir0Plus >::Type_t adjMultSprojDir0Plus(const T1 &a, const T2 &b)
PColorVector< RComplex< REAL32 >, 3 > ColVec32
void inlineSpinProjDir0Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_0).
BinaryReturn< T1, T2, FnAdjMultSprojDir2Minus >::Type_t adjMultSprojDir2Minus(const T1 &a, const T2 &b)
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).
PSpinVector< ColVec32, 4 > Spin4_32
void inlineSpinProjDir1Plus(const REAL *src, REAL *dst, unsigned int n_vec)
Spin Project (1/2)(1+\gamma_1).
BinaryReturn< T1, T2, FnAdjMultSprojDir3Plus >::Type_t adjMultSprojDir3Plus(const T1 &a, const T2 &b)
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).
BinaryReturn< T1, T2, FnAdjMultSprojDir1Plus >::Type_t adjMultSprojDir1Plus(const T1 &a, const T2 &b)
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
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
Promote< T1, T2 >::Type_t Type_t
Promote< T1, T2 >::Type_t Type_t
Definition qdp.h:377
BinaryReturn< T1, T2, FnAdjMultSprojDir0Minus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir0Plus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir1Minus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir1Plus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir2Minus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir2Plus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir3Minus >::Type_t operator()(const T1 &a, const T2 &b) const
BinaryReturn< T1, T2, FnAdjMultSprojDir3Plus >::Type_t operator()(const T1 &a, const T2 &b) const