Skip to content

Commit

Permalink
fix arguments of zscal
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-frbg authored Apr 5, 2024
1 parent 1f080b9 commit d3f93c6
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions utest/test_zscal.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

CTEST(zscal, i_nan)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double nan[] = {NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0};
BLASFUNC(zscal)(9, i, nan, 1);
BLASFUNC(zscal)(&N, i, nan, &incX);
ASSERT_TRUE(isnan(nan[0]));
ASSERT_TRUE(isnan(nan[1]));
ASSERT_TRUE(isnan(nan[16]));
Expand All @@ -22,10 +24,12 @@ CTEST(zscal, i_nan)

CTEST(zscal, i_nan_inc_2)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double nan[] = {NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0,
NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0};
BLASFUNC(zscal)(9, i, nan, 2);
BLASFUNC(zscal)(&N, i, nan, &incX);
ASSERT_TRUE(isnan(nan[0]));
ASSERT_TRUE(isnan(nan[1]));
ASSERT_TRUE(isnan(nan[16]));
Expand All @@ -34,9 +38,11 @@ CTEST(zscal, i_nan_inc_2)

CTEST(zscal, nan_i)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double nan[] = {NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0};
BLASFUNC(zscal)(9, nan, i, 1);
BLASFUNC(zscal)(&N, nan, i, &incX);
ASSERT_TRUE(isnan(i[0]));
ASSERT_TRUE(isnan(i[1]));
ASSERT_TRUE(isnan(i[16]));
Expand All @@ -45,10 +51,12 @@ CTEST(zscal, nan_i)

CTEST(zscal, nan_i_inc_2)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1,
0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double nan[] = {NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0, NAN,0};
BLASFUNC(zscal)(9, nan, i, 2);
BLASFUNC(zscal)(&N, nan, i, &incX);
ASSERT_TRUE(isnan(i[0]));
ASSERT_TRUE(isnan(i[1]));
ASSERT_TRUE(isnan(i[16]));
Expand All @@ -57,9 +65,11 @@ CTEST(zscal, nan_i_inc_2)

CTEST(zscal, i_inf)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double inf[] = {INFINITY, 0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0};
BLASFUNC(zscal)(9, i, inf, 1);
BLASFUNC(zscal)(&N, i, inf, &incX);
ASSERT_TRUE(isnan(inf[0]));
ASSERT_TRUE(isinf(inf[1]));
ASSERT_TRUE(isnan(inf[16]));
Expand All @@ -68,10 +78,12 @@ CTEST(zscal, i_inf)

CTEST(zscal, i_inf_inc_2)
{
int N=9;
int incX=2;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double inf[] = {INFINITY, 0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0,
INFINITY, 0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0};
BLASFUNC(zscal)(9, i, inf, 2);
BLASFUNC(zscal)(&N, i, inf, &incX);
ASSERT_TRUE(isnan(inf[0]));
ASSERT_TRUE(isinf(inf[1]));
ASSERT_TRUE(isnan(inf[16]));
Expand All @@ -80,9 +92,11 @@ CTEST(zscal, i_inf_inc_2)

CTEST(zscal, inf_i)
{
int N=9;
int incX=1;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double inf[] = {INFINITY, 0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0};
BLASFUNC(zscal)(9, inf, i, 1);
BLASFUNC(zscal)(&N, inf, i, &incX);
ASSERT_TRUE(isnan(i[0]));
ASSERT_TRUE(isinf(i[1]));
ASSERT_TRUE(isnan(i[16]));
Expand All @@ -91,10 +105,12 @@ CTEST(zscal, inf_i)

CTEST(zscal, inf_i_inc_2)
{
int N=9;
int incX=2;
double i[] = {0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1,
0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 0,1 };
double inf[] = {INFINITY, 0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0, INFINITY,0};
BLASFUNC(zscal)(9, inf, i, 2);
BLASFUNC(zscal)(&N, inf, i, &incX);
ASSERT_TRUE(isnan(i[0]));
ASSERT_TRUE(isinf(i[1]));
ASSERT_TRUE(isnan(i[16]));
Expand Down

0 comments on commit d3f93c6

Please sign in to comment.