From 4b93a201c9a9ff43113f35d10742625e1722d9d3 Mon Sep 17 00:00:00 2001 From: Vladimir Chalupecky Date: Fri, 15 Apr 2016 12:14:29 +0900 Subject: [PATCH] all: unify notation for elementary reflectors --- cgo/lapack.go | 8 ++++---- lapack.go | 4 ++-- lapack64/lapack64.go | 4 ++-- native/dgebd2.go | 2 +- native/dgelq2.go | 2 +- native/dgeql2.go | 10 +++++----- native/dgeqr2.go | 2 +- native/dlabrd.go | 4 ++-- native/dlarft.go | 4 ++-- native/dlatrd.go | 4 ++-- native/dorg2l.go | 4 ++-- native/dorgql.go | 4 ++-- native/dorgtr.go | 6 +++--- native/dsytd2.go | 12 ++++++------ native/dsytrd.go | 8 ++++---- 15 files changed, 39 insertions(+), 39 deletions(-) diff --git a/cgo/lapack.go b/cgo/lapack.go index 9416c1a9..91a7f1c8 100644 --- a/cgo/lapack.go +++ b/cgo/lapack.go @@ -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. // diff --git a/lapack.go b/lapack.go index 260e0e80..a4134559 100644 --- a/lapack.go +++ b/lapack.go @@ -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. diff --git a/lapack64/lapack64.go b/lapack64/lapack64.go index 2cf78356..2e9f3e4f 100644 --- a/lapack64/lapack64.go +++ b/lapack64/lapack64.go @@ -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. diff --git a/native/dgebd2.go b/native/dgebd2.go index 8d1df8d9..dfd8fc1a 100644 --- a/native/dgebd2.go +++ b/native/dgebd2.go @@ -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) } diff --git a/native/dgelq2.go b/native/dgelq2.go index 2521ef52..1c215ddd 100644 --- a/native/dgelq2.go +++ b/native/dgelq2.go @@ -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. // diff --git a/native/dgeql2.go b/native/dgeql2.go index ca412b64..6ac920dd 100644 --- a/native/dgeql2.go +++ b/native/dgeql2.go @@ -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 diff --git a/native/dgeqr2.go b/native/dgeqr2.go index 548b3445..78bd1485 100644 --- a/native/dgeqr2.go +++ b/native/dgeqr2.go @@ -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. // diff --git a/native/dlabrd.go b/native/dlabrd.go index 037d9ae1..a2c4808c 100644 --- a/native/dlabrd.go +++ b/native/dlabrd.go @@ -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 diff --git a/native/dlarft.go b/native/dlarft.go index b3e69c16..ef911861 100644 --- a/native/dlarft.go +++ b/native/dlarft.go @@ -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 diff --git a/native/dlatrd.go b/native/dlatrd.go index ed3a4c4f..653aee37 100644 --- a/native/dlatrd.go +++ b/native/dlatrd.go @@ -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 diff --git a/native/dorg2l.go b/native/dorg2l.go index 65e150cd..3dd80e79 100644 --- a/native/dorg2l.go +++ b/native/dorg2l.go @@ -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) diff --git a/native/dorgql.go b/native/dorgql.go index 3ee88e7f..1b3699d8 100644 --- a/native/dorgql.go +++ b/native/dorgql.go @@ -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) diff --git a/native/dorgtr.go b/native/dorgtr.go index 2864efab..e95ad4e0 100644 --- a/native/dorgtr.go +++ b/native/dorgtr.go @@ -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. diff --git a/native/dsytd2.go b/native/dsytd2.go index 96e2b4fd..69c93369 100644 --- a/native/dsytd2.go +++ b/native/dsytd2.go @@ -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]. diff --git a/native/dsytrd.go b/native/dsytrd.go index 15d0d02d..e6080d0c 100644 --- a/native/dsytrd.go +++ b/native/dsytrd.go @@ -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 ]