1 // Copyright ©2017 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.
7 import "gonum.org/v1/gonum/blas/blas64"
9 // Dlapll returns the smallest singular value of the n×2 matrix A = [ x y ].
10 // The function first computes the QR factorization of A = Q*R, and then computes
11 // the SVD of the 2-by-2 upper triangular matrix r.
13 // The contents of x and y are overwritten during the call.
15 // Dlapll is an internal routine. It is exported for testing purposes.
16 func (impl Implementation) Dlapll(n int, x []float64, incX int, y []float64, incY int) float64 {
17 checkVector(n, x, incX)
18 checkVector(n, y, incY)
24 // Compute the QR factorization of the N-by-2 matrix [ X Y ].
25 a00, tau := impl.Dlarfg(n, x[0], x[incX:], incX)
28 bi := blas64.Implementation()
29 c := -tau * bi.Ddot(n, x, incX, y, incY)
30 bi.Daxpy(n, c, x, incX, y, incY)
31 a11, _ := impl.Dlarfg(n-1, y[incY], y[2*incY:], incY)
33 // Compute the SVD of 2-by-2 upper triangular matrix.
34 ssmin, _ := impl.Dlas2(a00, y[0], a11)