QDP++
generic_blas_vaxpby3_g5.h
Go to the documentation of this file.
1// $Id: generic_blas_vaxpby3_g5.h,v 1.2 2007-06-10 14:32:10 edwards Exp $
2
7
8#ifndef QDP_GENERIC_BLAS_VAXPBY3_G5
9#define QDP_GENERIC_BLAS_VAXPBY3_G5
10
11namespace QDP {
12// (Vector) out = (Scalar) (*scalep) * (Vector) InScale + (Vector) P{+} Add
13inline
14void axpbyz_g5ProjPlus(REAL *Out,REAL *scalep,REAL *InScale, REAL *scalep2, REAL *Add,int n_4vec)
15{
16 double a;
17 double b;
18
19 double x0r;
20 double x0i;
21
22 double x1r;
23 double x1i;
24
25 double x2r;
26 double x2i;
27
28 double y0r;
29 double y0i;
30
31 double y1r;
32 double y1i;
33
34 double y2r;
35 double y2i;
36
37 double z0r;
38 double z0i;
39
40 double z1r;
41 double z1i;
42
43 double z2r;
44 double z2i;
45
46 a = *scalep;
47 b = *scalep2;
48
49 int index_x = 0;
50 int index_y = 0;
51 int index_z = 0;
52
53 int counter;
54
55 for( counter = 0; counter < n_4vec; counter++) {
56 // Spin Component 0 (AXPY3)
57 x0r = (double)InScale[index_x++];
58 y0r = (double)Add[index_y++];
59 z0r = a*x0r ;
60 z0r += b*y0r;
61 Out[index_z++] =(REAL) z0r;
62
63 x0i = (double)InScale[index_x++];
64 y0i = (double)Add[index_y++];
65 z0i = a*x0i;
66 z0i += b*y0i;
67 Out[index_z++] =(REAL) z0i;
68
69 x1r = (double)InScale[index_x++];
70 y1r = (double)Add[index_y++];
71 z1r = a*x1r ;
72 z1r += b*y1r;
73 Out[index_z++] = (REAL)z1r;
74
75 x1i = (double)InScale[index_x++];
76 y1i = (double)Add[index_y++];
77 z1i = a*x1i;
78 z1i += b*y1i;
79 Out[index_z++] = (REAL)z1i;
80
81 x2r = (double)InScale[index_x++];
82 y2r = (double)Add[index_y++];
83 z2r = a*x2r ;
84 z2r += b*y2r;
85 Out[index_z++] = (REAL)z2r;
86
87 x2i = (double)InScale[index_x++];
88 y2i = (double)Add[index_y++];
89 z2i = a*x2i ;
90 z2i += b*y2i;
91 Out[index_z++] = (REAL)z2i;
92
93 // Spin Component 1
94 x0r = (double)InScale[index_x++];
95 y0r = (double)Add[index_y++];
96 z0r = a*x0r;
97 z0r += b*y0r;
98 Out[index_z++] =(REAL) z0r;
99
100 x0i = (double)InScale[index_x++];
101 y0i = (double)Add[index_y++];
102 z0i = a*x0i;
103 z0i += b*y0i;
104 Out[index_z++] =(REAL) z0i;
105
106 x1r = (double)InScale[index_x++];
107 y1r = (double)Add[index_y++];
108 z1r = a*x1r ;
109 z1r += b*y1r;
110 Out[index_z++] = (REAL)z1r;
111
112 x1i = (double)InScale[index_x++];
113 y1i = (double)Add[index_y++];
114 z1i = a*x1i;
115 z1i += b*y1i;
116 Out[index_z++] = (REAL)z1i;
117
118 x2r = (double)InScale[index_x++];
119 y2r = (double)Add[index_y++];
120 z2r = a*x2r;
121 z2r += b*y2r;
122 Out[index_z++] = (REAL)z2r;
123
124 x2i = (double)InScale[index_x++];
125 y2i = (double)Add[index_y++];
126 z2i = a*x2i;
127 z2i += b*y2i;
128 Out[index_z++] = (REAL)z2i;
129
130 // Spin Component 2
131 index_y+=12;
132 x0r = (double)InScale[index_x++];
133 z0r = a*x0r;
134 Out[index_z++] =(REAL) z0r;
135
136 x0i = (double)InScale[index_x++];
137 z0i = a*x0i;
138 Out[index_z++] =(REAL) z0i;
139
140 x1r = (double)InScale[index_x++];
141 z1r = a*x1r;
142 Out[index_z++] = (REAL)z1r;
143
144 x1i = (double)InScale[index_x++];
145 z1i = a*x1i;
146 Out[index_z++] = (REAL)z1i;
147
148 x2r = (double)InScale[index_x++];
149 z2r = a*x2r;
150 Out[index_z++] = (REAL)z2r;
151
152 x2i = (double)InScale[index_x++];
153 z2i = a*x2i;
154 Out[index_z++] = (REAL)z2i;
155
156 // Spin Component 3
157 x0r = (double)InScale[index_x++];
158 y0r = (double)Add[index_y]; // Pull into cache
159 z0r = a*x0r;
160 Out[index_z++] =(REAL) z0r;
161
162 x0i = (double)InScale[index_x++];
163 z0i = a*x0i;
164 Out[index_z++] =(REAL) z0i;
165
166 x1r = (double)InScale[index_x++];
167 z1r = a*x1r;
168 Out[index_z++] = (REAL)z1r;
169
170 x1i = (double)InScale[index_x++];
171 z1i = a*x1i;
172 Out[index_z++] = (REAL)z1i;
173
174 x2r = (double)InScale[index_x++];
175 z2r = a*x2r;
176 Out[index_z++] = (REAL)z2r;
177
178 x2i = (double)InScale[index_x++];
179 z2i = a*x2i;
180 Out[index_z++] = (REAL)z2i;
181
182
183 }
184}
185
186inline
187void axpbyz_g5ProjMinus(REAL *Out,REAL *scalep,REAL *InScale, REAL* scalep2, REAL *Add,int n_4vec)
188{
189 double a;
190 double b;
191
192 double x0r;
193 double x0i;
194
195 double x1r;
196 double x1i;
197
198 double x2r;
199 double x2i;
200
201 double y0r;
202 double y0i;
203
204 double y1r;
205 double y1i;
206
207 double y2r;
208 double y2i;
209
210 double z0r;
211 double z0i;
212
213 double z1r;
214 double z1i;
215
216 double z2r;
217 double z2i;
218
219 a = *scalep;
220 b = *scalep2;
221
222 int index_x = 0;
223 int index_y = 0;
224 int index_z = 0;
225
226 int counter;
227
228 for( counter = 0; counter < n_4vec; counter++) {
229
230 // Skip y_index
231 index_y += 12;
232
233 // Spin Component 0 (AXPY3)
234 x0r = (double)InScale[index_x++];
235 Out[index_z++] =(REAL) (a*x0r);
236
237 x0i = (double)InScale[index_x++];
238 Out[index_z++] =(REAL) (a*x0i);
239
240 x1r = (double)InScale[index_x++];
241 Out[index_z++] = (REAL) (a*x1r);
242
243 x1i = (double)InScale[index_x++];
244 Out[index_z++] = (REAL)(a*x1i);
245
246 x2r = (double)InScale[index_x++];
247 Out[index_z++] = (REAL)(a * x2r);
248
249 x2i = (double)InScale[index_x++];
250 Out[index_z++] = (REAL)(a * x2i);
251
252 // Spin Component 1
253 x0r = (double)InScale[index_x++];
254 Out[index_z++] =(REAL) (a*x0r);
255
256 x0i = (double)InScale[index_x++];
257 Out[index_z++] =(REAL) (a*x0i);
258
259 x1r = (double)InScale[index_x++];
260 Out[index_z++] = (REAL) (a*x1r);
261
262 x1i = (double)InScale[index_x++];
263 Out[index_z++] = (REAL)(a*x1i);
264
265 x2r = (double)InScale[index_x++];
266 Out[index_z++] = (REAL)(a * x2r);
267
268 x2i = (double)InScale[index_x++];
269 Out[index_z++] = (REAL)(a * x2i);
270
271 // Spin Component 2 (AXPY3)
272 x0r = (double)InScale[index_x++];
273 y0r = (double)Add[index_y++];
274 z0r = a*x0r ;
275 z0r += b*y0r;
276 Out[index_z++] =(REAL) z0r;
277
278 x0i = (double)InScale[index_x++];
279 y0i = (double)Add[index_y++];
280 z0i = a*x0i;
281 z0i += b*y0i;
282 Out[index_z++] =(REAL) z0i;
283
284 x1r = (double)InScale[index_x++];
285 y1r = (double)Add[index_y++];
286 z1r = a*x1r;
287 z1r += b*y1r;
288 Out[index_z++] = (REAL)z1r;
289
290 x1i = (double)InScale[index_x++];
291 y1i = (double)Add[index_y++];
292 z1i = a*x1i;
293 z1i += b*y1i;
294 Out[index_z++] = (REAL)z1i;
295
296 x2r = (double)InScale[index_x++];
297 y2r = (double)Add[index_y++];
298 z2r = a*x2r;
299 z2r += b*y2r;
300 Out[index_z++] = (REAL)z2r;
301
302 x2i = (double)InScale[index_x++];
303 y2i = (double)Add[index_y++];
304 z2i = a*x2i;
305 z2i += b*y2i;
306 Out[index_z++] = (REAL)z2i;
307
308 // Spin Component 3
309 x0r = (double)InScale[index_x++];
310 y0r = (double)Add[index_y++];
311 z0r = a*x0r;
312 z0r += b*y0r;
313 Out[index_z++] =(REAL) z0r;
314
315 x0i = (double)InScale[index_x++];
316 y0i = (double)Add[index_y++];
317 z0i = a*x0i;
318 z0i += b*y0i;
319 Out[index_z++] =(REAL) z0i;
320
321 x1r = (double)InScale[index_x++];
322 y1r = (double)Add[index_y++];
323 z1r = a*x1r;
324 z1r += b* y1r;
325 Out[index_z++] = (REAL)z1r;
326
327 x1i = (double)InScale[index_x++];
328 y1i = (double)Add[index_y++];
329 z1i = a*x1i;
330 z1i += b*y1i;
331 Out[index_z++] = (REAL)z1i;
332
333 x2r = (double)InScale[index_x++];
334 y2r = (double)Add[index_y++];
335 z2r = a*x2r;
336 z2r += b*y2r;
337 Out[index_z++] = (REAL)z2r;
338
339 x2i = (double)InScale[index_x++];
340 y2i = (double)Add[index_y++];
341 z2i = a*x2i;
342 z2i += b*y2i;
343 Out[index_z++] = (REAL)z2i;
344 }
345}
346
347
348// (Vector) out = (Scalar) (*scalep) * (Vector) InScale - (*scalep2) * (Vector) P{+} Add
349inline
350void axmbyz_g5ProjPlus(REAL *Out,REAL *scalep,REAL *InScale, REAL *scalep2, REAL *Add,int n_4vec)
351{
352 double a;
353 double b;
354
355 double x0r;
356 double x0i;
357
358 double x1r;
359 double x1i;
360
361 double x2r;
362 double x2i;
363
364 double y0r;
365 double y0i;
366
367 double y1r;
368 double y1i;
369
370 double y2r;
371 double y2i;
372
373 double z0r;
374 double z0i;
375
376 double z1r;
377 double z1i;
378
379 double z2r;
380 double z2i;
381
382 a = *scalep;
383 b = *scalep2;
384
385 int index_x = 0;
386 int index_y = 0;
387 int index_z = 0;
388
389 int counter;
390
391 for( counter = 0; counter < n_4vec; counter++) {
392 // Spin Component 0 (AXPY3)
393 x0r = (double)InScale[index_x++];
394 y0r = (double)Add[index_y++];
395 z0r = a*x0r ;
396 z0r -= b*y0r;
397 Out[index_z++] =(REAL) z0r;
398
399 x0i = (double)InScale[index_x++];
400 y0i = (double)Add[index_y++];
401 z0i = a*x0i;
402 z0i -= b*y0i;
403 Out[index_z++] =(REAL) z0i;
404
405 x1r = (double)InScale[index_x++];
406 y1r = (double)Add[index_y++];
407 z1r = a*x1r ;
408 z1r -= b*y1r;
409 Out[index_z++] = (REAL)z1r;
410
411 x1i = (double)InScale[index_x++];
412 y1i = (double)Add[index_y++];
413 z1i = a*x1i;
414 z1i -= b*y1i;
415 Out[index_z++] = (REAL)z1i;
416
417 x2r = (double)InScale[index_x++];
418 y2r = (double)Add[index_y++];
419 z2r = a*x2r ;
420 z2r -= b*y2r;
421 Out[index_z++] = (REAL)z2r;
422
423 x2i = (double)InScale[index_x++];
424 y2i = (double)Add[index_y++];
425 z2i = a*x2i ;
426 z2i -= b*y2i;
427 Out[index_z++] = (REAL)z2i;
428
429 // Spin Component 1
430 x0r = (double)InScale[index_x++];
431 y0r = (double)Add[index_y++];
432 z0r = a*x0r;
433 z0r -= b*y0r;
434 Out[index_z++] =(REAL) z0r;
435
436 x0i = (double)InScale[index_x++];
437 y0i = (double)Add[index_y++];
438 z0i = a*x0i;
439 z0i -= b*y0i;
440 Out[index_z++] =(REAL) z0i;
441
442 x1r = (double)InScale[index_x++];
443 y1r = (double)Add[index_y++];
444 z1r = a*x1r ;
445 z1r -= b*y1r;
446 Out[index_z++] = (REAL)z1r;
447
448 x1i = (double)InScale[index_x++];
449 y1i = (double)Add[index_y++];
450 z1i = a*x1i;
451 z1i -= b*y1i;
452 Out[index_z++] = (REAL)z1i;
453
454 x2r = (double)InScale[index_x++];
455 y2r = (double)Add[index_y++];
456 z2r = a*x2r;
457 z2r -= b*y2r;
458 Out[index_z++] = (REAL)z2r;
459
460 x2i = (double)InScale[index_x++];
461 y2i = (double)Add[index_y++];
462 z2i = a*x2i;
463 z2i -= b*y2i;
464 Out[index_z++] = (REAL)z2i;
465
466 // Spin Component 2
467 index_y+=12;
468 x0r = (double)InScale[index_x++];
469 z0r = a*x0r;
470 Out[index_z++] =(REAL) z0r;
471
472 x0i = (double)InScale[index_x++];
473 z0i = a*x0i;
474 Out[index_z++] =(REAL) z0i;
475
476 x1r = (double)InScale[index_x++];
477 z1r = a*x1r;
478 Out[index_z++] = (REAL)z1r;
479
480 x1i = (double)InScale[index_x++];
481 z1i = a*x1i;
482 Out[index_z++] = (REAL)z1i;
483
484 x2r = (double)InScale[index_x++];
485 z2r = a*x2r;
486 Out[index_z++] = (REAL)z2r;
487
488 x2i = (double)InScale[index_x++];
489 z2i = a*x2i;
490 Out[index_z++] = (REAL)z2i;
491
492 // Spin Component 3
493 x0r = (double)InScale[index_x++];
494 y0r = (double)Add[index_y]; // Pull into cache
495 z0r = a*x0r;
496 Out[index_z++] =(REAL) z0r;
497
498 x0i = (double)InScale[index_x++];
499 z0i = a*x0i;
500 Out[index_z++] =(REAL) z0i;
501
502 x1r = (double)InScale[index_x++];
503 z1r = a*x1r;
504 Out[index_z++] = (REAL)z1r;
505
506 x1i = (double)InScale[index_x++];
507 z1i = a*x1i;
508 Out[index_z++] = (REAL)z1i;
509
510 x2r = (double)InScale[index_x++];
511 z2r = a*x2r;
512 Out[index_z++] = (REAL)z2r;
513
514 x2i = (double)InScale[index_x++];
515 z2i = a*x2i;
516 Out[index_z++] = (REAL)z2i;
517
518
519 }
520}
521
522// OUt = scalep*InScale - scalep2*Add
523inline
524void axmbyz_g5ProjMinus(REAL *Out,REAL *scalep,REAL *InScale, REAL* scalep2, REAL *Add,int n_4vec)
525{
526 double a;
527 double b;
528
529 double x0r;
530 double x0i;
531
532 double x1r;
533 double x1i;
534
535 double x2r;
536 double x2i;
537
538 double y0r;
539 double y0i;
540
541 double y1r;
542 double y1i;
543
544 double y2r;
545 double y2i;
546
547 double z0r;
548 double z0i;
549
550 double z1r;
551 double z1i;
552
553 double z2r;
554 double z2i;
555
556 a = *scalep;
557 b = *scalep2;
558
559 int index_x = 0;
560 int index_y = 0;
561 int index_z = 0;
562
563 int counter;
564
565 for( counter = 0; counter < n_4vec; counter++) {
566
567 // Skip y_index
568 index_y += 12;
569
570 // Spin Component 0 (AXPY3)
571 x0r = (double)InScale[index_x++];
572 Out[index_z++] =(REAL) (a*x0r);
573
574 x0i = (double)InScale[index_x++];
575 Out[index_z++] =(REAL) (a*x0i);
576
577 x1r = (double)InScale[index_x++];
578 Out[index_z++] = (REAL) (a*x1r);
579
580 x1i = (double)InScale[index_x++];
581 Out[index_z++] = (REAL)(a*x1i);
582
583 x2r = (double)InScale[index_x++];
584 Out[index_z++] = (REAL)(a * x2r);
585
586 x2i = (double)InScale[index_x++];
587 Out[index_z++] = (REAL)(a * x2i);
588
589 // Spin Component 1
590 x0r = (double)InScale[index_x++];
591 Out[index_z++] =(REAL) (a*x0r);
592
593 x0i = (double)InScale[index_x++];
594 Out[index_z++] =(REAL) (a*x0i);
595
596 x1r = (double)InScale[index_x++];
597 Out[index_z++] = (REAL) (a*x1r);
598
599 x1i = (double)InScale[index_x++];
600 Out[index_z++] = (REAL)(a*x1i);
601
602 x2r = (double)InScale[index_x++];
603 Out[index_z++] = (REAL)(a * x2r);
604
605 x2i = (double)InScale[index_x++];
606 Out[index_z++] = (REAL)(a * x2i);
607
608 // Spin Component 2 (AXPY3)
609 x0r = (double)InScale[index_x++];
610 y0r = (double)Add[index_y++];
611 z0r = a*x0r ;
612 z0r -= b*y0r;
613 Out[index_z++] =(REAL) z0r;
614
615 x0i = (double)InScale[index_x++];
616 y0i = (double)Add[index_y++];
617 z0i = a*x0i;
618 z0i -= b*y0i;
619 Out[index_z++] =(REAL) z0i;
620
621 x1r = (double)InScale[index_x++];
622 y1r = (double)Add[index_y++];
623 z1r = a*x1r;
624 z1r -= b*y1r;
625 Out[index_z++] = (REAL)z1r;
626
627 x1i = (double)InScale[index_x++];
628 y1i = (double)Add[index_y++];
629 z1i = a*x1i;
630 z1i -= b*y1i;
631 Out[index_z++] = (REAL)z1i;
632
633 x2r = (double)InScale[index_x++];
634 y2r = (double)Add[index_y++];
635 z2r = a*x2r;
636 z2r -= b*y2r;
637 Out[index_z++] = (REAL)z2r;
638
639 x2i = (double)InScale[index_x++];
640 y2i = (double)Add[index_y++];
641 z2i = a*x2i;
642 z2i -= b*y2i;
643 Out[index_z++] = (REAL)z2i;
644
645 // Spin Component 3
646 x0r = (double)InScale[index_x++];
647 y0r = (double)Add[index_y++];
648 z0r = a*x0r;
649 z0r -= b*y0r;
650 Out[index_z++] =(REAL) z0r;
651
652 x0i = (double)InScale[index_x++];
653 y0i = (double)Add[index_y++];
654 z0i = a*x0i;
655 z0i -= b*y0i;
656 Out[index_z++] =(REAL) z0i;
657
658 x1r = (double)InScale[index_x++];
659 y1r = (double)Add[index_y++];
660 z1r = a*x1r;
661 z1r -= b* y1r;
662 Out[index_z++] = (REAL)z1r;
663
664 x1i = (double)InScale[index_x++];
665 y1i = (double)Add[index_y++];
666 z1i = a*x1i;
667 z1i -= b*y1i;
668 Out[index_z++] = (REAL)z1i;
669
670 x2r = (double)InScale[index_x++];
671 y2r = (double)Add[index_y++];
672 z2r = a*x2r;
673 z2r -= b*y2r;
674 Out[index_z++] = (REAL)z2r;
675
676 x2i = (double)InScale[index_x++];
677 y2i = (double)Add[index_y++];
678 z2i = a*x2i;
679 z2i -= b*y2i;
680 Out[index_z++] = (REAL)z2i;
681 }
682}
683
684
685
686
687} // namespace QDP;
688
689#endif // guard
REAL32 REAL
Yet another random number generator.
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 axpbyz_g5ProjPlus(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)