1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 "golang.org/x/exp/rand"
14 type Dlabrder interface {
15 Dlabrd(m, n, nb int, a []float64, lda int, d, e, tauq, taup, x []float64, ldx int, y []float64, ldy int)
18 func DlabrdTest(t *testing.T, impl Dlabrder) {
19 rnd := rand.New(rand.NewSource(1))
20 for _, test := range []struct {
21 m, n, nb, lda, ldx, ldy int
30 {4, 5, 2, 10, 11, 12},
31 {4, 5, 4, 10, 11, 12},
32 {5, 5, 2, 10, 11, 12},
33 {5, 5, 5, 10, 11, 12},
34 {5, 4, 2, 10, 11, 12},
35 {5, 4, 4, 10, 11, 12},
37 {4, 5, 2, 11, 12, 10},
38 {4, 5, 4, 11, 12, 10},
39 {5, 5, 2, 11, 12, 10},
40 {5, 5, 5, 11, 12, 10},
41 {5, 4, 2, 11, 12, 10},
42 {5, 4, 4, 11, 12, 10},
44 {4, 5, 2, 12, 11, 10},
45 {4, 5, 4, 12, 11, 10},
46 {5, 5, 2, 12, 11, 10},
47 {5, 5, 5, 12, 11, 10},
48 {5, 4, 2, 12, 11, 10},
49 {5, 4, 4, 12, 11, 10},
66 a := make([]float64, m*lda)
68 a[i] = rnd.NormFloat64()
70 d := make([]float64, nb)
74 e := make([]float64, nb)
78 tauP := make([]float64, nb)
82 tauQ := make([]float64, nb)
86 x := make([]float64, m*ldx)
88 x[i] = rnd.NormFloat64()
90 y := make([]float64, n*ldy)
92 y[i] = rnd.NormFloat64()
94 aCopy := make([]float64, len(a))
97 // Compute the reduction.
98 impl.Dlabrd(m, n, nb, a, lda, d, e, tauQ, tauP, x, ldx, y, ldy)
100 if m >= n && nb == n {
103 if m < n && nb == m {
106 checkBidiagonal(t, m, n, nb, a, lda, d, e, tauP, tauQ, aCopy)