blas/testblas: add flag to DrotgTest to skip extreme values

This commit is contained in:
Vladimir Chalupecky
2023-07-08 12:06:30 +02:00
committed by Vladimír Chalupecký
parent bd727a9e14
commit fd2bc7697a
3 changed files with 6 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ func TestDnrm2(t *testing.T) { testblas.Dnrm2Test(t, impl) }
func TestIdamax(t *testing.T) { testblas.IdamaxTest(t, impl) }
func TestDswap(t *testing.T) { testblas.DswapTest(t, impl) }
func TestDcopy(t *testing.T) { testblas.DcopyTest(t, impl) }
func TestDrotg(t *testing.T) { testblas.DrotgTest(t, impl) }
func TestDrotg(t *testing.T) { testblas.DrotgTest(t, impl, false) }
func TestDrotmg(t *testing.T) { testblas.DrotmgTest(t, impl) }
func TestDrot(t *testing.T) { testblas.DrotTest(t, impl) }
func TestDrotm(t *testing.T) { testblas.DrotmTest(t, impl) }

View File

@@ -41,7 +41,7 @@ func TestDcopy(t *testing.T) {
}
func TestDrotg(t *testing.T) {
testblas.DrotgTest(t, impl)
testblas.DrotgTest(t, impl, false)
}
func TestDrotmg(t *testing.T) {

View File

@@ -1623,7 +1623,7 @@ type Drotger interface {
Drotg(a, b float64) (c, s, r, z float64)
}
func DrotgTest(t *testing.T, d Drotger) {
func DrotgTest(t *testing.T, d Drotger, skipExtreme bool) {
drotg := d.Drotg
for _, test := range DrotgTests {
c, s, r, z := drotg(test.A, test.B)
@@ -1648,23 +1648,22 @@ func DrotgTest(t *testing.T, d Drotger) {
tol = 20 * ulp
)
values := []float64{
-safmax,
-1 / ulp,
-1,
-1.0 / 3,
-ulp,
-safmin,
0,
safmin,
ulp,
1.0 / 3,
1,
1 / ulp,
safmax,
math.Inf(-1),
math.Inf(1),
math.NaN(),
}
if !skipExtreme {
values = append(values, -safmax, -safmin, safmin, safmax)
}
for _, f := range values {
for _, g := range values {
name := fmt.Sprintf("Case f=%v,g=%v", f, g)