mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
29 lines
579 B
C
29 lines
579 B
C
|
#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;
|
||
|
}
|
||
|
|