Correct ROTMG utest for issue1452 and add another from gonum

also correct transposition of expected and observed values in error messages
This commit is contained in:
Martin Kroeker 2018-03-03 14:47:13 +01:00 committed by GitHub
parent 81f81cbc63
commit 3fb3a74c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 54 additions and 19 deletions

View File

@ -71,13 +71,13 @@ CTEST (drotmg,rotmg)
tr_param[4]= 0.0; tr_param[4]= 0.0;
BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param); BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
ASSERT_DBL_NEAR_TOL(te_d1, tr_d1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_d2, tr_d2, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_x1, tr_x1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_y1, tr_y1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
for(i=0; i<5; i++){ for(i=0; i<5; i++){
ASSERT_DBL_NEAR_TOL(te_param[i], tr_param[i], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
} }
} }
@ -91,7 +91,7 @@ CTEST (drotmg,rotmg_issue1452)
double tr_param[5]; double tr_param[5];
int i=0; int i=0;
// from issue #1452, buggy version returned 0.000244 for param[3] // from issue #1452
te_d1 = 5.9e-8; te_d1 = 5.9e-8;
te_d2 = 5.960464e-8; te_d2 = 5.960464e-8;
te_x1 = 1.0; te_x1 = 1.0;
@ -100,8 +100,8 @@ CTEST (drotmg,rotmg_issue1452)
for(i=0; i<5; i++){ for(i=0; i<5; i++){
te_param[i]=tr_param[i]=0.0; te_param[i]=tr_param[i]=0.0;
} }
te_param[3]=1./4096.;
//reference values as calulated by netlib blas //reference values as calulated by gonum blas with rotmg rewritten to Hopkins' algorithm
tr_d1= 0.99995592822897; tr_d1= 0.99995592822897;
tr_d2= 0.98981219860583; tr_d2= 0.98981219860583;
tr_x1= 0.03662270484346; tr_x1= 0.03662270484346;
@ -110,19 +110,19 @@ CTEST (drotmg,rotmg_issue1452)
tr_param[0]= -1.0; tr_param[0]= -1.0;
tr_param[1]= 0.00000161109346; tr_param[1]= 0.00000161109346;
tr_param[2]= -0.00024414062500; tr_param[2]= -0.00024414062500;
tr_param[3]= 1.0; tr_param[3]= 0.00024414062500;
tr_param[4]= 0.00000162760417; tr_param[4]= 0.00000162760417;
//OpenBLAS //OpenBLAS
BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param); BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
ASSERT_DBL_NEAR_TOL(te_d1, tr_d1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_d2, tr_d2, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_x1, tr_x1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_y1, tr_y1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
for(i=0; i<5; i++){ for(i=0; i<5; i++){
ASSERT_DBL_NEAR_TOL(te_param[i], tr_param[i], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
} }
} }
@ -160,12 +160,47 @@ CTEST(drotmg, rotmg_D1eqD2_X1eqX2)
//OpenBLAS //OpenBLAS
BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param); BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
ASSERT_DBL_NEAR_TOL(te_d1, tr_d1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_d2, tr_d2, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_x1, tr_x1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(te_y1, tr_y1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
for(i=0; i<5; i++){ for(i=0; i<5; i++){
ASSERT_DBL_NEAR_TOL(te_param[i], tr_param[i], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
}
}
CTEST(drotmg, drotmg_D1_big_D2_big_flag_zero)
{
double te_d1, tr_d1;
double te_d2, tr_d2;
double te_x1, tr_x1;
double te_y1, tr_y1;
double te_param[5]={1.,4096.,-4096.,1.,4096.};
double tr_param[5]={-1.,4096.,-3584.,1792.,4096.};
int i=0;
te_d1= tr_d1=1600000000.;
te_d2= tr_d2=800000000.;
te_x1= tr_x1=8.;
te_y1= tr_y1=7.;
//reference values as calulated by gonum
tr_d1= 68.96627824858757;
tr_d2= 34.483139124293785;
tr_x1= 45312.;
tr_y1= 7.0;
//OpenBLAS
BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
for(i=0; i<5; i++){
ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
} }
} }