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