QDP++
generic_blas_vaxmy3.h
Go to the documentation of this file.
1// $Id: generic_blas_vaxmy3.h,v 1.3 2009-09-15 20:48:41 bjoo Exp $
2
7
8#ifndef QDP_GENERIC_BLAS_VAXMY3
9#define QDP_GENERIC_BLAS_VAXMY3
10
11namespace QDP {
12
13// (Vector) Out = (Scalar) (*scalep) * (Vector) InScale - (Vector) Add
14inline
15void vaxmy3(REAL *Out,REAL *scalep,REAL *InScale, REAL *Sub,int n_3vec)
16{
17
18 REAL a = (*scalep);
19 int len = n_3vec * 24;
20 for(int i=0; i < len; i++) {
21 Out[i] = a*InScale[i] - Sub[i];
22 }
23
24#if 0
25 double a;
26 double x0r;
27 double x0i;
28
29 double x1r;
30 double x1i;
31
32 double x2r;
33 double x2i;
34
35 double y0r;
36 double y0i;
37
38 double y1r;
39 double y1i;
40
41 double y2r;
42 double y2i;
43
44 double z0r;
45 double z0i;
46
47 double z1r;
48 double z1i;
49
50 double z2r;
51 double z2i;
52
53 a = *scalep;
54
55 int index_x = 0;
56 int index_y = 0;
57 int index_z = 0;
58
59 int counter;
60 int len = n_3vec*4; // 6 deep unrolled loop
61 // multiply by 4 to get 24.
62
63 for( counter = 0; counter < len; counter++) {
64 x0r = (double)InScale[index_x++];
65 y0r = (double)Sub[index_y++];
66 z0r = a*x0r - y0r;
67 Out[index_z++] = (REAL)z0r;
68
69 x0i = (double)InScale[index_x++];
70 y0i = (double)Sub[index_y++];
71 z0i = a*x0i - y0i;
72 Out[index_z++] = (REAL)z0i;
73
74 x1r = (double)InScale[index_x++];
75 y1r = (double)Sub[index_y++];
76 z1r = a*x1r - y1r;
77 Out[index_z++] = (REAL)z1r;
78
79 x1i = (double)InScale[index_x++];
80 y1i = (double)Sub[index_y++];
81 z1i = a*x1i - y1i;
82 Out[index_z++] = (REAL)z1i;
83
84 x2r = (double)InScale[index_x++];
85 y2r = (double)Sub[index_y++];
86 z2r = a*x2r - y2r;
87 Out[index_z++] = (REAL)z2r;
88
89 x2i = (double)InScale[index_x++];
90 y2i = (double)Sub[index_y++];
91 z2i = a*x2i - y2i;
92 Out[index_z++] = (REAL)z2i;
93 }
94#endif
95
96}
97
98} // namespace QDP;
99
100#endif // guard
REAL32 REAL
Yet another random number generator.
void vaxmy3(REAL *Out, REAL *scalep, REAL *InScale, REAL *Sub, int n_3vec)