QDP++
generic_blas_vscal.h
Go to the documentation of this file.
1// $Id: generic_blas_vscal.h,v 1.3 2009-09-15 20:48:42 bjoo Exp $
2
7
8#ifndef QDP_GENERIC_BLAS_VSCAL
9#define QDP_GENERIC_BLAS_VSCAL
10
11namespace QDP {
12
13// (Vector) out = (Scalar) (*scalep) * (Vector) In
14inline
15void vscal(REAL *Out, REAL *scalep, REAL *In, int n_3vec)
16{
17 REAL a = (*scalep);
18 int len = 24*n_3vec;
19 for(int i=0; i < len; i++) {
20 Out[i] = a*In[i];
21 }
22#if 0
23 double a = *scalep;
24
25 double i0r;
26 double i0i;
27 double i1r;
28 double i1i;
29 double i2r;
30 double i2i;
31
32 double o0r;
33 double o0i;
34 double o1r;
35 double o1i;
36 double o2r;
37 double o2i;
38
39 int counter=0;
40 int inptr=0;
41 int outptr=0;
42
43 if( n_3vec > 0 ) {
44 i0r = (double)In[inptr++];
45 i0i = (double)In[inptr++];
46 i1r = (double)In[inptr++];
47 int len = 4*n_3vec;
48 for(counter = 0; counter < len-1 ; counter++) {
49 o0r = a*i0r;
50 Out[outptr++] = (REAL)o0r;
51
52 i1i = (double)In[inptr++];
53 i2r = (double)In[inptr++];
54 o0i = a*i0i;
55 Out[outptr++] = (REAL)o0i;
56
57 i2i = (double)In[inptr++];
58 i0r = (double)In[inptr++];
59 o1r = a*i1r;
60 Out[outptr++] = (REAL)o1r;
61
62 i0i = (double)In[inptr++];
63 i1r = (double)In[inptr++]; // Last prefetched
64
65 o1i = a*i1i;
66 Out[outptr++] = (REAL)o1i;
67
68 o2r= a*i2r;
69 Out[outptr++] = (REAL)o2r;
70
71 o2i= a*i2i;
72 Out[outptr++] = (REAL)o2i;
73 }
74
75 o0r = a*i0r;
76 Out[outptr++] =(REAL) o0r;
77
78 i1i = (double)In[inptr++];
79 i2r = (double)In[inptr++];
80 o0i = a*i0i;
81 Out[outptr++] = (REAL)o0i;
82
83 i2i = (double)In[inptr++];
84 o1r = a*i1r;
85 Out[outptr++] = (REAL)o1r;
86
87 o1i = a*i1i;
88 Out[outptr++] = (REAL)o1i;
89
90 o2r= a*i2r;
91 Out[outptr++] = (REAL)o2r;
92
93 o2i= a*i2i;
94 Out[outptr++] = (REAL)o2i;
95
96 }
97#endif
98
99}
100
101} // namespace QDP;
102
103#endif // guard
REAL32 REAL
Yet another random number generator.
void vscal(REAL *Out, REAL *scalep, REAL *In, int n_3vec)