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.
8 "gonum.org/v1/gonum/blas"
9 "gonum.org/v1/gonum/blas/blas64"
12 // Dorgl2 generates an m×n matrix Q with orthonormal rows defined by the
13 // first m rows product of elementary reflectors as computed by Dgelqf.
14 // Q = H_0 * H_1 * ... * H_{k-1}
15 // len(tau) >= k, 0 <= k <= m, 0 <= m <= n, len(work) >= m.
16 // Dorgl2 will panic if these conditions are not met.
18 // Dorgl2 is an internal routine. It is exported for testing purposes.
19 func (impl Implementation) Dorgl2(m, n, k int, a []float64, lda int, tau, work []float64) {
20 checkMatrix(m, n, a, lda)
39 bi := blas64.Implementation()
41 for i := k; i < m; i++ {
42 for j := 0; j < n; j++ {
46 for j := k; j < m; j++ {
50 for i := k - 1; i >= 0; i-- {
54 impl.Dlarf(blas.Right, m-i-1, n-i, a[i*lda+i:], 1, tau[i], a[(i+1)*lda+i:], lda, work)
56 bi.Dscal(n-i-1, -tau[i], a[i*lda+i+1:], 1)
58 a[i*lda+i] = 1 - tau[i]
59 for l := 0; l < i; l++ {