QDP++
qdp_scalarsite_generic_blas_g5.h
Go to the documentation of this file.
1// $Id: qdp_scalarsite_generic_blas_g5.h,v 1.9 2009-07-14 20:08:41 bjoo Exp $
2
8
9
10#ifndef QDP_SCALARSITE_GENERIC_BLAS_G5_H
11#define QDP_SCALARSITE_GENERIC_BLAS_G5_H
12
23
24// Types needed for the expression templates.
25// TVec has outer Ns template so it ought to work for staggered as well
28
30// Threading evaluates
31//
32// by Xu Guo, EPCC, 26 August, 2008
34
35// the wrappers for the functions to be threaded
37
38
39// #define DEBUG_BLAS_G6
40// TVec is the LatticeFermion from qdp_dwdefs.h with the OLattice<> stripped
41// from around it
42
43// TScalar is the usual Real, with the OScalar<> stripped from it
44//
45// THis is simply to make the code more readable, and reduces < < s and > >s
46// in the template arguments
48// d += Scalar*ChiralProjPlus(Vec);
49template<>
50inline
52 const OpAddAssign& op,
54 Reference< QDPType< TScal, OScalar < TScal > > >,
56>,
58 const Subset& s)
61#ifdef DEBUG_BLAS_G5
62 QDPIO::cout << "y += a*P{+}x" << endl;
63#endif
64
65 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().right().child());
66 const OScalar< TScal >& a = static_cast<const OScalar< TScal > &> (rhs.expression().left());
67
68
69 REAL ar = a.elem().elem().elem().elem();
70 REAL* aptr = &ar;
71
72 if ( s.hasOrderedRep() ) {
73 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
74 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
75
76 int total_n_4vec = (s.end()-s.start()+1);
77
78 ordered_vaypx3_g5_user_arg a = {yptr, aptr, yptr, xptr, xpayz_g5ProjPlus};
79
81
82
83 // Original code
85 //int n_4vec = (s.end()-s.start()+1);
86 //xpayz_g5ProjPlus(yptr, aptr,yptr, xptr, n_4vec);
87
88 }
89 else {
90 const int* tab = s.siteTable().slice();
91
92 int totalSize = s.numSiteTable();
93
94 int Ns = 1;
101 // Original code
103 /*
104 for(int j=0; j < s.numSiteTable(); j++) {
105 int i=tab[j];
106 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
107 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
108 xpayz_g5ProjPlus(yptr, aptr,yptr, xptr, 1);
109 }*/
110 }
111
112
113}
114
115// d += Scalar*ChiralProjMinus(Vec);
116template<>
117inline
119 const OpAddAssign& op,
121 Reference< QDPType< TScal, OScalar < TScal > > >,
123>,
124 OLattice< TVec > > &rhs,
125 const Subset& s)
126{
127
128#ifdef DEBUG_BLAS_G5
129 QDPIO::cout << "y += a*P{-}x" << endl;
130#endif
131
132 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().right().child());
133 const OScalar< TScal >& a = static_cast<const OScalar< TScal > &> (rhs.expression().left());
136 REAL ar = a.elem().elem().elem().elem();
137 REAL* aptr = &ar;
139 if( s.hasOrderedRep() ) {
140 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
141 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
142
143 int total_n_4vec = (s.end()-s.start()+1);
144
145 ordered_vaypx3_g5_user_arg a = {yptr, aptr, yptr, xptr, xpayz_g5ProjMinus};
146
148
150 // Original code
152 //int n_4vec = (s.end()-s.start()+1);
153 //xpayz_g5ProjMinus(yptr, aptr,yptr, xptr, n_4vec);
154 }
155 else {
156 const int* tab = s.siteTable().slice();
157
158 int totalSize = s.numSiteTable();
159
160 int Ns = 1;
161
165
167 // Original code
168
169 /*
170 for(int j=0; j < s.numSiteTable(); j++) {
171 int i=tab[j];
172 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
173 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
174 xpayz_g5ProjMinus(yptr, aptr,yptr, xptr, 1);
175 }*/
176 }
177
179
180
181// d -= Scalar*ChiralProjPlus(Vec);
182template<>
183inline
185 const OpSubtractAssign& op,
187 Reference< QDPType< TScal, OScalar < TScal > > >,
189>,
190 OLattice< TVec > > &rhs,
191 const Subset& s)
192{
193
194#ifdef DEBUG_BLAS_G5
195 QDPIO::cout << "y -= a*P{+}x" << endl;
196#endif
197
198 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().right().child());
199 const OScalar< TScal >& a = static_cast<const OScalar< TScal > &> (rhs.expression().left());
200
202 REAL ar = a.elem().elem().elem().elem();
203 REAL* aptr = &ar;
204 if( s.hasOrderedRep() ) {
205 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
206 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
207
208 int total_n_4vec = (s.end()-s.start()+1);
209
210 ordered_vaypx3_g5_user_arg a = {yptr, aptr, yptr, xptr, xmayz_g5ProjPlus};
213
215 // Original code
217 //int n_4vec = (s.end()-s.start()+1);
218 //xmayz_g5ProjPlus(yptr, aptr,yptr, xptr, n_4vec);
219 }
220 else {
221 const int* tab = s.siteTable().slice();
222
223 int totalSize = s.numSiteTable();
224
225 int Ns = 1;
226
228
230
231 ////////////////
232 // Original code
234 /*
235 for(int j=0; j < s.numSiteTable(); j++) {
236 int i=tab[j];
237 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
238 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
239 xmayz_g5ProjPlus(yptr, aptr,yptr, xptr, 1);
240 }*/
245// d -= Scalar*ChiralProjMinus(Vec);
246template<>
247inline
249 const OpSubtractAssign& op,
251 Reference< QDPType< TScal, OScalar < TScal > > >,
253>,
254 OLattice< TVec > > &rhs,
255 const Subset& s)
256{
257
258#ifdef DEBUG_BLAS_G5
259 QDPIO::cout << "y -= a*P{-}x" << endl;
260#endif
261
262 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().right().child());
263 const OScalar< TScal >& a = static_cast<const OScalar< TScal > &> (rhs.expression().left());
264
265
266 REAL ar = a.elem().elem().elem().elem();
267 REAL* aptr = &ar;
268
269 if( s.hasOrderedRep() ) {
270 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
271 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
272
273 int total_n_4vec = (s.end()-s.start()+1);
274
275 ordered_vaypx3_g5_user_arg a = {yptr, aptr, yptr, xptr, xmayz_g5ProjMinus};
276
278
280 // Original code
282 //int n_4vec = (s.end()-s.start()+1);
283 //xmayz_g5ProjMinus(yptr, aptr,yptr, xptr, n_4vec);
285 else {
286 const int* tab = s.siteTable().slice();
287
288 int totalSize = s.numSiteTable();
290 int Ns = 1;
291
293
295
297 // Original code
299 /*
300 for(int j=0; j < s.numSiteTable(); j++) {
301 int i=tab[j];
302 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
303 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
304 xmayz_g5ProjMinus(yptr, aptr,yptr, xptr, 1);
305 }*/
306 }
309
310
311// d += ChiralProjPlus(Vec);
312template<>
313inline
315 const OpAddAssign& op,
316 const QDPExpr<
319 const Subset& s)
322#ifdef DEBUG_BLAS_G5
323 QDPIO::cout << "y += P{+}x" << endl;
324#endif
325
326 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().child());
327
328
329 if( s.hasOrderedRep() ) {
330 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
331 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
332
333 int total_n_4vec = (s.end()-s.start()+1);
334
335 ordered_vadd3_g5_user_arg a = {yptr, yptr, xptr, add_g5ProjPlus};
336
338
340 // Original code
342 //int n_4vec = (s.end()-s.start()+1);
343 //add_g5ProjPlus(yptr, yptr, xptr, n_4vec);
344 }
345 else {
346 const int* tab = s.siteTable().slice();
347
348 int totalSize = s.numSiteTable();
349
350 int Ns = 1;
351
357 // Original code
359 /*
360 for(int j=0; j < s.numSiteTable(); j++) {
361 int i=tab[j];
362 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
363 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
364 add_g5ProjPlus(yptr, yptr, xptr, 1);
365 }*/
366 }
367
368}
369
370
371// d += ChiralProjMinus(Vec);
372template<>
373inline
375 const OpAddAssign& op,
376 const QDPExpr<
378 OLattice< TVec > > &rhs,
379 const Subset& s)
380{
381
382#ifdef DEBUG_BLAS_G5
383 QDPIO::cout << "y += P{-}x" << endl;
384#endif
386 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().child());
387
388
389 if( s.hasOrderedRep() ) {
390 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
391 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
392
393 int total_n_4vec = (s.end()-s.start()+1);
394
395 ordered_vadd3_g5_user_arg a = {yptr, yptr, xptr, add_g5ProjMinus};
400 // Original code
402 //int n_4vec = (s.end()-s.start()+1);
403 //add_g5ProjMinus(yptr, yptr, xptr, n_4vec);
404 }
405 else {
406 const int* tab = s.siteTable().slice();
407
408 int totalSize = s.numSiteTable();
409
410 int Ns = 1;
411
413
415
417 // Original code
419 /*
420 for(int j=0; j < s.numSiteTable(); j++) {
421 int i=tab[j];
422 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
423 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
424 add_g5ProjMinus(yptr, yptr, xptr, 1);
425 }*/
426 }
427
428}
429
430
431// d -= ChiralProjPlus(Vec);
432template<>
433inline
435 const OpSubtractAssign& op,
436 const QDPExpr<
439 const Subset& s)
442#ifdef DEBUG_BLAS_G5
443 QDPIO::cout << "y -= P{+}x" << endl;
444#endif
445
446 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().child());
447
448 if( s.hasOrderedRep() ) {
449 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
450 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
451
452 int total_n_4vec = (s.end()-s.start()+1);
453
454 ordered_vadd3_g5_user_arg a = {yptr, yptr, xptr, sub_g5ProjPlus};
455
457
459 // Original code
461 //int n_4vec = (s.end()-s.start()+1);
462 //sub_g5ProjPlus(yptr, yptr, xptr, n_4vec);
464 else {
465 const int* tab = s.siteTable().slice();
466
467 int totalSize = s.numSiteTable();
468
469 int Ns = 1;
476 // Original code
478 /*
479 for(int j=0; j < s.numSiteTable(); j++) {
480 int i=tab[j];
481 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
482 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
483 sub_g5ProjPlus(yptr, yptr, xptr, 1);
484 }*/
485 }
486
487}
488
489
490// d += ChiralProjMinus(Vec);
491template<>
492inline
494 const OpSubtractAssign& op,
495 const QDPExpr<
497 OLattice< TVec > > &rhs,
498 const Subset& s)
499{
500
501#ifdef DEBUG_BLAS_G5
502 QDPIO::cout << "y -= P{-}x" << endl;
503#endif
504
505 const OLattice< TVec >& x = static_cast<const OLattice< TVec > &>(rhs.expression().child());
507 if( s.hasOrderedRep() ) {
508 REAL* xptr = (REAL *)&(x.elem(s.start()).elem(0).elem(0).real());
509 REAL* yptr = (REAL *)&(d.elem(s.start()).elem(0).elem(0).real());
511 int total_n_4vec = (s.end()-s.start()+1);
512
513 ordered_vadd3_g5_user_arg a = {yptr, yptr, xptr, sub_g5ProjMinus};
514
516
518 // Original code
520 //int n_4vec = (s.end()-s.start()+1);
521 //sub_g5ProjMinus(yptr, yptr, xptr, n_4vec);
522 }
523 else {
524 const int* tab = s.siteTable().slice();
525
526 int totalSize = s.numSiteTable();
527
528 int Ns = 1;
529
531
533
535 // Original code
536 ////////////////
537 /*
538 for(int j=0; j < s.numSiteTable(); j++) {
539 int i=tab[j];
540 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
541 REAL* yptr = (REAL *)&(d.elem(i).elem(0).elem(0).real());
542 sub_g5ProjMinus(yptr, yptr, xptr, 1);
543 }*/
544 }
545
548// d = x + a P_{+} y
549template<>
550inline
552 const OpAssign &op,
553 const QDPExpr<
559 >
560 >,
562 > &rhs,
563 const Subset& s)
564{
565#ifdef DEBUG_BLAS_G5
566 QDPIO::cout << "z = x + a*P{+} y" << endl;
567#endif
568
569
570 // Peel the stuff out of the expression
571
572 // y is the left side of rhs
573 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&> (rhs.expression().left());
574
575 // ax is the right side of rhs and is in a binary node
576 typedef BinaryNode<OpMultiply,
579
580 // get the binary node
581 const BN &mulNode = static_cast<const BN&> (rhs.expression().right());
582
583 // get a and x out of the bynary node
584 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
585 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode.right().child());
586 // Set pointers
587 REAL ar = a.elem().elem().elem().elem();
588 REAL *aptr = (REAL *)&ar;
590 if (s.hasOrderedRep() ) {
591 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
592 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
593 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
594
595 int total_n_4vec = (s.end()-s.start()+1);
597 ordered_vaypx3_g5_user_arg a = {zptr, aptr, xptr, yptr, xpayz_g5ProjPlus};
598
600
602 // Original code
604 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
605 //int n_4vec = (s.end()-s.start()+1);
606 //xpayz_g5ProjPlus(zptr, aptr, xptr, yptr, n_4vec);
607 }
608 else {
609 const int* tab = s.siteTable().slice();
610
611 int totalSize = s.numSiteTable();
612
613 int Ns = 1;
614
615 unordered_vaypx3_g5_z_user_arg arg(x, y, d, aptr, Ns, tab, xpayz_g5ProjPlus);
616
620 // Original code
622 /*
623 for(int j=0; j < s.numSiteTable(); j++) {
624 int i=tab[j];
625 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
626 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
627 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
629 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
630 xpayz_g5ProjPlus(zptr, aptr, xptr, yptr, 1);
631 }*/
635
636// d = x + a P_{-} y
637template<>
638inline
640 const OpAssign &op,
641 const QDPExpr<
647 >
648 >,
650 > &rhs,
651 const Subset& s)
652{
653#ifdef DEBUG_BLAS_G5
654 QDPIO::cout << "z = x + a*P{-} y" << endl;
655#endif
656
657
658 // Peel the stuff out of the expression
659
660 // y is the left side of rhs
661 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&> (rhs.expression().left());
662
663 // ax is the right side of rhs and is in a binary node
664 typedef BinaryNode<OpMultiply,
667
668 // get the binary node
669 const BN &mulNode = static_cast<const BN&> (rhs.expression().right());
671 // get a and x out of the bynary node
672 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
673 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode.right().child());
674 // Set pointers
675 REAL ar = a.elem().elem().elem().elem();
676 REAL *aptr = (REAL *)&ar;
677
678 if( s.hasOrderedRep() ) {
679 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
680 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
681 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
682
683 int total_n_4vec = (s.end()-s.start()+1);
684
685 ordered_vaypx3_g5_user_arg a = {zptr, aptr, xptr, yptr, xpayz_g5ProjMinus};
686
688
690 // Original code
692 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
693 //int n_4vec = (s.end()-s.start()+1);
694 //xpayz_g5ProjMinus(zptr, aptr, xptr, yptr, n_4vec);
695 }
696 else {
697 const int* tab = s.siteTable().slice();
699 int totalSize = s.numSiteTable();
700
701 int Ns = 1;
702
704
706
707
708 // Original code
710 /*
711 for(int j=0; j < s.numSiteTable(); j++) {
712 int i=tab[j];
713 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
714 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
715 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
716
717 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
718 xpayz_g5ProjMinus(zptr, aptr, xptr, yptr, 1);
719 }*/
720 }
721
722}
723
724// d = x - a P_{+} y
725template<>
726inline
728 const OpAssign &op,
729 const QDPExpr<
735 >
736 >,
738 > &rhs,
739 const Subset& s)
740{
741#ifdef DEBUG_BLAS_G5
742 QDPIO::cout << "z = x - a*P{+} y" << endl;
743#endif
745
746 // Peel the stuff out of the expression
747
748 // y is the left side of rhs
749 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&> (rhs.expression().left());
750
751 // ax is the right side of rhs and is in a binary node
756 // get the binary node
757 const BN &mulNode = static_cast<const BN&> (rhs.expression().right());
758
759 // get a and x out of the bynary node
760 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
761 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode.right().child());
762 // Set pointers
763 REAL ar = a.elem().elem().elem().elem();
764 REAL *aptr = (REAL *)&ar;
765
766 if( s.hasOrderedRep() ) {
767 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
768 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
769 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
770
771 int total_n_4vec = (s.end()-s.start()+1);
772
773 ordered_vaypx3_g5_user_arg a = {zptr, aptr, xptr, yptr, xmayz_g5ProjPlus};
774
776
778 // Original code
780 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
781 //int n_4vec = (s.end()-s.start()+1);
782 //xmayz_g5ProjPlus(zptr, aptr, xptr, yptr, n_4vec);
783 }
784 else {
785 const int* tab = s.siteTable().slice();
786
787 int totalSize = s.numSiteTable();
788
789 int Ns = 1;
790
791 unordered_vaypx3_g5_z_user_arg arg(x, y, d, aptr, Ns, tab, xmayz_g5ProjPlus);
792
794
796 // Original code
798 /*
799 for(int j=0; j < s.numSiteTable(); j++) {
800 int i=tab[j];
801 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
802 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
803 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
804
805 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
806 xmayz_g5ProjPlus(zptr, aptr, xptr, yptr, 1);
807 }*/
808 }
809
810}
811
812// d = x - a P_{-} y
813template<>
814inline
816 const OpAssign &op,
817 const QDPExpr<
823 >
824 >,
826 > &rhs,
827 const Subset& s)
828{
829#ifdef DEBUG_BLAS_G5
830 QDPIO::cout << "z = x - a*P{-} y" << endl;
831#endif
832
833
834 // Peel the stuff out of the expression
835
836 // y is the left side of rhs
837 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&> (rhs.expression().left());
838
839 // ax is the right side of rhs and is in a binary node
840 typedef BinaryNode<OpMultiply,
843
844 // get the binary node
845 const BN &mulNode = static_cast<const BN&> (rhs.expression().right());
846
847 // get a and x out of the bynary node
848 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
849 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode.right().child());
850 // Set pointers
851 REAL ar = a.elem().elem().elem().elem();
852 REAL *aptr = (REAL *)&ar;
853
854 if( s.hasOrderedRep() ) {
855 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
856 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
857 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
858
859 int total_n_4vec = (s.end()-s.start()+1);
860
861 ordered_vaypx3_g5_user_arg a = {zptr, aptr, xptr, yptr, xmayz_g5ProjMinus};
862
864
866 // Original code
868 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
869 //int n_4vec = (s.end()-s.start()+1);
870 //xmayz_g5ProjMinus(zptr, aptr, xptr, yptr, n_4vec);
871 }
872 else {
873 const int* tab = s.siteTable().slice();
874
875 int totalSize = s.numSiteTable();
876
877 int Ns = 1;
878
879 unordered_vaypx3_g5_z_user_arg arg(x, y, d, aptr, Ns, tab, xmayz_g5ProjMinus);
880
882
884 // Original code
886 /*
887 for(int j=0; j < s.numSiteTable(); j++) {
888 int i=tab[j];
889 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
890 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
891 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
892
893 xmayz_g5ProjMinus(zptr, aptr, xptr, yptr, 1);
894 }*/
895 }
896
897}
898
899// d = ax + P+ y
900template<>
901inline
903 const OpAssign &op,
904 const QDPExpr<
909 >,
911 >,
912 OLattice< TVec > > &rhs,
913 const Subset& s)
914{
915#ifdef DEBUG_BLAS_G5
916 QDPIO::cout << "z = a*x + P{+} y" << endl;
917#endif
918
919
920 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&> (rhs.expression().right().child());
921
922 // ax is the left side of rhs and is in a binary node
923 typedef BinaryNode<OpMultiply,
926
927 // get the binary node
928 const BN &mulNode = static_cast<const BN&> (rhs.expression().left());
929
930 // get a and x out of the bynary node
931 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
932 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode.right());
933 // Set pointers
934 REAL ar = a.elem().elem().elem().elem();
935 REAL *aptr = (REAL *)&ar;
936
937 if( s.hasOrderedRep() ) {
938 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
939 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
940 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
941
942 int total_n_4vec = (s.end()-s.start()+1);
943
944 ordered_vaxpy3_g5_user_arg a = {zptr, aptr, xptr, yptr, axpyz_g5ProjPlus};
945
947
949 // Original code
951 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
952 //int n_4vec = (s.end()-s.start()+1);
953 //axpyz_g5ProjPlus(zptr, aptr, xptr, yptr, n_4vec);
954 }
955 else {
956 const int* tab = s.siteTable().slice();
957
958 int totalSize = s.numSiteTable();
959
960 int Ns = 1;
961
962 unordered_vaxpy3_g5_user_arg arg(x, y, d, aptr, Ns, tab, axpyz_g5ProjPlus);
963
965
967 // Original code
969 /*
970 for(int j=0; j < s.numSiteTable(); j++) {
971 int i=tab[j];
972 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
973 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
974 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
975
976 axpyz_g5ProjPlus(zptr, aptr, xptr, yptr, 1);
977 }*/
978 }
979
980}
981
982// d = ax + P- y
983template<>
984inline
986 const OpAssign &op,
987 const QDPExpr<
992 >,
994 >,
995 OLattice< TVec > > &rhs,
996 const Subset& s)
997{
998#ifdef DEBUG_BLAS_G5
999 QDPIO::cout << "z = a*x + P{-} y" << endl;
1000#endif
1001
1002
1003 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&> (rhs.expression().right().child());
1004
1005 // ax is the left side of rhs and is in a binary node
1006 typedef BinaryNode<OpMultiply,
1009
1010 // get the binary node
1011 const BN &mulNode = static_cast<const BN&> (rhs.expression().left());
1012
1013 // get a and x out of the bynary node
1014 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
1015 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode.right());
1016 // Set pointers
1017 REAL ar = a.elem().elem().elem().elem();
1018 REAL *aptr = (REAL *)&ar;
1019
1020 if( s.hasOrderedRep() ) {
1021 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1022 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1023 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1024
1025 int total_n_4vec = (s.end()-s.start()+1);
1026
1027 ordered_vaxpy3_g5_user_arg a = {zptr, aptr, xptr, yptr, axpyz_g5ProjMinus};
1028
1030
1032 // Original code
1034 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1035 //int n_4vec = (s.end()-s.start()+1);
1036 //axpyz_g5ProjMinus(zptr, aptr, xptr, yptr, n_4vec);
1037 }
1038 else {
1039 const int* tab = s.siteTable().slice();
1040
1041 int totalSize = s.numSiteTable();
1042
1043 int Ns = 1;
1044
1045 unordered_vaxpy3_g5_user_arg arg(x, y, d, aptr, Ns, tab, axpyz_g5ProjMinus);
1046
1048
1050 // Original code
1052 /*
1053 for(int j=0; j < s.numSiteTable(); j++) {
1054 int i=tab[j];
1055 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1056 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1057 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1058
1059 axpyz_g5ProjMinus(zptr, aptr, xptr, yptr, 1);
1060
1061 }*/
1062 }
1063
1064}
1065
1066
1067// d = ax - P+ y
1068template<>
1069inline
1071 const OpAssign &op,
1072 const QDPExpr<
1077 >,
1079 >,
1080 OLattice< TVec > > &rhs,
1081 const Subset& s)
1082{
1083#ifdef DEBUG_BLAS_G5
1084 QDPIO::cout << "z = a*x + P{+} y" << endl;
1085#endif
1086
1087
1088 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&> (rhs.expression().right().child());
1089
1090 // ax is the left side of rhs and is in a binary node
1091 typedef BinaryNode<OpMultiply,
1094
1095 // get the binary node
1096 const BN &mulNode = static_cast<const BN&> (rhs.expression().left());
1097
1098 // get a and x out of the bynary node
1099 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
1100 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode.right());
1101 // Set pointers
1102 REAL ar = a.elem().elem().elem().elem();
1103 REAL *aptr = (REAL *)&ar;
1104
1105 if( s.hasOrderedRep() ) {
1106
1107 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1108 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1109 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1110
1111 int total_n_4vec = (s.end()-s.start()+1);
1112
1113 ordered_vaxpy3_g5_user_arg a = {zptr, aptr, xptr, yptr, axmyz_g5ProjPlus};
1114
1116
1118 // Original code
1120 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1121 //int n_4vec = (s.end()-s.start()+1);
1122 //axmyz_g5ProjPlus(zptr, aptr, xptr, yptr, n_4vec);
1123 }
1124 else {
1125 const int* tab = s.siteTable().slice();
1126
1127 int totalSize = s.numSiteTable();
1128
1129 int Ns = 1;
1130
1131 unordered_vaxpy3_g5_user_arg arg(x, y, d, aptr, Ns, tab, axmyz_g5ProjPlus);
1132
1134
1136 // Original code
1138 /*
1139 for(int j=0; j < s.numSiteTable(); j++) {
1140 int i=tab[j];
1141 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1142 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1143 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1144
1145 axmyz_g5ProjPlus(zptr, aptr, xptr, yptr, 1);
1146
1147 }*/
1148 }
1149
1150}
1151
1152// d = ax - P- y
1153template<>
1154inline
1156 const OpAssign &op,
1157 const QDPExpr<
1162 >,
1164 >,
1165 OLattice< TVec > > &rhs,
1166 const Subset& s)
1167{
1168#ifdef DEBUG_BLAS_G5
1169 QDPIO::cout << "z = a*x + P{-} y" << endl;
1170#endif
1171
1172
1173 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&> (rhs.expression().right().child());
1174
1175 // ax is the left side of rhs and is in a binary node
1176 typedef BinaryNode<OpMultiply,
1179
1180 // get the binary node
1181 const BN &mulNode = static_cast<const BN&> (rhs.expression().left());
1182
1183 // get a and x out of the bynary node
1184 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode.left());
1185 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode.right());
1186 // Set pointers
1187 REAL ar = a.elem().elem().elem().elem();
1188 REAL *aptr = (REAL *)&ar;
1189 if( s.hasOrderedRep() ) {
1190 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1191 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1192 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1193
1194 int total_n_4vec = (s.end()-s.start()+1);
1195
1196 ordered_vaxpy3_g5_user_arg a = {zptr, aptr, xptr, yptr, axmyz_g5ProjMinus};
1197
1199
1201 // Original code
1203 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1204 //int n_4vec = (s.end()-s.start()+1);
1205 //axmyz_g5ProjMinus(zptr, aptr, xptr, yptr, n_4vec);
1206 }
1207 else {
1208 const int* tab = s.siteTable().slice();
1209
1210 int totalSize = s.numSiteTable();
1211
1212 int Ns = 1;
1213
1214 unordered_vaxpy3_g5_user_arg arg(x, y, d, aptr, Ns, tab, axmyz_g5ProjMinus);
1215
1217
1219 // Original code
1221 /*
1222 for(int j=0; j < s.numSiteTable(); j++) {
1223 int i=tab[j];
1224 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1225 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1226 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1227 axmyz_g5ProjMinus(zptr, aptr, xptr, yptr, 1);
1228
1229 }*/
1230 }
1231
1232}
1233
1234// Vec = Scal * P_{+} Vec
1235template<>
1236inline
1238 const OpAssign &op,
1239 const QDPExpr<
1243 >,
1244 OLattice< TVec > > &rhs,
1245 const Subset& s)
1246{
1247
1248#ifdef DEBUG_BLAS_G5
1249 cout << "BJ: v = a*P{+}v " << endl;
1250#endif
1251
1252 const OLattice< TVec > &x = static_cast<const OLattice< TVec >&>(rhs.expression().right().child());
1253 const OScalar< TScal > &a = static_cast<const OScalar< TScal >&>(rhs.expression().left());
1254
1255 REAL ar = a.elem().elem().elem().elem();
1256 REAL *aptr = &ar;
1257
1258 if( s.hasOrderedRep() ) {
1259 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1260 REAL *zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1261
1262 int total_n_4vec = (s.end()-s.start()+1);
1263
1264 ordered_vscal_g5_user_arg a = {zptr, aptr, xptr, scal_g5ProjPlus};
1265
1267
1269 // Original code
1271 //int n_4vec = (s.end()-s.start()+1);
1272 //scal_g5ProjPlus(zptr, aptr, xptr, n_4vec);
1273 }
1274 else {
1275 const int* tab = s.siteTable().slice();
1276
1277 int totalSize = s.numSiteTable();
1278
1279 int Ns = 1;
1280
1281 unordered_vscal_g5_user_arg arg(x, d, aptr, Ns, tab, scal_g5ProjPlus);
1282
1284
1286 // Original code
1288 /*
1289 for(int j=0; j < s.numSiteTable(); j++) {
1290 int i=tab[j];
1291 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1292 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1293
1294 scal_g5ProjPlus(zptr, aptr, xptr, 1);
1295 }*/
1296 }
1297
1298}
1299
1300// Vec = Scal * P_{-} Vec
1301template<>
1302inline
1304 const OpAssign &op,
1305 const QDPExpr<
1309 >,
1310 OLattice< TVec > > &rhs,
1311 const Subset& s)
1312{
1313
1314#ifdef DEBUG_BLAS_G5
1315 cout << "BJ: v = a*P{-}v " << endl;
1316#endif
1317
1318 const OLattice< TVec > &x = static_cast<const OLattice< TVec >&>(rhs.expression().right().child());
1319 const OScalar< TScal > &a = static_cast<const OScalar< TScal >&>(rhs.expression().left());
1320
1321 REAL ar = a.elem().elem().elem().elem();
1322 REAL *aptr = &ar;
1323
1324 if( s.hasOrderedRep() ) {
1325 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1326 REAL *zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1327
1328 int total_n_4vec = (s.end()-s.start()+1);
1329
1330 ordered_vscal_g5_user_arg a = {zptr, aptr, xptr, scal_g5ProjMinus};
1331
1333
1335 // Original code
1337 //int n_4vec = (s.end()-s.start()+1);
1338 //scal_g5ProjMinus(zptr, aptr, xptr, n_4vec);
1339 }
1340 else {
1341 const int* tab = s.siteTable().slice();
1342
1343 int totalSize = s.numSiteTable();
1344
1345 int Ns = 1;
1346
1347 unordered_vscal_g5_user_arg arg(x, d, aptr, Ns, tab, scal_g5ProjMinus);
1348
1350
1352 // Original code
1354 /*
1355 for(int j=0; j < s.numSiteTable(); j++) {
1356 int i=tab[j];
1357 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1358 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1359
1360 scal_g5ProjMinus(zptr, aptr, xptr, 1);
1361 }*/
1362 }
1363}
1364
1365// z = ax + bP+ y
1366template<>
1367inline
1369 const OpAssign &op,
1370 const QDPExpr<
1378 >
1379 >,
1380 OLattice< TVec > > &rhs,
1381 const Subset& s)
1382{
1383
1384#ifdef DEBUG_BLAS_G5
1385 QDPIO::cout << "z = a*x + b*P+y" << endl;
1386#endif
1387
1388 // Peel the stuff out of the expression
1389 // y is the right side of rhs
1390
1391 // ax is the left side of rhs and is in a binary node
1392 typedef BinaryNode<OpMultiply,
1395
1396 typedef BinaryNode<OpMultiply,
1399
1400 // get the binary node
1401 const BN1 &mulNode1 = static_cast<const BN1&> (rhs.expression().left());
1402 const BN2 &mulNode2 = static_cast<const BN2&> (rhs.expression().right());
1403
1404 // get a and x out of the binary node
1405 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode1.left());
1406 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode1.right());
1407
1408 // get b and y out of the binary node
1409 const OScalar< TScal >& b = static_cast<const OScalar< TScal >&>(mulNode2.left());
1410 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode2.right().child());
1411
1412
1413 // Set pointers
1414 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
1415 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
1416
1417 if( s.hasOrderedRep() ) {
1418 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1419 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1420 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1421
1422 int total_n_4vec = (s.end()-s.start()+1);
1423
1424 ordered_vaxpby3_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axpbyz_g5ProjPlus};
1425
1427
1429 // Original code
1431 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1432 //int n_4vec = (s.end()-s.start()+1);
1433 //axpbyz_g5ProjPlus(zptr, aptr, xptr, bptr, yptr, n_4vec);
1434 }
1435 else {
1436 const int* tab = s.siteTable().slice();
1437
1438 int totalSize = s.numSiteTable();
1439
1440 int Ns = 1;
1441
1442 unordered_vaxpby3_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axpbyz_g5ProjPlus);
1443
1445
1447 // Original code
1449 /*
1450 for(int j=0; j < s.numSiteTable(); j++) {
1451 int i=tab[j];
1452 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1453 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1454 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1455
1456
1457 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1458 axpbyz_g5ProjPlus(zptr, aptr, xptr, bptr, yptr, 1);
1459
1460 }*/
1461 }
1462}
1463
1464// z = ax + bP- y
1465template<>
1466inline
1468 const OpAssign &op,
1469 const QDPExpr<
1477 >
1478 >,
1479 OLattice< TVec > > &rhs,
1480 const Subset& s)
1481{
1482
1483#ifdef DEBUG_BLAS_G5
1484 QDPIO::cout << "z = a*x + b*P-y" << endl;
1485#endif
1486
1487 // Peel the stuff out of the expression
1488 // y is the right side of rhs
1489
1490 // ax is the left side of rhs and is in a binary node
1491 typedef BinaryNode<OpMultiply,
1494
1495 typedef BinaryNode<OpMultiply,
1498
1499 // get the binary node
1500 const BN1 &mulNode1 = static_cast<const BN1&> (rhs.expression().left());
1501 const BN2 &mulNode2 = static_cast<const BN2&> (rhs.expression().right());
1502
1503 // get a and x out of the binary node
1504 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode1.left());
1505 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode1.right());
1506
1507 // get b and y out of the binary node
1508 const OScalar< TScal >& b = static_cast<const OScalar< TScal >&>(mulNode2.left());
1509 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode2.right().child());
1510
1511
1512 // Set pointers
1513 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
1514 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
1515
1516 if( s.hasOrderedRep() ) {
1517 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1518 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1519 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1520
1521 int total_n_4vec = (s.end()-s.start()+1);
1522
1523 ordered_vaxpby3_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axpbyz_g5ProjMinus};
1524
1526
1528 // Original code
1530 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1531 //int n_4vec = (s.end()-s.start()+1);
1532 //axpbyz_g5ProjMinus(zptr, aptr, xptr, bptr, yptr, n_4vec);
1533 }
1534 else {
1535 const int* tab = s.siteTable().slice();
1536
1537 int totalSize = s.numSiteTable();
1538
1539 int Ns = 1;
1540
1541 unordered_vaxpby3_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axpbyz_g5ProjMinus);
1542
1544
1546 // Original code
1548 /*
1549 for(int j=0; j < s.numSiteTable(); j++) {
1550 int i=tab[j];
1551 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1552 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1553 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1554
1555 axpbyz_g5ProjMinus(zptr, aptr, xptr, bptr, yptr, 1);
1556
1557 }*/
1558 }
1559}
1560
1561// z = ax - bP+ y
1562template<>
1563inline
1565 const OpAssign &op,
1566 const QDPExpr<
1574 >
1575 >,
1576 OLattice< TVec > > &rhs,
1577 const Subset& s)
1578{
1579
1580#ifdef DEBUG_BLAS_G5
1581 QDPIO::cout << "z = a*x - b*P+y" << endl;
1582#endif
1583
1584 // Peel the stuff out of the expression
1585 // y is the right side of rhs
1586
1587 // ax is the left side of rhs and is in a binary node
1588 typedef BinaryNode<OpMultiply,
1591
1592 typedef BinaryNode<OpMultiply,
1595
1596 // get the binary node
1597 const BN1 &mulNode1 = static_cast<const BN1&> (rhs.expression().left());
1598 const BN2 &mulNode2 = static_cast<const BN2&> (rhs.expression().right());
1599
1600 // get a and x out of the binary node
1601 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode1.left());
1602 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode1.right());
1603
1604 // get b and y out of the binary node
1605 const OScalar< TScal >& b = static_cast<const OScalar< TScal >&>(mulNode2.left());
1606 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode2.right().child());
1607
1608
1609 // Set pointers
1610 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
1611 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
1612
1613 if( s.hasOrderedRep() ) {
1614 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1615 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1616 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1617
1618 int total_n_4vec = (s.end()-s.start()+1);
1619
1620 ordered_vaxpby3_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axmbyz_g5ProjPlus};
1621
1623
1625 // Original code
1627 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1628 //int n_4vec = (s.end()-s.start()+1);
1629 //axmbyz_g5ProjPlus(zptr, aptr, xptr, bptr, yptr, n_4vec);
1630 }
1631 else {
1632 const int* tab = s.siteTable().slice();
1633
1634 int totalSize = s.numSiteTable();
1635
1636 int Ns = 1;
1637
1638 unordered_vaxpby3_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axmbyz_g5ProjPlus);
1639
1641
1643 // Original code
1645 /*
1646 for(int j=0; j < s.numSiteTable(); j++) {
1647 int i=tab[j];
1648 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1649 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1650 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1651
1652 axmbyz_g5ProjPlus(zptr, aptr, xptr, bptr, yptr, 1);
1653 }*/
1654 }
1655}
1656
1657// z = ax - bP- y
1658template<>
1659inline
1661 const OpAssign &op,
1662 const QDPExpr<
1670 >
1671 >,
1672 OLattice< TVec > > &rhs,
1673 const Subset& s)
1674{
1675
1676#ifdef DEBUG_BLAS_G5
1677 QDPIO::cout << "z = a*x - b*P-y" << endl;
1678#endif
1679
1680 // Peel the stuff out of the expression
1681 // y is the right side of rhs
1682
1683 // ax is the left side of rhs and is in a binary node
1684 typedef BinaryNode<OpMultiply,
1687
1688 typedef BinaryNode<OpMultiply,
1691
1692 // get the binary node
1693 const BN1 &mulNode1 = static_cast<const BN1&> (rhs.expression().left());
1694 const BN2 &mulNode2 = static_cast<const BN2&> (rhs.expression().right());
1695
1696 // get a and x out of the binary node
1697 const OScalar< TScal >& a = static_cast<const OScalar< TScal >&>(mulNode1.left());
1698 const OLattice< TVec >& x = static_cast<const OLattice< TVec >&>(mulNode1.right());
1699
1700 // get b and y out of the binary node
1701 const OScalar< TScal >& b = static_cast<const OScalar< TScal >&>(mulNode2.left());
1702 const OLattice< TVec >& y = static_cast<const OLattice< TVec >&>(mulNode2.right().child());
1703
1704
1705 // Set pointers
1706 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
1707 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
1708 if( s.hasOrderedRep() ) {
1709 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1710 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1711 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1712
1713 int total_n_4vec = (s.end()-s.start()+1);
1714
1715 ordered_vaxpby3_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axmbyz_g5ProjMinus};
1716
1718
1720 // Original code
1722 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1723 //int n_4vec = (s.end()-s.start()+1);
1724 //axmbyz_g5ProjMinus(zptr, aptr, xptr, bptr, yptr, n_4vec);
1725 }
1726 else {
1727 const int* tab = s.siteTable().slice();
1728
1729 int totalSize = s.numSiteTable();
1730
1731 int Ns = 1;
1732
1733 unordered_vaxpby3_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axmbyz_g5ProjMinus);
1734
1736
1738 // Original code
1740 /*
1741 for(int j=0; j < s.numSiteTable(); j++) {
1742 int i=tab[j];
1743 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1744 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1745 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1746
1747 axmbyz_g5ProjMinus(zptr, aptr, xptr, bptr, yptr, 1);
1748 }*/
1749 }
1750}
1751
1752// Vec = Scal * GammaConst<Ns,Ns-1>* Vec
1753template<>
1754inline
1756 const OpAssign &op,
1757 const QDPExpr<
1760 BinaryNode<
1764 >
1765 >,
1767 > &rhs,
1768 const Subset& s)
1769{
1770
1771#ifdef DEBUG_BLAS_G5
1772 QDPIO::cout << "z = a*(GammaConst<Ns,Ns*Ns-1>()*x)" << endl;
1773#endif
1774
1775
1776 typedef BinaryNode<
1778 GammaConst<Ns,Ns*Ns-1>,
1780 > BN1;
1781
1782 const OScalar< TScal > &a = static_cast<const OScalar< TScal >&>(rhs.expression().left());
1783 const BN1 &node = static_cast<const BN1&>(rhs.expression().right());
1784
1785 const OLattice< TVec > &x = static_cast<const OLattice< TVec >&>(node.right());
1786
1787 REAL ar = a.elem().elem().elem().elem();
1788 REAL *aptr = &ar;
1789
1790 if( s.hasOrderedRep() ) {
1791 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1792 REAL *zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1793
1794 int total_n_4vec = (s.end()-s.start()+1);
1795
1796 ordered_scal_g5_user_arg a = {zptr, aptr, xptr};
1797
1799
1801 // Original code
1803 //int n_4vec = (s.end()-s.start()+1);
1804
1805 //scal_g5(zptr, aptr, xptr, n_4vec);
1806 }
1807 else {
1808 const int* tab = s.siteTable().slice();
1809
1810 int totalSize = s.numSiteTable();
1811
1812 int Ns = 1;
1813
1814 unordered_scal_g5_user_arg arg(x, d, aptr, Ns, tab);
1815
1817
1819 // Original code
1821 /*
1822 for(int j=0; j < s.numSiteTable(); j++) {
1823 int i=tab[j];
1824 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1825 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1826
1827 scal_g5(zptr, aptr, xptr, 1);
1828 }*/
1829 }
1830}
1831
1832
1833// Vec = Vec - a*Gamma5*Vec
1834//
1835template<>
1836inline
1838 const OpAssign &op,
1839 const QDPExpr<
1844 BinaryNode<
1848 >
1849 >
1850 >,
1851 OLattice< TVec > > &rhs,
1852 const Subset& s)
1853{
1854
1855#ifdef DEBUG_BLAS_G5
1856 QDPIO::cout << "z = x - a GammaConst<Ns,Ns*Ns-1>()*y" << endl;
1857#endif
1858 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(rhs.expression().left());
1859
1860 typedef BinaryNode<OpMultiply,
1862 BinaryNode<
1864 GammaConst<Ns,Ns*Ns-1>,
1866 >
1867 > MN;
1868 const MN& mul_node = static_cast<const MN&>(rhs.expression().right());
1869
1870 const OScalar<TScal>& a = static_cast<const OScalar<TScal>& >(mul_node.left());
1871
1872 typedef BinaryNode<
1874 GammaConst<Ns,Ns*Ns-1>,
1876 > GN;
1877
1878 const GN& gamma_node = static_cast<const GN&>(mul_node.right());
1879 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(gamma_node.right());
1880
1881 REAL ar = a.elem().elem().elem().elem();
1882 REAL *aptr = (REAL *)&ar;
1883
1884 if( s.hasOrderedRep() ) {
1885 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1886 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1887 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1888
1889 int total_n_4vec = (s.end()-s.start()+1);
1890
1891 ordered_xOpayz_g5_user_arg a = {zptr, aptr, xptr, yptr, xmayz_g5};
1892
1894
1896 // Original code
1898 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
1899 //int n_4vec = (s.end()-s.start()+1);
1900 //xmayz_g5(zptr, aptr, xptr, yptr, n_4vec);
1901 }
1902 else {
1903 const int* tab = s.siteTable().slice();
1904
1905 int totalSize = s.numSiteTable();
1906
1907 int Ns = 1;
1908
1909 unordered_xOpayz_g5_user_arg arg(x, y, d, aptr, Ns, tab, xmayz_g5);
1910
1912
1914 // Original code
1916 /*
1917 for(int j=0; j < s.numSiteTable(); j++) {
1918 int i=tab[j];
1919 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
1920 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
1921 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
1922 xmayz_g5(zptr, aptr, xptr, yptr,1);
1923 }*/
1924 }
1925
1926}
1927
1928
1929// Vec = a*Vec + b*Gamma5*Vec
1930//
1931template<>
1932inline
1934 const OpAssign &op,
1935 const QDPExpr<
1940 >,
1943 BinaryNode<
1947 >
1948 >
1949 >,
1950 OLattice< TVec > > &rhs,
1951 const Subset& s)
1952{
1953
1954#ifdef DEBUG_BLAS_G5
1955 QDPIO::cout << "z = a*x + b*GammaConst<Ns,Ns*Ns-1>()*y" << endl;
1956#endif
1957
1958 typedef BinaryNode<OpMultiply,
1961 > MN1;
1962
1963 typedef BinaryNode<OpMultiply,
1965 BinaryNode<
1967 GammaConst<Ns,Ns*Ns-1>,
1969 >
1970 > MN2;
1971
1972 typedef BinaryNode<
1974 GammaConst<Ns,Ns*Ns-1>,
1976 > GN;
1977
1978 const MN1& mulNode1 = static_cast< const MN1& >(rhs.expression().left());
1979 const MN2& mulNode2 = static_cast< const MN2& >(rhs.expression().right());
1980 const GN& gammaNode = static_cast< const GN& >(mulNode2.right());
1981
1982 const OScalar<TScal>& a = static_cast<const OScalar<TScal>&>(mulNode1.left());
1983 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(mulNode1.right());
1984
1985 const OScalar<TScal>& b = static_cast<const OScalar<TScal>&>(mulNode2.left());
1986 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(gammaNode.right());
1987
1988
1989 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
1990 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
1991
1992 if( s.hasOrderedRep() ) {
1993 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
1994 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
1995 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
1996
1997 int total_n_4vec = (s.end()-s.start()+1);
1998
1999 ordered_axOpbyz_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axpbyz_g5};
2000
2002
2004 // Original code
2006 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2007 //int n_4vec = (s.end()-s.start()+1);
2008 //axpbyz_g5(zptr, aptr, xptr, bptr, yptr, n_4vec);
2009 }
2010 else {
2011 const int* tab = s.siteTable().slice();
2012
2013 int totalSize = s.numSiteTable();
2014
2015 int Ns = 1;
2016
2017 unordered_axOpbyz_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axpbyz_g5);
2018
2020
2022 // Original code
2024 /*
2025 for(int j=0; j < s.numSiteTable(); j++) {
2026 int i=tab[j];
2027 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2028 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2029 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2030 axpbyz_g5(zptr, aptr, xptr, bptr, yptr, 1);
2031 }*/
2032 }
2033}
2034
2035// Vec = Gamma_5 *( a*Vec - b*Vec )
2036//
2037template<>
2038inline
2040 const OpAssign &op,
2041 const QDPExpr<
2048 >,
2052 >
2053 >
2054 >,
2055 OLattice< TVec > > &rhs,
2056 const Subset& s)
2057{
2058
2059#ifdef DEBUG_BLAS_G5
2060 QDPIO::cout << "z = GammaConst<Ns,Ns*Ns-1>()*(ax - by)" << endl;
2061#endif
2062
2063 typedef BinaryNode<OpSubtract,
2067 >,
2071 >
2072 > AXMBY;
2073
2074 const AXMBY& axmby_node = static_cast<const AXMBY&>(rhs.expression().right());
2075
2076
2077 typedef BinaryNode<OpMultiply,
2080 > MN;
2081
2082 const MN& mulNode1 = static_cast<const MN& >( axmby_node.left());
2083 const MN& mulNode2 = static_cast<const MN& >( axmby_node.right());
2084
2085 const OScalar<TScal>& a = static_cast<const OScalar<TScal>&>(mulNode1.left());
2086 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(mulNode1.right());
2087
2088 const OScalar<TScal>& b = static_cast<const OScalar<TScal>&>(mulNode2.left());
2089 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(mulNode2.right());
2090
2091
2092 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
2093 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
2094
2095 if( s.hasOrderedRep() ) {
2096 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2097 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
2098 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2099
2100 int total_n_4vec = (s.end()-s.start()+1);
2101
2102 ordered_axOpbyz_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, g5_axmbyz};
2103
2105
2107 // Original code
2109 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2110 //int n_4vec = (s.end()-s.start()+1);
2111 //g5_axmbyz(zptr, aptr, xptr, bptr, yptr, n_4vec);
2112 }
2113 else {
2114 const int* tab = s.siteTable().slice();
2115
2116 int totalSize = s.numSiteTable();
2117
2118 int Ns = 1;
2119
2120 unordered_axOpbyz_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, g5_axmbyz);
2121
2123
2125 // Original code
2127 /*
2128 for(int j=0; j < s.numSiteTable(); j++) {
2129 int i=tab[j];
2130 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2131 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2132 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2133 g5_axmbyz(zptr, aptr, xptr, bptr, yptr, 1);
2134 }*/
2135 }
2136}
2137
2138
2139
2140// Vec = a*Vec + b*Gamma5*i*Vec
2141//
2142template<>
2143inline
2145 const OpAssign &op,
2146 const QDPExpr<
2151 >,
2154 BinaryNode<
2159 >
2160 >
2161 >
2162 >,
2163 OLattice< TVec > > &rhs,
2164 const Subset& s)
2165{
2166
2167#ifdef DEBUG_BLAS_G5
2168 QDPIO::cout << "z = a*x + b*GammaConst<Ns,Ns*Ns-1>()*timesI(y)" << endl;
2169#endif
2170
2171 typedef BinaryNode<OpMultiply,
2174 > MN1;
2175
2176 typedef BinaryNode<OpMultiply,
2178 BinaryNode<
2180 GammaConst<Ns,Ns*Ns-1>,
2183 >
2184 >
2185 > MN2;
2186
2187 typedef BinaryNode<
2189 GammaConst<Ns,Ns*Ns-1>,
2192 >
2193 > GN;
2194
2195 typedef UnaryNode< FnTimesI,
2197 > IN;
2198
2199 const MN1& mulNode1 = static_cast< const MN1& >(rhs.expression().left());
2200 const MN2& mulNode2 = static_cast< const MN2& >(rhs.expression().right());
2201 const GN& gammaNode = static_cast< const GN& >(mulNode2.right());
2202 const IN& mulINode = static_cast< const IN& >(gammaNode.right());
2203
2204 const OScalar<TScal>& a = static_cast<const OScalar<TScal>&>(mulNode1.left());
2205 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(mulNode1.right());
2206
2207 const OScalar<TScal>& b = static_cast<const OScalar<TScal>&>(mulNode2.left());
2208 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(mulINode.child());
2209
2210
2211 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
2212 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
2213
2214
2215 if( s.hasOrderedRep() ) {
2216 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2217 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
2218 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2219
2220 int total_n_4vec = (s.end()-s.start()+1);
2221
2222 ordered_axOpbyz_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axpbyz_ig5};
2223
2225
2227 // Original code
2229 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2230 //int n_4vec = (s.end()-s.start()+1);
2231 //axpbyz_ig5(zptr, aptr, xptr, bptr, yptr, n_4vec);
2232 }
2233 else {
2234 const int* tab = s.siteTable().slice();
2235
2236 int totalSize = s.numSiteTable();
2237
2238 int Ns = 1;
2239
2240 unordered_axOpbyz_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axpbyz_ig5);
2241
2243
2245 // Original code
2247 /*
2248 for(int j=0; j < s.numSiteTable(); j++) {
2249 int i=tab[j];
2250 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2251 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2252 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2253 axpbyz_ig5(zptr, aptr, xptr, bptr, yptr, 1);
2254 }*/
2255 }
2256}
2257
2258// Vec = a*Vec - b*Gamma5*i*Vec
2259//
2260template<>
2261inline
2263 const OpAssign &op,
2264 const QDPExpr<
2269 >,
2272 BinaryNode<
2277 >
2278 >
2279 >
2280 >,
2281 OLattice< TVec > > &rhs,
2282 const Subset& s)
2283{
2284
2285#ifdef DEBUG_BLAS_G5
2286 QDPIO::cout << "z = a*x + b*GammaConst<Ns,Ns*Ns-1>()*timesI(y)" << endl;
2287#endif
2288
2289 typedef BinaryNode<OpMultiply,
2292 > MN1;
2293
2294 typedef BinaryNode<OpMultiply,
2296 BinaryNode<
2298 GammaConst<Ns,Ns*Ns-1>,
2301 >
2302 >
2303 > MN2;
2304
2305 typedef BinaryNode<
2307 GammaConst<Ns,Ns*Ns-1>,
2310 >
2311 > GN;
2312
2313 typedef UnaryNode< FnTimesI,
2315 > IN;
2316
2317 const MN1& mulNode1 = static_cast< const MN1& >(rhs.expression().left());
2318 const MN2& mulNode2 = static_cast< const MN2& >(rhs.expression().right());
2319 const GN& gammaNode = static_cast< const GN& >(mulNode2.right());
2320 const IN& mulINode = static_cast< const IN& >(gammaNode.right());
2321
2322 const OScalar<TScal>& a = static_cast<const OScalar<TScal>&>(mulNode1.left());
2323 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(mulNode1.right());
2324
2325 const OScalar<TScal>& b = static_cast<const OScalar<TScal>&>(mulNode2.left());
2326 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(mulINode.child());
2327
2328
2329 REAL *aptr = (REAL *)&(a.elem().elem().elem().elem());
2330 REAL *bptr = (REAL *)&(b.elem().elem().elem().elem());
2331
2332 if( s.hasOrderedRep() ) {
2333 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2334 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
2335 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2336
2337
2338 int total_n_4vec = (s.end()-s.start()+1);
2339
2340 ordered_axOpbyz_g5_user_arg a = {zptr, aptr, xptr, bptr, yptr, axmbyz_ig5};
2341
2343
2345 // Original code
2347 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2348 //int n_4vec = (s.end()-s.start()+1);
2349 //axmbyz_ig5(zptr, aptr, xptr, bptr, yptr, n_4vec);
2350 }
2351 else {
2352 const int* tab = s.siteTable().slice();
2353
2354 int totalSize = s.numSiteTable();
2355
2356 int Ns = 1;
2357
2358 unordered_axOpbyz_g5_user_arg arg(x, y, d, aptr, bptr, Ns, tab, axmbyz_ig5);
2359
2361
2363 // Original code
2365 /*
2366 for(int j=0; j < s.numSiteTable(); j++) {
2367 int i=tab[j];
2368 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2369 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2370 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2371 axmbyz_ig5(zptr, aptr, xptr, bptr, yptr, 1);
2372 }*/
2373 }
2374}
2375
2376// Vec = Vec + a*Gamma5*i*Vec
2377//
2378template<>
2379inline
2381 const OpAssign &op,
2382 const QDPExpr<
2387 BinaryNode<
2392 >
2393 >
2394 >
2395 >,
2396 OLattice< TVec > > &rhs,
2397 const Subset& s)
2398{
2399
2400#ifdef DEBUG_BLAS_G5
2401 QDPIO::cout << "z = x + a GammaConst<Ns,Ns*Ns-1>()*i*y" << endl;
2402#endif
2403 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(rhs.expression().left());
2404
2405 typedef BinaryNode<OpMultiply,
2407 BinaryNode<
2409 GammaConst<Ns,Ns*Ns-1>,
2412 >
2413 >
2414 > MN;
2415 const MN& mul_node = static_cast<const MN&>(rhs.expression().right());
2416
2417 const OScalar<TScal>& a = static_cast<const OScalar<TScal>& >(mul_node.left());
2418
2419 typedef BinaryNode<
2421 GammaConst<Ns,Ns*Ns-1>,
2424 >
2425 > GN;
2426
2427 typedef UnaryNode<FnTimesI,
2429 > IN;
2430
2431 const GN& gamma_node = static_cast<const GN&>(mul_node.right());
2432 const IN& timesI_node = static_cast<const IN&>(gamma_node.right());
2433
2434 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(timesI_node.child());
2435
2436 REAL ar = a.elem().elem().elem().elem();
2437 REAL *aptr = (REAL *)&ar;
2438
2439 if( s.hasOrderedRep() ) {
2440 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2441 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
2442 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2443
2444 int total_n_4vec = (s.end()-s.start()+1);
2445
2446 ordered_xOpayz_ig5_user_arg a = {zptr, aptr, xptr, yptr, xpayz_ig5};
2447
2449
2451 // Original code
2453 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2454 //int n_4vec = (s.end()-s.start()+1);
2455 //xpayz_ig5(zptr, aptr, xptr, yptr, n_4vec);
2456 }
2457 else {
2458 const int* tab = s.siteTable().slice();
2459
2460 int totalSize = s.numSiteTable();
2461
2462 int Ns = 1;
2463
2464 unordered_xOpayz_ig5_y_user_arg arg(x, y, d, aptr, Ns, tab, xpayz_ig5);
2465
2467
2469 // Original code
2471 /*
2472 for(int j=0; j < s.numSiteTable(); j++) {
2473 int i=tab[j];
2474 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2475 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2476 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2477 xpayz_ig5(zptr, aptr, xptr, yptr, 1);
2478 }*/
2479 }
2480
2481}
2482
2483// Vec = Vec - a*Gamma5*i*Vec
2484//
2485template<>
2486inline
2488 const OpAssign &op,
2489 const QDPExpr<
2494 BinaryNode<
2499 >
2500 >
2501 >
2502 >,
2503 OLattice< TVec > > &rhs,
2504 const Subset& s)
2505{
2506
2507#ifdef DEBUG_BLAS_G5
2508 QDPIO::cout << "z = x - a GammaConst<Ns,Ns*Ns-1>()*i*y" << endl;
2509#endif
2510 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(rhs.expression().left());
2511
2512 typedef BinaryNode<OpMultiply,
2514 BinaryNode<
2516 GammaConst<Ns,Ns*Ns-1>,
2519 >
2520 >
2521 > MN;
2522 const MN& mul_node = static_cast<const MN&>(rhs.expression().right());
2523
2524 const OScalar<TScal>& a = static_cast<const OScalar<TScal>& >(mul_node.left());
2525
2526 typedef BinaryNode<
2528 GammaConst<Ns,Ns*Ns-1>,
2531 >
2532 > GN;
2533
2534 typedef UnaryNode<FnTimesI,
2536 > IN;
2537
2538 const GN& gamma_node = static_cast<const GN&>(mul_node.right());
2539 const IN& timesI_node = static_cast<const IN&>(gamma_node.right());
2540
2541 const OLattice<TVec>& y = static_cast<const OLattice<TVec>&>(timesI_node.child());
2542
2543 REAL ar = a.elem().elem().elem().elem();
2544 REAL *aptr = (REAL *)&ar;
2545
2546 if( s.hasOrderedRep() ) {
2547 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2548 REAL *yptr = (REAL *) &(y.elem(s.start()).elem(0).elem(0).real());
2549 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2550
2551
2552 int total_n_4vec = (s.end()-s.start()+1);
2553
2554 ordered_xOpayz_ig5_user_arg a = {zptr, aptr, xptr, yptr, xmayz_ig5};
2555
2557
2559 // Original code
2561 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2562 //int n_4vec = (s.end()-s.start()+1);
2563 //xmayz_ig5(zptr, aptr, xptr, yptr, n_4vec);
2564 }
2565 else {
2566 const int* tab = s.siteTable().slice();
2567
2568 int totalSize = s.numSiteTable();
2569
2570 int Ns = 1;
2571
2572 unordered_xOpayz_ig5_y_user_arg arg(x, y, d, aptr, Ns, tab, xmayz_ig5);
2573
2575
2577 // Original code
2579 /*
2580 for(int j=0; j < s.numSiteTable(); j++) {
2581 int i=tab[j];
2582 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2583 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
2584 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2585 xmayz_ig5(zptr, aptr, xptr, yptr, 1);
2586
2587 }*/
2588 }
2589
2590}
2591
2592
2593
2594// Vec += a*Gamma5*i*Vec
2595//
2596template<>
2597inline
2599 const OpAddAssign &op,
2600 const QDPExpr<
2603 BinaryNode<
2608 >
2609 >
2610 >,
2612 > &rhs,
2613 const Subset& s)
2614{
2615
2616#ifdef DEBUG_BLAS_G5
2617 QDPIO::cout << "z += a GammaConst<Ns,Ns*Ns-1>()*i*y" << endl;
2618#endif
2619
2620#if 0
2621 typedef BinaryNode<OpMultiply,
2623 BinaryNode<
2625 GammaConst<Ns,Ns*Ns-1>,
2628 >
2629 >
2630 > MN;
2631
2632 const MN& mul_node = static_cast<const MN&>(rhs.expression().right());
2633#endif
2634
2635 const OScalar<TScal>& a = static_cast<const OScalar<TScal>& >(rhs.expression().left());
2636
2637 typedef BinaryNode<
2639 GammaConst<Ns,Ns*Ns-1>,
2642 >
2643 > GN;
2644
2645 typedef UnaryNode<FnTimesI,
2647 > IN;
2648
2649 const GN& gamma_node = static_cast<const GN&>(rhs.expression().right());
2650 const IN& timesI_node = static_cast<const IN&>(gamma_node.right());
2651
2652 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(timesI_node.child());
2653
2654 REAL ar = a.elem().elem().elem().elem();
2655 REAL *aptr = (REAL *)&ar;
2656 if( s.hasOrderedRep() ) {
2657 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2658 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2659
2660 int total_n_4vec = (s.end()-s.start()+1);
2661
2662 ordered_xOpayz_ig5_user_arg a = {zptr, aptr, zptr, xptr, xpayz_ig5};
2663
2665
2667 // Original code
2669 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2670 //int n_4vec = (s.end()-s.start()+1);
2671 //xpayz_ig5(zptr, aptr, zptr, xptr, n_4vec);
2672 }
2673 else {
2674 const int* tab = s.siteTable().slice();
2675
2676 int totalSize = s.numSiteTable();
2677
2678 int Ns = 1;
2679
2680 unordered_xOpayz_ig5_z_user_arg arg(x, d, aptr, Ns, tab, xpayz_ig5);
2681
2683
2685 // Original code
2687 /*
2688 for(int j=0; j < s.numSiteTable(); j++) {
2689 int i=tab[j];
2690 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2691 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2692
2693 xpayz_ig5(zptr, aptr, zptr, xptr, 1);
2694 }*/
2695 }
2696
2697}
2698
2699
2700// Vec -= a*Gamma5*i*Vec
2701//
2702template<>
2703inline
2705 const OpSubtractAssign &op,
2706 const QDPExpr<
2709 BinaryNode<
2714 >
2715 >
2716 >,
2718 > &rhs,
2719 const Subset& s)
2720{
2721
2722#ifdef DEBUG_BLAS_G5
2723 QDPIO::cout << "z -= a GammaConst<Ns,Ns*Ns-1>()*i*y" << endl;
2724#endif
2725
2726#if 0
2727 typedef BinaryNode<OpMultiply,
2729 BinaryNode<
2731 GammaConst<Ns,Ns*Ns-1>,
2734 >
2735 >
2736 > MN;
2737
2738 const MN& mul_node = static_cast<const MN&>(rhs.expression().right());
2739#endif
2740
2741 const OScalar<TScal>& a = static_cast<const OScalar<TScal>& >(rhs.expression().left());
2742
2743 typedef BinaryNode<
2745 GammaConst<Ns,Ns*Ns-1>,
2748 >
2749 > GN;
2750
2751 typedef UnaryNode<FnTimesI,
2753 > IN;
2754
2755 const GN& gamma_node = static_cast<const GN&>(rhs.expression().right());
2756 const IN& timesI_node = static_cast<const IN&>(gamma_node.right());
2757
2758 const OLattice<TVec>& x = static_cast<const OLattice<TVec>&>(timesI_node.child());
2759
2760 REAL ar = a.elem().elem().elem().elem();
2761 REAL *aptr = (REAL *)&ar;
2762
2763 if( s.hasOrderedRep() ) {
2764 REAL *xptr = (REAL *) &(x.elem(s.start()).elem(0).elem(0).real());
2765 REAL* zptr = &(d.elem(s.start()).elem(0).elem(0).real());
2766
2767 int total_n_4vec = (s.end()-s.start()+1);
2768
2769 ordered_xOpayz_ig5_user_arg a = {zptr, aptr, zptr, xptr, xmayz_ig5};
2770
2772
2774 // Original code
2776 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
2777 //int n_4vec = (s.end()-s.start()+1);
2778 //xmayz_ig5(zptr, aptr, zptr, xptr, n_4vec);
2779 }
2780 else {
2781 const int* tab = s.siteTable().slice();
2782
2783 int totalSize = s.numSiteTable();
2784
2785 int Ns = 1;
2786
2787 unordered_xOpayz_ig5_z_user_arg arg(x, d, aptr, Ns, tab, xmayz_ig5);
2788
2790
2792 // Original code
2794 /*
2795 for(int j=0; j < s.numSiteTable(); j++) {
2796 int i=tab[j];
2797 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
2798 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
2799 xmayz_ig5(zptr, aptr, zptr, xptr, 1);
2800
2801 }*/
2802 }
2803
2804}
2805
2806
2807
2808} // namespace QDP;
2809
2810#endif // guard
2811
Outer grid Lattice type.
Definition qdp_outer.h:264
T & elem(int i)
Definition qdp_outer.h:400
Outer grid Scalar class *‍/.
Definition qdp_outer.h:37
Primitive Scalar.
Primitive spin Vector class.
Expression class for QDP.
Definition qdp_qdpexpr.h:16
QDPType - major type class/container for all QDP objects.
Definition qdp_qdptype.h:29
Subsets - controls how lattices are looped.
Definition qdp_subset.h:39
int end() const
Definition qdp_subset.h:81
const multi1d< int > & siteTable() const
Definition qdp_subset.h:83
int numSiteTable() const
Definition qdp_subset.h:84
bool hasOrderedRep() const
Definition qdp_subset.h:79
int start() const
Definition qdp_subset.h:80
const T * slice() const
Return ref to a column slice.
Definition qdp_multi.h:225
Generic Scalar VAXPY routine.
Generic Scalar VAXPY routine.
Generic Scalar VAXPY routine.
Generic Scalar VAXPY routine.
Generic Scalar VSCAL routine.
REAL32 REAL
void evaluate(OLattice< DCol > &d, const OpAssign &op, const QDPExpr< BinaryNode< OpMultiply, Reference< QDPType< DCol, OLattice< DCol > > >, Reference< QDPType< DCol, OLattice< DCol > > > >, OLattice< DCol > > &rhs, const Subset &s)
const int Ns
Definition qdp_params.h:26
StandardOutputStream cout
Definition qdp_stdio.cc:21
Yet another random number generator.
void ordered_vaxpby3_g5_evaluate_function(int lo, int hi, int myId, ordered_vaxpby3_g5_user_arg *a)
PScalar< PScalar< RScalar< REAL > > > TScal
void add_g5ProjPlus(REAL *Out, REAL *X, REAL *Y, int n_4vec)
void axpbyz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void axmbyz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void scal_g5ProjMinus(REAL *Out, REAL *scalep, REAL *In, int n_4vec)
void dispatch_to_threads(int numSiteTable, Arg a, void(*func)(int, int, int, Arg *))
void ordered_xOpayz_ig5_evaluate_function(int lo, int hi, int myId, ordered_xOpayz_ig5_user_arg *a)
void axpbyz_ig5(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void unordered_vaxpby3_g5_evaluate_function(int lo, int hi, int myId, unordered_vaxpby3_g5_user_arg *a)
void ordered_vadd3_g5_evaluate_function(int lo, int hi, int myId, ordered_vadd3_g5_user_arg *a)
void xpayz_ig5(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
void ordered_vaypx3_g5_evaluate_function(int lo, int hi, int myId, ordered_vaypx3_g5_user_arg *a)
void add_g5ProjMinus(REAL *Out, REAL *X, REAL *Y, int n_4vec)
void unordered_xOpayz_ig5_y_evaluate_function(int lo, int hi, int myId, unordered_xOpayz_ig5_y_user_arg *a)
void unordered_axOpbyz_g5_evaluate_function(int lo, int hi, int myId, unordered_axOpbyz_g5_user_arg *a)
void xmayz_g5(REAL *Out, REAL *scalep, REAL *Add, REAL *InScale, int n_4vec)
void ordered_axOpbyz_g5_evaluate_function(int lo, int hi, int myId, ordered_axOpbyz_g5_user_arg *a)
void axmyz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
void ordered_vscal_g5_evaluate_function(int lo, int hi, int myId, ordered_vscal_g5_user_arg *a)
void axmbyz_ig5(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void xmayz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *Add, REAL *InScale, int n_4vec)
void axpbyz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void sub_g5ProjPlus(REAL *Out, REAL *X, REAL *Y, int n_4vec)
void xmayz_ig5(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
void axpbyz_g5(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void axmbyz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void unordered_vscal_g5_evaluate_function(int lo, int hi, int myId, unordered_vscal_g5_user_arg *a)
void sub_g5ProjMinus(REAL *Out, REAL *X, REAL *Y, int n_4vec)
void scal_g5ProjPlus(REAL *Out, REAL *scalep, REAL *In, int n_4vec)
void g5_axmbyz(REAL *Out, REAL *scalep, REAL *InScale, REAL *scalep2, REAL *Add, int n_4vec)
void unordered_xOpayz_ig5_z_evaluate_function(int lo, int hi, int myId, unordered_xOpayz_ig5_z_user_arg *a)
void xpayz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *Add, REAL *InScale, int n_4vec)
void ordered_scal_g5_evaluate_function(int lo, int hi, int myId, ordered_scal_g5_user_arg *a)
void axpyz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
PSpinVector< PColorVector< RComplex< REAL >, 3 >, Ns > TVec
void unordered_scal_g5_evaluate_function(int lo, int hi, int myId, unordered_scal_g5_user_arg *a)
void axmyz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
void unordered_vaypx3_g5_z_evaluate_function(int lo, int hi, int myId, unordered_vaypx3_g5_z_user_arg *a)
void ordered_xOpayz_g5_evaluate_function(int lo, int hi, int myId, ordered_xOpayz_g5_user_arg *a)
void ordered_vaxpy3_g5_evaluate_function(int lo, int hi, int myId, ordered_vaxpy3_g5_user_arg *a)
void axpyz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *InScale, REAL *Add, int n_4vec)
void xmayz_g5ProjMinus(REAL *Out, REAL *scalep, REAL *Add, REAL *InScale, int n_4vec)
void unordered_vaxpy3_g5_evaluate_function(int lo, int hi, int myId, unordered_vaxpy3_g5_user_arg *a)
void unordered_xOpayz_g5_evaluate_function(int lo, int hi, int myId, unordered_xOpayz_g5_user_arg *a)
void xpayz_g5ProjPlus(REAL *Out, REAL *scalep, REAL *Add, REAL *InScale, int n_4vec)
void unordered_vaypx3_g5_y_evaluate_function(int lo, int hi, int myId, unordered_vaypx3_g5_y_user_arg *a)
void unordered_vadd3_g5_evaluate_function(int lo, int hi, int myId, unordered_vadd3_g5_user_arg *a)