1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| #include "blas.h"
| #include "math.h"
|
| void const_cpu(int N, float ALPHA, float *X, int INCX)
| {
| int i;
| for(i = 0; i < N; ++i) X[i*INCX] = ALPHA;
| }
|
| void mul_cpu(int N, float *X, int INCX, float *Y, int INCY)
| {
| int i;
| for(i = 0; i < N; ++i) Y[i*INCY] *= X[i*INCX];
| }
|
| void pow_cpu(int N, float ALPHA, float *X, int INCX, float *Y, int INCY)
| {
| int i;
| for(i = 0; i < N; ++i) Y[i*INCY] = pow(X[i*INCX], ALPHA);
| }
|
| void axpy_cpu(int N, float ALPHA, float *X, int INCX, float *Y, int INCY)
| {
| int i;
| for(i = 0; i < N; ++i) Y[i*INCY] += ALPHA*X[i*INCX];
| }
|
| void scal_cpu(int N, float ALPHA, float *X, int INCX)
| {
| int i;
| for(i = 0; i < N; ++i) X[i*INCX] *= ALPHA;
| }
|
| void copy_cpu(int N, float *X, int INCX, float *Y, int INCY)
| {
| int i;
| for(i = 0; i < N; ++i) Y[i*INCY] = X[i*INCX];
| }
|
| float dot_cpu(int N, float *X, int INCX, float *Y, int INCY)
| {
| int i;
| float dot = 0;
| for(i = 0; i < N; ++i) dot += X[i*INCX] * Y[i*INCY];
| return dot;
| }
|
|