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.
10 "golang.org/x/exp/rand"
13 type Dgetrfer interface {
14 Dgetrf(m, n int, a []float64, lda int, ipiv []int) bool
17 func DgetrfTest(t *testing.T, impl Dgetrfer) {
18 rnd := rand.New(rand.NewSource(1))
19 for _, test := range []struct {
49 a := make([]float64, m*lda)
54 ipiv := make([]int, mn)
59 // Cannot compare the outputs of Dgetrf and Dgetf2 because the pivoting may
60 // happen differently. Instead check that the LPQ factorization is correct.
61 aCopy := make([]float64, len(a))
63 ok := impl.Dgetrf(m, n, a, lda, ipiv)
64 checkPLU(t, ok, m, n, lda, ipiv, a, aCopy, 1e-10, false)