native: address review comments

This commit is contained in:
kortschak
2017-01-27 07:03:23 +10:30
parent 85af0b1105
commit e8ffdb2170

View File

@@ -14,20 +14,21 @@ import (
// parameters at entry and exit.
//
// work is temporary storage, and lwork specifies the usable memory length.
// At minimum, lwork >= max(1, m) and this function will panic otherwise.
// The length of work must be at least max(1, lwork) and lwork must be -1
// or at least n, otherwise this function will panic.
// Dgeqrf is a blocked QR factorization, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgeqrf,
// 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.
func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []float64, lwork int) {
if len(work) < max(1, lwork) {
panic(shortWork)
}
// nb is the optimal blocksize, i.e. the number of columns transformed at a time.
nb := impl.Ilaenv(1, "DGEQRF", " ", m, n, -1, -1)
lworkopt := n * max(nb, 1)
lworkopt = max(n, lworkopt)
if len(work) < max(1, lwork) {
panic(shortWork)
}
if lwork == -1 {
work[0] = float64(lworkopt)
return