mirror of
https://github.com/gonum/gonum.git
synced 2025-10-16 04:00:48 +08:00
lapack/gonum: handle NaN and Inf input to Dgecon
See https://github.com/Reference-LAPACK/lapack/pull/926
This commit is contained in:

committed by
Vladimír Chalupecký

parent
db43f45c2b
commit
fa306f215a
@@ -6,6 +6,7 @@ package testlapack
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/exp/rand"
|
||||
@@ -87,5 +88,25 @@ func dgeconTest(t *testing.T, impl Dgeconer, rnd *rand.Rand, n, lda int) {
|
||||
t.Errorf("%v: unexpected value of rcond; got=%v, want=%v (ratio=%v)",
|
||||
name, rcondGot, rcondWant, ratio)
|
||||
}
|
||||
|
||||
// Check for corner-case values of anorm.
|
||||
for _, anorm := range []float64{0, math.Inf(1), math.NaN()} {
|
||||
rcondGot = impl.Dgecon(norm, n, aFac, lda, anorm, work, iwork)
|
||||
if n == 0 {
|
||||
if rcondGot != 1 {
|
||||
t.Errorf("%v: unexpected rcond when anorm=%v: got=%v, want=1", name, anorm, rcondGot)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if math.IsNaN(anorm) {
|
||||
if !math.IsNaN(rcondGot) {
|
||||
t.Errorf("%v: NaN not propagated when anorm=NaN: got=%v", name, rcondGot)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if rcondGot != 0 {
|
||||
t.Errorf("%v: unexpected rcond when anorm=%v: got=%v, want=0", name, anorm, rcondGot)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user