all: unify notation for elementary reflectors

This commit is contained in:
Vladimir Chalupecky
2016-04-15 12:14:29 +09:00
parent aa7baaf8d1
commit 4b93a201c9
15 changed files with 39 additions and 39 deletions

View File

@@ -354,7 +354,7 @@ func (impl Implementation) Dgecon(norm lapack.MatrixNorm, n int, a []float64, ld
//
// See Dgeqr2 for a description of the elementary reflectors and orthonormal
// matrix Q. Q is constructed as a product of these elementary reflectors,
// Q = H(k-1) ... H(1) * H(0),
// Q = H(k-1) * ... * H(1) * H(0),
// where k = min(m,n).
//
// Work is temporary storage of length at least m and this function will panic otherwise.
@@ -415,7 +415,7 @@ func (impl Implementation) Dgelqf(m, n int, a []float64, lda int, tau, work []fl
// and computing H(i) = I - tau[i] * v * v^T.
//
// The orthonormal matrix Q can be constucted from a product of these elementary
// reflectors, Q = H(0) * H(1) ... H(k-1), where k = min(m,n).
// reflectors, Q = H(0) * H(1) * ... * H(k-1), where k = min(m,n).
//
// Work is temporary storage of length at least n and this function will panic otherwise.
func (impl Implementation) Dgeqr2(m, n int, a []float64, lda int, tau, work []float64) {
@@ -739,7 +739,7 @@ func (impl Implementation) Dorgbr(vect lapack.DecompUpdate, m, n, k int, a []flo
// Dorglq generates an m×n matrix Q with orthonormal rows defined by the product
// of elementary reflectors
// Q = H(k-1) ... H(1) * H(0)
// Q = H(k-1) * ... * H(1) * H(0)
// as computed by Dgelqf. Dorglq is the blocked version of Dorgl2 that makes
// greater use of level-3 BLAS routines.
//
@@ -781,7 +781,7 @@ func (impl Implementation) Dorglq(m, n, k int, a []float64, lda int, tau, work [
// Dorgqr generates an m×n matrix Q with orthonormal columns defined by the
// product of elementary reflectors
// Q = H(0) * H(1) ... H(k-1)
// Q = H(0) * H(1) * ... * H(k-1)
// as computed by Dgeqrf. Dorgqr is the blocked version of Dorg2r that makes
// greater use of level-3 BLAS routines.
//

View File

@@ -48,8 +48,8 @@ type Float64 interface {
type Direct byte
const (
Forward Direct = 'F' // Reflectors are right-multiplied, H_1 * H_2 * ... * H_k
Backward Direct = 'B' // Reflectors are left-multiplied, H_k * ... * H_2 * H_1
Forward Direct = 'F' // Reflectors are right-multiplied, H(0) * H(1) * ... * H(k).
Backward Direct = 'B' // Reflectors are left-multiplied, H(k) * ... * H(1) * H(0).
)
// Sort is the sorting order.

View File

@@ -115,7 +115,7 @@ func Gels(trans blas.Transpose, a blas64.General, b blas64.General, work []float
// and computing H(i) = I - tau[i] * v * v^T.
//
// The orthonormal matrix Q can be constucted from a product of these elementary
// reflectors, Q = H(0) * H(1) ... H(k-1), where k = min(m,n).
// reflectors, Q = H(0) * H(1) * ... * H(k-1), where k = min(m,n).
//
// Work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m and this function will panic otherwise.
@@ -135,7 +135,7 @@ func Geqrf(a blas64.General, tau, work []float64, lwork int) {
//
// See Geqrf for a description of the elementary reflectors and orthonormal
// matrix Q. Q is constructed as a product of these elementary reflectors,
// Q = H(k-1) ... H(1) * H(0).
// Q = H(k-1) * ... * H(1) * H(0).
//
// Work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m and this function will panic otherwise.

View File

@@ -36,7 +36,7 @@ func (impl Implementation) Dgebd2(m, n int, a []float64, lda int, d, e, tauQ, ta
a[i*lda+i], tauQ[i] = impl.Dlarfg(m-i, a[i*lda+i], a[min(i+1, m-1)*lda+i:], lda)
d[i] = a[i*lda+i]
a[i*lda+i] = 1
// Apply H[i] to A[i:m, i+1:n] from the left.
// Apply H(i) to A[i:m, i+1:n] from the left.
if i < n-1 {
impl.Dlarf(blas.Left, m-i, n-i-1, a[i*lda+i:], lda, tauQ[i], a[i*lda+i+1:], lda, work)
}

View File

@@ -19,7 +19,7 @@ import "github.com/gonum/blas"
//
// See Dgeqr2 for a description of the elementary reflectors and orthonormal
// matrix Q. Q is constructed as a product of these elementary reflectors,
// Q = H(k-1) ... H(1) * H(0).
// Q = H(k-1) * ... * H(1) * H(0).
//
// work is temporary storage of length at least m and this function will panic otherwise.
//

View File

@@ -12,9 +12,9 @@ import "github.com/gonum/blas"
// where Q is an m×m orthonormal matrix and L is a lower trapezoidal matrix.
//
// Q is represented as a product of elementary reflectors,
// Q = H[k-1] * ... * H[1] * H[0]
// where k = min(m,n) and each H[i] has the form
// H[i] = I - tau[i] * v_i * v_i^T
// Q = H(k-1) * ... * H(1) * H(0)
// where k = min(m,n) and each H(i) has the form
// H(i) = I - tau[i] * v_i * v_i^T
// Vector v_i has v[m-k+i+1:m] = 0, v[m-k+i] = 1, and v[:m-k+i+1] is stored on
// exit in A[0:m-k+i-1, n-k+i].
//
@@ -34,10 +34,10 @@ func (impl Implementation) Dgeql2(m, n int, a []float64, lda int, tau, work []fl
k := min(m, n)
var aii float64
for i := k - 1; i >= 0; i-- {
// Generate elementary reflector H[i] to annihilate A[0:m-k+i-1, n-k+i].
// Generate elementary reflector H(i) to annihilate A[0:m-k+i-1, n-k+i].
aii, tau[i] = impl.Dlarfg(m-k+i+1, a[(m-k+i)*lda+n-k+i], a[n-k+i:], lda)
// Apply H[i] to A[0:m-k+i, 0:n-k+i-1] from the left.
// Apply H(i) to A[0:m-k+i, 0:n-k+i-1] from the left.
a[(m-k+i)*lda+n-k+i] = 1
impl.Dlarf(blas.Left, m-k+i+1, n-k+i, a[n-k+i:], lda, tau[i], a, lda, work)
a[(m-k+i)*lda+n-k+i] = aii

View File

@@ -25,7 +25,7 @@ import "github.com/gonum/blas"
// and computing H(i) = I - tau[i] * v * v^T.
//
// The orthonormal matrix Q can be constructed from a product of these elementary
// reflectors, Q = H(0) * H(1) ... H(k-1), where k = min(m,n).
// reflectors, Q = H(0) * H(1) * ... * H(k-1), where k = min(m,n).
//
// work is temporary storage of length at least n and this function will panic otherwise.
//

View File

@@ -22,8 +22,8 @@ import (
// elements, and e are the off-diagonal elements.
//
// The matrices Q and P are products of elementary reflectors
// Q = H(0) * H(1) ... H(nb-1)
// P = G(0) * G(1) ... G(nb-1)
// Q = H(0) * H(1) * ... * H(nb-1)
// P = G(0) * G(1) * ... * G(nb-1)
// where
// H(i) = I - tauQ[i] * v_i * v_i^T
// G(i) = I - tauP[i] * u_i * u_i^T

View File

@@ -15,8 +15,8 @@ import (
// H = I - V * T * V^T if store == lapack.ColumnWise
// H = I - V^T * T * V if store == lapack.RowWise
// H is defined by a product of the elementary reflectors where
// H = H(0) * H(1) ... H(k-1) if direct == lapack.Forward
// H = H(k-1) ... H(1) * H(0) if direct == lapack.Backward
// H = H(0) * H(1) * ... * H(k-1) if direct == lapack.Forward
// H = H(k-1) * ... * H(1) * H(0) if direct == lapack.Backward
//
// t is a k×k triangular matrix. t is upper triangular if direct = lapack.Forward
// and lower triangular otherwise. This function will panic if t is not of

View File

@@ -53,11 +53,11 @@ import (
// H has the form
// I - tau * v * v^T
// If uplo == blas.Upper,
// Q = H[n] * H[n-1] * ... * H[n-nb+1]
// Q = H(n) * H(n-1) * ... * H(n-nb+1)
// where v[:i-1] is stored in A[:i-1,i], v[i-1] = 1, and v[i:n] = 0.
//
// If uplo == blas.Lower,
// Q = H[1] * H[2] * ... H[nb]
// Q = H(1) * H(2) * ... H(nb)
// where v[1:i+1] = 0, v[i+1] = 1, and v[i+2:n] is stored in A[i+2:n,i].
//
// The vectors v form the n×nb matrix V which is used with W to apply a

View File

@@ -11,7 +11,7 @@ import (
// Dorg2l generates an m×n matrix Q with orthonormal columns which is defined
// as the last n columns of a product of k elementary reflectors of order m.
// Q = H[k-1] * ... * H[1] * H[0]
// Q = H(k-1) * ... * H(1) * H(0)
// See Dgelqf for more information. It must be that m >= n >= k.
//
// tau contains the scalar reflectors computed by Dgeqlf. tau must have length
@@ -51,7 +51,7 @@ func (impl Implementation) Dorg2l(m, n, k int, a []float64, lda int, tau, work [
for i := 0; i < k; i++ {
ii := n - k + i
// Apply H[i] to A[0:m-k+i, 0:n-k+i] from the left.
// Apply H(i) to A[0:m-k+i, 0:n-k+i] from the left.
a[(m-n+ii)*lda+ii] = 1
impl.Dlarf(blas.Left, m-n+ii+1, ii, a[ii:], lda, tau[i], a, lda, work)
bi.Dscal(m-n+ii, -tau[i], a[ii:], lda)

View File

@@ -12,7 +12,7 @@ import (
// Dorgql generates the m×n matrix Q with orthonormal columns defined as the
// last n columns of a product of k elementary reflectors of order m as returned
// by Dgelqf. That is,
// Q = H[k-1] * ... * H[1] * H[0].
// Q = H(k-1) * ... * H(1) * H(0).
// See Dgelqf for more information.
//
// tau must have length at least k, and Dorgql will panic otherwise.
@@ -83,7 +83,7 @@ func (impl Implementation) Dorgql(m, n, k int, a []float64, lda int, tau, work [
ib := min(nb, k-i)
if n-k+i > 0 {
// Form the triangular factor of the block reflector
// H = H[i+ib-1] * ... * H[i+1] * H[i].
// H = H(i+ib-1) * ... * H(i+1) * H(i).
impl.Dlarft(lapack.Backward, lapack.ColumnWise, m-k+i+ib, ib,
a[n-k+i:], lda, tau[i:], work, ldwork)

View File

@@ -10,9 +10,9 @@ import "github.com/gonum/blas"
// of n-1 elementary reflectors of order n as returned by Dsytrd.
//
// The construction of Q depends on the value of uplo:
// Q = H[n-1] * ... * H[1] * H[0] if uplo == blas.Upper
// Q = H[0] * ... * H[n-1] if uplo == blas.Lower
// where H[i] is constructed from the elementary reflectors as computed by Dsytrd.
// Q = H(n-1) * ... * H(1) * H(0) if uplo == blas.Upper
// Q = H(0) * H(1) * ... * H(n-1) if uplo == blas.Lower
// where H(i) is constructed from the elementary reflectors as computed by Dsytrd.
// See the documentation for Dsytrd for more information.
//
// tau must have length at least n-1, and Dorgtr will panic otherwise.

View File

@@ -24,9 +24,9 @@ import (
//
// Q is represented as a product of elementary reflectors.
// If uplo == blas.Upper
// Q = H(n-1) ... H(2) H(1)
// Q = H(n-1) * ... * H(2) * H(1)
// and if uplo == blas.Lower
// Q = H(1) H(2) ... H(n-1)
// Q = H(1) * H(2) * ... * H(n-1)
// where
// H(i) = I - tau * v * v^T
// where tau is stored in tau[i], and v is stored in a.
@@ -66,13 +66,13 @@ func (impl Implementation) Dsytd2(uplo blas.Uplo, n int, a []float64, lda int, d
if uplo == blas.Upper {
// Reduce the upper triangle of A.
for i := n - 2; i >= 0; i-- {
// Generate elementary reflector H[i] = I - tau * v * v^T to
// Generate elementary reflector H(i) = I - tau * v * v^T to
// annihilate A[i:i-1, i+1].
var taui float64
a[i*lda+i+1], taui = impl.Dlarfg(i+1, a[i*lda+i+1], a[i+1:], lda)
e[i] = a[i*lda+i+1]
if taui != 0 {
// Apply H[i] from both sides to A[0:i,0:i].
// Apply H(i) from both sides to A[0:i,0:i].
a[i*lda+i+1] = 1
// Compute x := tau * A * v storing x in tau[0:i].
@@ -95,13 +95,13 @@ func (impl Implementation) Dsytd2(uplo blas.Uplo, n int, a []float64, lda int, d
}
// Reduce the lower triangle of A.
for i := 0; i < n-1; i++ {
// Generate elementary reflector H[i] = I - tau * v * v^T to
// Generate elementary reflector H(i) = I - tau * v * v^T to
// annihilate A[i+2:n, i].
var taui float64
a[(i+1)*lda+i], taui = impl.Dlarfg(n-i-1, a[(i+1)*lda+i], a[min(i+2, n-1)*lda+i:], lda)
e[i] = a[(i+1)*lda+i]
if taui != 0 {
// Apply H[i] from boh sides to A[i+1:n, i+1:n].
// Apply H(i) from boh sides to A[i+1:n, i+1:n].
a[(i+1)*lda+i] = 1
// Compute x := tau * A * v, storing y in tau[i:n-1].

View File

@@ -21,9 +21,9 @@ import (
// the product of elementary reflectors.
//
// If uplo == blas.Upper, Q is constructed with
// Q = H[n-2] * ... * H[1] * H[0]
// Q = H(n-2) * ... * H(1) * H(0)
// where
// H[i] = I - tau * v * v^T
// H(i) = I - tau * v * v^T
// v is constructed as v[i+1:n] = 0, v[i] = 1, v[0:i-1] is stored in A[0:i-1, i+1],
// and tau is in tau[i]. The elements of A are
// [ d e v2 v3 v4]
@@ -33,9 +33,9 @@ import (
// [ e]
//
// If uplo == blas.Lower, Q is constructed with
// Q = H[0] * H[1] * ... * H[n-2]
// Q = H(0) * H(1) * ... * H(n-2)
// where
// H[i] = I - tau * v * v^T
// H(i) = I - tau * v * v^T
// v is constructed as v[0:i+1] = 0, v[i+1] = 1, v[i+2:n] is stored in A[i+2:n, i],
// and tau is in tau[i]. The elements of A are
// [ d ]