#include "common_utest.h"
void test_daxpy_inc_0(void)
{
int i;
int N=8,incX=0,incY=0;
double a=0.25;
double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
BLASFUNC(daxpy)(&N,&a,x1,&incX,y1,&incY);
BLASFUNC_REF(daxpy)(&N,&a,x2,&incX,y2,&incY);
for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_zaxpy_inc_0(void)
{
int i;
int N=4,incX=0,incY=0;
double a[2]={0.25,0.5};
double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
BLASFUNC(zaxpy)(&N,a,x1,&incX,y1,&incY);
BLASFUNC_REF(zaxpy)(&N,a,x2,&incX,y2,&incY);
for(i=0; i<2*N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_saxpy_inc_0(void)
{
int i;
int N=8,incX=0,incY=0;
float a=0.25;
float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
BLASFUNC(saxpy)(&N,&a,x1,&incX,y1,&incY);
BLASFUNC_REF(saxpy)(&N,&a,x2,&incX,y2,&incY);
for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_caxpy_inc_0(void)
{
int i;
int N=4,incX=0,incY=0;
float a[2]={0.25,0.5};
float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
BLASFUNC(caxpy)(&N,a,x1,&incX,y1,&incY);
BLASFUNC_REF(caxpy)(&N,a,x2,&incX,y2,&incY);
for(i=0; i<2*N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}