Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit dd64d67

Browse files
committed
native: small cleanup in Dgeqrf
1 parent 0dbd99d commit dd64d67

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

native/dgeqrf.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,21 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
4343
if k == 0 {
4444
return
4545
}
46-
nbmin := 2 // Minimal number of blocks
46+
nbmin := 2 // Minimal block size.
4747
var nx int // Use unblocked (unless changed in the next for loop)
4848
iws := n
4949
ldwork := nb
50-
// Only consider blocked if the suggested number of blocks is > 1 and the
51-
// number of columns is sufficiently large.
52-
if nb > 1 && k > nb {
53-
// nx is the crossover point. Above this value the blocked routine should be used.
50+
// Only consider blocked if the suggested block size is > 1 and the
51+
// number of rows or columns is sufficiently large.
52+
if 1 < nb && nb < k {
53+
// nx is the block size at which the code switches from blocked
54+
// to unblocked.
5455
nx = max(0, impl.Ilaenv(3, "DGEQRF", " ", m, n, -1, -1))
5556
if k > nx {
5657
iws = ldwork * n
5758
if lwork < iws {
58-
// Not enough workspace to use the optimal number of blocks. Instead,
59-
// get the maximum allowable number of blocks.
59+
// Not enough workspace to use the optimal block
60+
// size. Get the minimum block size instead.
6061
nb = lwork / n
6162
nbmin = max(2, impl.Ilaenv(2, "DGEQRF", " ", m, n, -1, -1))
6263
}
@@ -67,7 +68,7 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
6768
}
6869
// Compute QR using a blocked algorithm.
6970
var i int
70-
if nb >= nbmin && nb < k && nx < k {
71+
if nbmin <= nb && nb < k && nx < k {
7172
for i = 0; i < k-nx; i += nb {
7273
ib := min(k-i, nb)
7374
// Compute the QR factorization of the current block.

0 commit comments

Comments
 (0)