mirror of
https://github.com/gonum/gonum.git
synced 2025-10-04 23:02:42 +08:00
lapack/testlapack: add test for randomOrthogonal
... and remove the orthogonality assertion in randomOrthogonal.
This commit is contained in:

committed by
Vladimír Chalupecký

parent
99b6f69bff
commit
ac556fa015
@@ -675,9 +675,6 @@ func randomOrthogonal(n int, rnd *rand.Rand) blas64.General {
|
|||||||
// Compute Q * H_j and store the result into Q.
|
// Compute Q * H_j and store the result into Q.
|
||||||
applyReflector(q, q, v)
|
applyReflector(q, q, v)
|
||||||
}
|
}
|
||||||
if !isOrthogonal(q) {
|
|
||||||
panic("Q not orthogonal")
|
|
||||||
}
|
|
||||||
return q
|
return q
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,3 +89,13 @@ func TestDlagge(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRandomOrthogonal(t *testing.T) {
|
||||||
|
rnd := rand.New(rand.NewSource(1))
|
||||||
|
for n := 1; n <= 20; n++ {
|
||||||
|
q := randomOrthogonal(n, rnd)
|
||||||
|
if !isOrthogonal(q) {
|
||||||
|
t.Errorf("Case n=%v: Q not orthogonal", n)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user