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.
7 import "gonum.org/v1/gonum/blas"
9 // Dorml2 multiplies a general matrix C by an orthogonal matrix from an LQ factorization
10 // determined by Dgelqf.
11 // C = Q * C if side == blas.Left and trans == blas.NoTrans
12 // C = Q^T * C if side == blas.Left and trans == blas.Trans
13 // C = C * Q if side == blas.Right and trans == blas.NoTrans
14 // C = C * Q^T if side == blas.Right and trans == blas.Trans
15 // If side == blas.Left, a is a matrix of side k×m, and if side == blas.Right
18 // tau contains the Householder factors and is of length at least k and this function will
21 // work is temporary storage of length at least n if side == blas.Left
22 // and at least m if side == blas.Right and this function will panic otherwise.
24 // Dorml2 is an internal routine. It is exported for testing purposes.
25 func (impl Implementation) Dorml2(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64) {
26 if side != blas.Left && side != blas.Right {
29 if trans != blas.Trans && trans != blas.NoTrans {
33 left := side == blas.Left
34 notran := trans == blas.NoTrans
36 checkMatrix(k, m, a, lda)
41 checkMatrix(k, n, a, lda)
46 checkMatrix(m, n, c, ldc)
47 if m == 0 || n == 0 || k == 0 {
52 for i := 0; i < k; i++ {
55 impl.Dlarf(side, m-i, n, a[i*lda+i:], 1, tau[i], c[i*ldc:], ldc, work)
60 for i := k - 1; i >= 0; i-- {
63 impl.Dlarf(side, m-i, n, a[i*lda+i:], 1, tau[i], c[i*ldc:], ldc, work)
68 for i := k - 1; i >= 0; i-- {
71 impl.Dlarf(side, m, n-i, a[i*lda+i:], 1, tau[i], c[i:], ldc, work)
75 case !left && !notran:
76 for i := 0; i < k; i++ {
79 impl.Dlarf(side, m, n-i, a[i*lda+i:], 1, tau[i], c[i:], ldc, work)