lapack/gonum: fix ldwork in Dgeqrf and update its test
@@ -59,7 +59,6 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
nbmin := 2 // Minimal block size.
var nx int // Use unblocked (unless changed in the next for loop)
iws := n
- ldwork := nb
// Only consider blocked if the suggested block size is > 1 and the
// number of rows or columns is sufficiently large.
if 1 < nb && nb < k {
@@ -67,7 +66,7 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
// to unblocked.
nx = max(0, impl.Ilaenv(3, "DGEQRF", " ", m, n, -1, -1))
if k > nx {
- iws = ldwork * n
+ iws = n * nb
if lwork < iws {
// Not enough workspace to use the optimal block
// size. Get the minimum block size instead.
@@ -80,6 +79,7 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
// Compute QR using a blocked algorithm.
var i int
if nbmin <= nb && nb < k && nx < k {
+ ldwork := nb
for i = 0; i < k-nx; i += nb {
ib := min(k-i, nb)
// Compute the QR factorization of the current block.
