native: mark internal routines

These (generally) cannot be made unexported because we test via
testlapack.

Also fix a name and some capitalisation.
This commit is contained in:
kortschak
2016-03-15 14:32:35 +10:30
parent 55e3701411
commit 4813c5ed41
62 changed files with 137 additions and 26 deletions

View File

@@ -47,6 +47,8 @@ import (
// will panic if there is insufficient working memory.
//
// Dbdsqr returns whether the decomposition was successful.
//
// Dbdsqr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dbdsqr(uplo blas.Uplo, n, ncvt, nru, ncc int, d, e, vt []float64, ldvt int, u []float64, ldu int, c []float64, ldc int, work []float64) (ok bool) {
if uplo != blas.Upper && uplo != blas.Lower {
panic(badUplo)

View File

@@ -12,6 +12,8 @@ import "github.com/gonum/blas"
// if m >= n, B is upper diagonal, otherwise B is lower bidiagonal.
// d is the diagonal, len = min(m,n)
// e is the off-diagonal len = min(m,n)-1
//
// Dgebd2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgebd2(m, n int, a []float64, lda int, d, e, tauQ, tauP, work []float64) {
checkMatrix(m, n, a, lda)
if len(d) < min(m, n) {

View File

@@ -42,11 +42,13 @@ import (
// d, tauQ, and tauP must all have length at least min(m,n), and e must have
// length min(m,n) - 1.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= max(m,n) and this function will panic otherwise.
// Dgebrd is blocked decomposition, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgebrd,
// the optimal work length will be stored into work[0].
//
// Dgebrd is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgebrd(m, n int, a []float64, lda int, d, e, tauQ, tauP, work []float64, lwork int) {
checkMatrix(m, n, a, lda)
minmn := min(m, n)

View File

@@ -13,15 +13,17 @@ import "github.com/gonum/blas"
//
// a is modified to contain the information to construct L and Q.
// The lower triangle of a contains the matrix L. The upper triangular elements
// (not including the diagonal) contain the elementary reflectors. Tau is modified
// to contain the reflector scales. Tau must have length of at least k = min(m,n)
// (not including the diagonal) contain the elementary reflectors. tau is modified
// to contain the reflector scales. tau must have length of at least k = min(m,n)
// and this function will panic otherwise.
//
// 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 ... H_2*H_1.
//
// Work is temporary storage of length at least m and this function will panic otherwise.
// work is temporary storage of length at least m and this function will panic otherwise.
//
// Dgelq2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgelq2(m, n int, a []float64, lda int, tau, work []float64) {
checkMatrix(m, n, a, lda)
k := min(m, n)

View File

@@ -13,13 +13,15 @@ import (
// algorithm. Please see the documentation for Dgelq2 for a description of the
// parameters at entry and exit.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m, and this function will panic otherwise.
// Dgelqf is a blocked LQ factorization, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgelqf,
// the optimal work length will be stored into work[0].
//
// tau must have length at least min(m,n), and this function will panic otherwise.
//
// Dgelqf is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgelqf(m, n int, a []float64, lda int, tau, work []float64, lwork int) {
nb := impl.Ilaenv(1, "DGELQF", " ", m, n, -1, -1)
lworkopt := m * max(nb, 1)

View File

@@ -33,7 +33,7 @@ import (
// leading submatrix of b contains the solution vectors X. If trans == blas.NoTrans,
// this submatrix is of size n×nrhs, and of size m×nrhs otherwise.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= max(m,n) + max(m,n,nrhs), and this function will panic
// otherwise. A longer work will enable blocked algorithms to be called.
// In the special case that lwork == -1, work[0] will be set to the optimal working

View File

@@ -6,7 +6,7 @@ package native
import "github.com/gonum/blas"
// Dgeql2 computes the QL factorization of the m×n matrix A. That is, Dgelq2
// Dgeql2 computes the QL factorization of the m×n matrix A. That is, Dgeql2
// computes Q and L such that
// A = Q * L
// where Q is an m×m orthonormal matrix and L is a lower trapezoidal matrix.
@@ -21,6 +21,8 @@ import "github.com/gonum/blas"
// tau must have length at least min(m,n), and Dgeql2 will panic otherwise.
//
// work is temporary memory storage and must have length at least n.
//
// Dgeql2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgeql2(m, n int, a []float64, lda int, tau, work []float64) {
checkMatrix(m, n, a, lda)
if len(tau) < min(m, n) {

View File

@@ -13,7 +13,7 @@ import "github.com/gonum/blas"
//
// A is modified to contain the information to construct Q and R.
// The upper triangle of a contains the matrix R. The lower triangular elements
// (not including the diagonal) contain the elementary reflectors. Tau is modified
// (not including the diagonal) contain the elementary reflectors. tau is modified
// to contain the reflector scales. tau must have length at least min(m,n), and
// this function will panic otherwise.
//
@@ -27,7 +27,9 @@ import "github.com/gonum/blas"
// The orthonormal matrix Q can be constructed from a product of these elementary
// reflectors, Q = H_1*H_2 ... H_k, where k = min(m,n).
//
// Work is temporary storage of length at least n and this function will panic otherwise.
// work is temporary storage of length at least n and this function will panic otherwise.
//
// Dgeqr2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dgeqr2(m, n int, a []float64, lda int, tau, work []float64) {
// TODO(btracey): This is oriented such that columns of a are eliminated.
// This likely could be re-arranged to take better advantage of row-major

View File

@@ -13,7 +13,7 @@ import (
// algorithm. See the documentation for Dgeqr2 for a description of the
// parameters at entry and exit.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m and this function will panic otherwise.
// Dgeqrf is a blocked LQ factorization, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgelqf,

View File

@@ -25,6 +25,8 @@ import (
// be computed regardless of the singularity of A, but division by zero
// will occur if the false is returned and the result is used to solve a
// system of equations.
//
// Dgetf2 is an internal routine. It is exported for testing purposes.
func (Implementation) Dgetf2(m, n int, a []float64, lda int, ipiv []int) (ok bool) {
mn := min(m, n)
checkMatrix(m, n, a, lda)

View File

@@ -16,7 +16,7 @@ import (
// Dgetri will not perform the inversion if the matrix is singular, and returns
// a boolean indicating whether the inversion was successful.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= n and this function will panic otherwise.
// Dgetri is a blocked inversion, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgetri,

View File

@@ -50,6 +50,8 @@ import (
//
// X is an m×nb matrix, Y is an n×nb matrix. d, e, taup, and tauq must all have
// length at least nb. Dlabrd will panic if these size constraints are violated.
//
// Dlabrd is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlabrd(m, n, nb int, a []float64, lda int, d, e, tauQ, tauP, x []float64, ldx int, y []float64, ldy int) {
checkMatrix(m, n, a, lda)
checkMatrix(m, nb, x, ldx)

View File

@@ -22,6 +22,8 @@ import (
//
// isign, v, and x must all have length n and will panic otherwise. isave is used
// for temporary storage.
//
// Dlacn2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlacn2(n int, v, x []float64, isgn []int, est float64, kase int, isave *[3]int) (float64, int) {
checkVector(n, x, 1)
checkVector(n, v, 1)

View File

@@ -9,6 +9,8 @@ import "github.com/gonum/blas"
// Dlacpy copies the elements of A specified by uplo into B. Uplo can specify
// a triangular portion with blas.Upper or blas.Lower, or can specify all of the
// elemest with blas.All.
//
// Dlacpy is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlacpy(uplo blas.Uplo, m, n int, a []float64, lda int, b []float64, ldb int) {
checkMatrix(m, n, a, lda)
checkMatrix(m, n, b, ldb)

View File

@@ -11,6 +11,8 @@ import "math"
// [b c]
// and returns the eigenvalue with the larger absolute value as rt1 and the
// smaller as rt2.
//
// Dlae2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlae2(a, b, c float64) (rt1, rt2 float64) {
sm := a + c
df := a - c

View File

@@ -14,6 +14,8 @@ import "math"
// and [cs1, sn1] which is the unit right eigenvalue for RT1.
// [ cs1 sn1] [a b] [cs1 -sn1] = [rt1 0]
// [-sn1 cs1] [b c] [sn1 cs1] [ 0 rt2]
//
// Dlaev2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlaev2(a, b, c float64) (rt1, rt2, cs1, sn1 float64) {
sm := a + c
df := a - c

View File

@@ -7,6 +7,8 @@ package native
import "math"
// Dlapy2 is the LAPACK version of math.Hypot.
//
// Dlapy2 is an internal routine. It is exported for testing purposes.
func (Implementation) Dlapy2(x, y float64) float64 {
return math.Hypot(x, y)
}

View File

@@ -17,9 +17,10 @@ import (
// h = 1 - tau * v * v^T
// and c is an m * n matrix.
//
// Work is temporary storage of length at least m if side == Left and at least
// work is temporary storage of length at least m if side == Left and at least
// n if side == Right. This function will panic if this length requirement is not met.
//
// Dlarf is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlarf(side blas.Side, m, n int, v []float64, incv int, tau float64, c []float64, ldc int, work []float64) {
applyleft := side == blas.Left
if (applyleft && len(work) < n) || (!applyleft && len(work) < m) {

View File

@@ -50,9 +50,11 @@ import (
// t is a k×k matrix containing the block reflector, and this function will panic
// if t is not of sufficient size. See Dlarft for more information.
//
// Work is a temporary storage matrix with stride ldwork.
// Work must be of size at least n×k side == Left and m×k if side == Right, and
// work is a temporary storage matrix with stride ldwork.
// work must be of size at least n×k side == Left and m×k if side == Right, and
// this function will panic if this size is not met.
//
// Dlarfb is an internal routine. It is exported for testing purposes.
func (Implementation) Dlarfb(side blas.Side, trans blas.Transpose, direct lapack.Direct,
store lapack.StoreV, m, n, k int, v []float64, ldv int, t []float64, ldt int,
c []float64, ldc int, work []float64, ldwork int) {

View File

@@ -20,6 +20,8 @@ import (
// where tau is a real scalar.
//
// On entry, x contains the vector x, on exit it contains v.
//
// Dlarfg is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlarfg(n int, alpha float64, x []float64, incX int) (beta, tau float64) {
if n < 0 {
panic(nLT0)

View File

@@ -26,6 +26,8 @@ import (
// Dlarfb for a description of layout.
//
// tau contains the scalar factor of the elementary reflectors h.
//
// Dlarft is an internal routine. It is exported for testing purposes.
func (Implementation) Dlarft(direct lapack.Direct, store lapack.StoreV, n, k int,
v []float64, ldv int, tau []float64, t []float64, ldt int) {
if n == 0 {

View File

@@ -12,6 +12,8 @@ import "math"
// This is a more accurate version of BLAS drotg, with the other differences that
// if g = 0, then cs = 1 and sn = 0, and if f = 0 and g != 0, then cs = 0 and sn = 1.
// If abs(f) > abs(g), cs will be positive.
//
// Dlartg is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlartg(f, g float64) (cs, sn, r float64) {
safmin := dlamchS
eps := dlamchE

View File

@@ -10,6 +10,8 @@ import "math"
// [F G]
// [0 H]
// The smaller and larger singular values are returned in that order.
//
// Dlas2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlas2(f, g, h float64) (ssmin, ssmax float64) {
fa := math.Abs(f)
ga := math.Abs(g)

View File

@@ -11,6 +11,8 @@ import (
)
// Dlascl multiplies a rectangular matrix by a scalar.
//
// Dlascl is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlascl(kind lapack.MatrixType, kl, ku int, cfrom, cto float64, m, n int, a []float64, lda int) {
checkMatrix(m, n, a, lda)
if cfrom == 0 {

View File

@@ -10,6 +10,8 @@ import "github.com/gonum/blas"
// of a to beta. If uplo == blas.Upper, only the upper diagonal elements are set.
// If uplo == blas.Lower, only the lower diagonal elements are set. If uplo is
// otherwise, all of the elements of a are set.
//
// Dlaset is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlaset(uplo blas.Uplo, m, n int, alpha, beta float64, a []float64, lda int) {
checkMatrix(m, n, a, lda)
if uplo == blas.Upper {

View File

@@ -16,6 +16,8 @@ import (
// order, and e is overwritten. d must have length at least n, e must have
// length at least n-1, and the input work must have length at least 4*n. Dlasq1
// will panic if these conditions are not met.
//
// Dlasq1 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq1(n int, d, e, work []float64) (info int) {
// TODO(btracey): replace info with an error.
if n < 0 {

View File

@@ -32,6 +32,8 @@ import (
//
// z must have length at least 4*n, and must not contain any negative elements.
// Dlasq2 will panic otherwise.
//
// Dlasq2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq2(n int, z []float64) (info int) {
// TODO(btracey): make info an error.
if len(z) < 4*n {

View File

@@ -9,6 +9,8 @@ import "math"
// Dlasq3 checks for deflation, computes a shift (tau) and calls dqds.
// In case of failure it changes shifts, and tries again until output
// is positive.
//
// Dlasq3 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq3(i0, n0 int, z []float64, pp int, dmin, sigma, desig, qmax float64, nFail, iter, nDiv int, ttype int, dmin1, dmin2, dn, dn1, dn2, g, tau float64) (
i0Out, n0Out, ppOut int, dminOut, sigmaOut, desigOut, qmaxOut float64, nFailOut, iterOut, nDivOut, ttypeOut int, dmin1Out, dmin2Out, dnOut, dn1Out, dn2Out, gOut, tauOut float64) {
const cbias = 1.5

View File

@@ -9,6 +9,8 @@ import "math"
// Dlasq4 computes an approximation to the smallest eigenvalue using values of d
// from the previous transform.
// i0, n0, and n0in are zero-indexed.
//
// Dlasq4 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq4(i0, n0 int, z []float64, pp int, n0in int, dmin, dmin1, dmin2, dn, dn1, dn2, tau float64, ttype int, g float64) (tauOut float64, ttypeOut int, gOut float64) {
const (
cnst1 = 0.563

View File

@@ -8,6 +8,8 @@ import "math"
// Dlasq5 computes one dqds transform in ping-pong form.
// i0 and n0 are zero-indexed.
//
// Dlasq5 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq5(i0, n0 int, z []float64, pp int, tau, sigma, dmin, dmin1, dmin2, dn, dnm1, dnm2 float64) (i0Out, n0Out, ppOut int, tauOut, sigmaOut, dminOut, dmin1Out, dmin2Out, dnOut, dnm1Out, dnm2Out float64) {
// TODO(btracey): It seems like outputs listed in the reference implementation
// are actually true outputs, unlike other functions where the value is

View File

@@ -10,6 +10,8 @@ import "math"
// overflow and underflow. z has length at least 4*(n0+1) and holds the qd array.
// i0 is the zero-based first index.
// n0 is the zero-based last index.
//
// Dlasq6 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasq6(i0, n0 int, z []float64, pp int, dmin, dmin1, dmin2, dn, dnm1, dnm2 float64) (dminOut, dmin1Out, dmin2Out, dnOut, dnm1Out, dnm2Out float64) {
// TODO(btracey): It seems like outputs listed in the reference implementation
// are actually true outputs, unlike other functions where the value is

View File

@@ -52,6 +52,8 @@ import (
// [ 1 ]
// [ -s[k] c[k]]
// s and c have length m - 1 if side == blas.Left, and n - 1 if side == blas.Right.
//
// Dlasr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasr(side blas.Side, pivot lapack.Pivot, direct lapack.Direct, m, n int, c, s, a []float64, lda int) {
checkMatrix(m, n, a, lda)
if side != blas.Left && side != blas.Right {

View File

@@ -13,6 +13,8 @@ import (
// Dlasrt sorts the numbers in the input slice d. If sort == lapack.SortIncreasing,
// the elements are sorted in increasing order. If sort == lapack.SortDecreasing,
// the elements are sorted in decreasing order.
//
// Dlasrt is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasrt(s lapack.Sort, n int, d []float64) {
checkVector(n, d, 1)
d = d[:n]

View File

@@ -10,6 +10,8 @@ import "math"
// sumsq represent the current scale and total sum of squares. These values are
// updated with the information in the first n elements of the vector specified
// by x and incX.
//
// Dlassq is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlassq(n int, x []float64, incx int, scale float64, sumsq float64) (scl, smsq float64) {
if n <= 0 {
return scale, sumsq

View File

@@ -11,6 +11,8 @@ import "math"
// [-snl csl] [0 h] [snr csr] = [ 0 ssmin]
// ssmax is the larger absolute singular value, and ssmin is the smaller absolute
// singular value. [cls, snl] and [csr, snr] are the left and right singular vectors.
//
// Dlasv2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasv2(f, g, h float64) (ssmin, ssmax, snr, csr, snl, csl float64) {
ft := f
fa := math.Abs(ft)

View File

@@ -9,6 +9,8 @@ import "github.com/gonum/blas/blas64"
// Dlaswp swaps the rows k1 to k2 of a according to the indices in ipiv.
// a is a matrix with n columns and stride lda. incX is the increment for ipiv.
// k1 and k2 are zero-indexed. If incX is negative, then loops from k2 to k1
//
// Dlaswp is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlaswp(n int, a []float64, lda, k1, k2 int, ipiv []int, incX int) {
if incX != 1 && incX != -1 {
panic(absIncNotOne)

View File

@@ -63,6 +63,8 @@ import (
// The vectors v form the n×nb matrix V which is used with W to apply a
// symmetric rank-2 update to the unreduced part of A
// A = A - V * W^T - W * V^T
//
// Dlatrd is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlatrd(uplo blas.Uplo, n, nb int, a []float64, lda int, e, tau, w []float64, ldw int) {
checkMatrix(n, n, a, lda)
checkMatrix(n, nb, w, ldw)

View File

@@ -25,6 +25,8 @@ import (
// than or equal to the infinity norm, and greater than or equal to the one-norm
// otherwise. If normin == false, then cnorm is treated as an output, and is set
// to contain the 1-norm of the off-diagonal part of the j^th column of A.
//
// Dlatrs is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, normin bool, n int, a []float64, lda int, x []float64, cnorm []float64) (scale float64) {
if uplo != blas.Upper && uplo != blas.Lower {
panic(badUplo)

View File

@@ -19,6 +19,8 @@ import (
//
// work contains temporary memory, and must have length at least n. Dorg2l will
// panic otherwise.
//
// Dorg2l is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorg2l(m, n, k int, a []float64, lda int, tau, work []float64) {
checkMatrix(m, n, a, lda)
if len(tau) < k {

View File

@@ -14,6 +14,8 @@ import (
// Q = H(0) * H(2) * ... * H(k-1)
// len(tau) >= k, 0 <= k <= n, 0 <= n <= m, len(work) >= n.
// Dorg2r will panic if these conditions are not met.
//
// Dorg2r is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorg2r(m, n, k int, a []float64, lda int, tau []float64, work []float64) {
checkMatrix(m, n, a, lda)
if len(tau) < k {

View File

@@ -17,6 +17,8 @@ import "github.com/gonum/lapack"
// If vect == lapack.ApplyP, then A is assumed to have been a k×n matrix, and
// P^T is of order n. If k < n, then Dorgbr returns the first m rows of P^T,
// where n >= m >= k. If k >= n, then Dorgbr returns P^T as an n×n matrix.
//
// Dorgbr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorgbr(vect lapack.DecompUpdate, m, n, k int, a []float64, lda int, tau, work []float64, lwork int) {
mn := min(m, n)
wantq := vect == lapack.ApplyQ

View File

@@ -14,6 +14,8 @@ import (
// Q = H(0) * H(2) * ... * H(k-1)
// len(tau) >= k, 0 <= k <= m, 0 <= m <= n, len(work) >= m.
// Dorgl2 will panic if these conditions are not met.
//
// Dorgl2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorgl2(m, n, k int, a []float64, lda int, tau, work []float64) {
checkMatrix(m, n, a, lda)
if len(tau) < k {

View File

@@ -17,12 +17,14 @@ import (
//
// len(tau) >= k, 0 <= k <= n, and 0 <= n <= m.
//
// Work is temporary storage, and lwork specifies the usable memory length. At minimum,
// work is temporary storage, and lwork specifies the usable memory length. At minimum,
// lwork >= m, and the amount of blocking is limited by the usable length.
// If lwork == -1, instead of computing Dorglq the optimal work length is stored
// into work[0].
//
// Dorglq will panic if the conditions on input values are not met.
//
// Dorglq is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorglq(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) {
nb := impl.Ilaenv(1, "DORGLQ", " ", m, n, k, -1)
// work is treated as an n×nb matrix

View File

@@ -17,11 +17,13 @@ import (
//
// tau must have length at least k, and Dorgql will panic otherwise.
//
// Work is temporary storage, and lwork specifies the usable memory length. At minimum,
// work is temporary storage, and lwork specifies the usable memory length. At minimum,
// lwork >= n, and Dorgql will panic otherwise. The amount of blocking is
// limited by the usable length.
// If lwork == -1, instead of computing Dorgql the optimal work length is stored
// into work[0].
//
// Dorgql is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorgql(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) {
checkMatrix(m, n, a, lda)
if len(tau) < k {

View File

@@ -16,12 +16,14 @@ import (
// routines.
//
// The length of tau must be equal to k, and the length of work must be at least n.
// It also must be that 0 <= k <= n and 0 <= n <= m. Work is temporary storage,
// It also must be that 0 <= k <= n and 0 <= n <= m. work is temporary storage,
// and lwork specifies the usable memory length. At minimum, lwork >= n, and the
// amount of blocking is limited by the usable length. If lwork == -1, instead of
// computing Dorgqr the optimal work length is stored into work[0].
//
// Dorgqr will panic if the conditions on input values are not met.
//
// Dorgqr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorgqr(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) {
nb := impl.Ilaenv(1, "DORGQR", " ", m, n, k, -1)
// work is treated as an n×nb matrix

View File

@@ -22,6 +22,8 @@ import "github.com/gonum/blas"
// is limited by the usable length.
// If lwork == -1, instead of computing Dorgtr the optimal work length is stored
// into work[0].
//
// Dorgtr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dorgtr(uplo blas.Uplo, n int, a []float64, lda int, tau, work []float64, lwork int) {
checkMatrix(n, n, a, lda)
if len(tau) < n-1 {

View File

@@ -15,11 +15,13 @@ import "github.com/gonum/blas"
// If side == blas.Left, a is a matrix of size m×k, and if side == blas.Right
// a is of size n×k.
//
// Tau contains the Householder factors and is of length at least k and this function
// tau contains the Householder factors and is of length at least k and this function
// will panic otherwise.
//
// Work is temporary storage of length at least n if side == blas.Left
// work is temporary storage of length at least n if side == blas.Left
// and at least m if side == blas.Right and this function will panic otherwise.
//
// Dorm2r is an internal routine. It is exported for testing purposes.
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) {
if side != blas.Left && side != blas.Right {
panic(badSide)

View File

@@ -31,9 +31,11 @@ import (
//
// C is an m×n matrix. On exit it is updated by the multiplication listed above.
//
// Tau must have length min(nq,k), and Dormbr will panic otherwise. Tau contains
// tau must have length min(nq,k), and Dormbr will panic otherwise. tau contains
// the elementary reflectors to construct Q or P depending on the value of
// vect.
//
// Dormbr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dormbr(vect lapack.DecompUpdate, side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int) {
if side != blas.Left && side != blas.Right {
panic(badSide)

View File

@@ -15,11 +15,13 @@ import "github.com/gonum/blas"
// If side == blas.Left, a is a matrix of side k×m, and if side == blas.Right
// a is of size k×n.
//
// Tau contains the Householder factors and is of length at least k and this function will
// tau contains the Householder factors and is of length at least k and this function will
// panic otherwise.
//
// Work is temporary storage of length at least n if side == blas.Left
// work is temporary storage of length at least n if side == blas.Left
// and at least m if side == blas.Right and this function will panic otherwise.
//
// Dorml2 is an internal routine. It is exported for testing purposes.
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) {
if side != blas.Left && side != blas.Right {
panic(badSide)

View File

@@ -18,7 +18,7 @@ import (
// If side == blas.Left, A is a matrix of side k×m, and if side == blas.Right
// A is of size k×n. This uses a blocked algorithm.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m if side == blas.Left and lwork >= n if side == blas.Right,
// and this function will panic otherwise.
// Dormlq uses a block algorithm, but the block size is limited

View File

@@ -18,7 +18,7 @@ import (
// If side == blas.Left, A is a matrix of side k×m, and if side == blas.Right
// A is of size k×n. This uses a blocked algorithm.
//
// Work is temporary storage, and lwork specifies the usable memory length.
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= m if side == blas.Left and lwork >= n if side == blas.Right,
// and this function will panic otherwise.
// Dormqr uses a block algorithm, but the block size is limited

View File

@@ -16,6 +16,8 @@ import (
// and a = U^T U is stored in place into a. If ul == blas.Lower, then a = L L^T
// is computed and stored in-place into a. If a is not positive definite, false
// is returned. This is the unblocked version of the algorithm.
//
// Dpotf2 is an internal routine. It is exported for testing purposes.
func (Implementation) Dpotf2(ul blas.Uplo, n int, a []float64, lda int) (ok bool) {
if ul != blas.Upper && ul != blas.Lower {
panic(badUplo)

View File

@@ -12,6 +12,8 @@ import (
// Drscl multiplies the vector x by 1/a being careful to avoid overflow or
// underflow where possible.
//
// Drscl is an internal routine. It is exported for testing purposes.
func (impl Implementation) Drscl(n int, a float64, x []float64, incX int) {
checkVector(n, x, incX)
bi := blas64.Implementation()

View File

@@ -34,6 +34,8 @@ import (
//
// work must have length at least max(1, 2*n-2) if the eigenvectors are computed,
// and Dsteqr will panic otherwise.
//
// Dsteqr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dsteqr(compz lapack.EigComp, n int, d, e, z []float64, ldz int, work []float64) (ok bool) {
if len(d) < n {
panic(badD)

View File

@@ -20,6 +20,8 @@ import (
// e contains the off-diagonal elements of the tridiagonal matrix on entry, and is
// overwritten during the call to Dsterf. e must have length of at least n-1 or
// Dsterf will panic.
//
// Dsterf is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dsterf(n int, d, e []float64) (ok bool) {
if n < 0 {
panic(nLT0)

View File

@@ -23,7 +23,7 @@ import (
// orthonormal eigenvectors of A on exit, otherwise on exit the specified
// triangular region is overwritten.
//
// Work is temporary storage, and lwork specifies the usable memory length. At minimum,
// work is temporary storage, and lwork specifies the usable memory length. At minimum,
// lwork >= 3*n-1, and Dsyev will panic otherwise. The amount of blocking is
// limited by the usable length. If lwork == -1, instead of computing Dsyev the
// optimal work length is stored into work[0].

View File

@@ -46,6 +46,8 @@ import (
// [v1 e d ]
// [v1 v2 e d ]
// [v1 v2 v3 e d]
//
// Dsytd2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dsytd2(uplo blas.Uplo, n int, a []float64, lda int, d, e, tau []float64) {
checkMatrix(n, n, a, lda)
if len(d) < n {

View File

@@ -52,6 +52,8 @@ import (
// limited by the usable length.
// If lwork == -1, instead of computing Dsytrd the optimal work length is stored
// into work[0].
//
// Dsytrd is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dsytrd(uplo blas.Uplo, n int, a []float64, lda int, d, e, tau, work []float64, lwork int) {
upper := uplo == blas.Upper
opts := "U"

View File

@@ -11,6 +11,8 @@ import (
// Dtrti2 computes the inverse of a triangular matrix, storing the result in place
// into a. This is the BLAS level 2 version of the algorithm.
//
// Dtrti2 is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dtrti2(uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int) {
checkMatrix(n, n, a, lda)
if uplo != blas.Upper && uplo != blas.Lower {

View File

@@ -6,6 +6,8 @@ package native
// Iladlc scans a matrix for its last non-zero column. Returns -1 if the matrix
// is all zeros.
//
// Iladlc is an internal routine. It is exported for testing purposes.
func (Implementation) Iladlc(m, n int, a []float64, lda int) int {
if n == 0 || m == 0 {
return n - 1

View File

@@ -6,6 +6,8 @@ package native
// Iladlr scans a matrix for its last non-zero row. Returns -1 if the matrix
// is all zeros.
//
// Iladlr is an internal routine. It is exported for testing purposes.
func (Implementation) Iladlr(m, n int, a []float64, lda int) int {
if m == 0 {
return m - 1

View File

@@ -17,6 +17,8 @@ package native
// 9: Maximum size of the subproblems in divide-and-conquer algorithms.
// 10: ieee NaN arithmetic can be trusted not to trap.
// 11: infinity arithmetic can be trusted not to trap.
//
// Ilaenv is an internal routine. It is exported for testing purposes.
func (Implementation) Ilaenv(ispec int, s string, opts string, n1, n2, n3, n4 int) int {
// TODO(btracey): Replace this with a constant lookup? A list of constants?
// TODO: What is the difference between 2 and 3?