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