From ac556fa015287649254f64c8e04c58b040a7ea1b Mon Sep 17 00:00:00 2001 From: Vladimir Chalupecky Date: Mon, 23 Jul 2018 11:49:36 +0200 Subject: [PATCH] lapack/testlapack: add test for randomOrthogonal ... and remove the orthogonality assertion in randomOrthogonal. --- lapack/testlapack/matgen.go | 3 --- lapack/testlapack/matgen_test.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lapack/testlapack/matgen.go b/lapack/testlapack/matgen.go index 5e2af95e..999fbf23 100644 --- a/lapack/testlapack/matgen.go +++ b/lapack/testlapack/matgen.go @@ -675,9 +675,6 @@ func randomOrthogonal(n int, rnd *rand.Rand) blas64.General { // Compute Q * H_j and store the result into Q. applyReflector(q, q, v) } - if !isOrthogonal(q) { - panic("Q not orthogonal") - } return q } diff --git a/lapack/testlapack/matgen_test.go b/lapack/testlapack/matgen_test.go index 08330984..e631a114 100644 --- a/lapack/testlapack/matgen_test.go +++ b/lapack/testlapack/matgen_test.go @@ -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) + } + } +}