lapack/testlapack: clean up hasOrthonormalColumns helper
MODIFY
lapack/testlapack/dorg2l.go
lapack/testlapack/dorg2l.go
package testlapack
import (
- "math"
"testing"
"golang.org/x/exp/rand"
-
"gonum.org/v1/gonum/blas/blas64"
)
@@ -47,30 +45,8 @@ func Dorg2lTest(t *testing.T, impl Dorg2ler) {
aCopy := make([]float64, len(a))
copy(aCopy, a)
impl.Dorg2l(m, n, k, a, lda, tau[n-k:], work)
- if !hasOrthonormalColumns(m, n, a, lda) {
+ if !hasOrthonormalColumns(blas64.General{m, n, lda, a}) {
t.Errorf("Case m=%v, n=%v, k=%v: columns of Q not orthonormal", m, n, k)
}
}
}
-
-// hasOrthonormalColumns returns whether the columns of A are orthonormal.
-func hasOrthonormalColumns(m, n int, a []float64, lda int) bool {
- for i := 0; i < n; i++ {
- for j := i; j < n; j++ {
- dot := blas64.Dot(m,
- blas64.Vector{Inc: lda, Data: a[i:]},
- blas64.Vector{Inc: lda, Data: a[j:]},
- )
- if i == j {
- if math.Abs(dot-1) > 1e-10 {
- return false
- }
- } else {
- if math.Abs(dot) > 1e-10 {
- return false
- }
- }
- }
- }
- return true
-}

lapack/testlapack: clean up hasOrthonormalColumns helper