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 // Dorm2r multiplies a general matrix C by an orthogonal matrix from a QR factorization
10 // determined by Dgeqrf.
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 size m×k, and if side == blas.Right
18 // tau contains the Householder factors and is of length at least k and this function
19 // will panic otherwise.
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 // Dorm2r is an internal routine. It is exported for testing purposes.
25 func (impl Implementation) Dorm2r(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
37 checkMatrix(m, k, a, lda)
43 checkMatrix(n, k, a, lda)
48 checkMatrix(m, n, c, ldc)
49 if m == 0 || n == 0 || k == 0 {
57 for i := k - 1; i >= 0; i-- {
60 impl.Dlarf(side, m-i, n, a[i*lda+i:], lda, tau[i], c[i*ldc:], ldc, work)
65 for i := 0; i < k; i++ {
68 impl.Dlarf(side, m-i, n, a[i*lda+i:], lda, tau[i], c[i*ldc:], ldc, work)
74 for i := 0; i < k; i++ {
77 impl.Dlarf(side, m, n-i, a[i*lda+i:], lda, tau[i], c[i:], ldc, work)
82 for i := k - 1; i >= 0; i-- {
85 impl.Dlarf(side, m, n-i, a[i*lda+i:], lda, tau[i], c[i:], ldc, work)