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
| #include "blas.h"
|
| 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;
| }
|
|