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

Commit

Permalink
native: small cleanup in Dgeqrf
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Jun 1, 2016
1 parent 0179e09 commit 17f9778
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions native/dgeqrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,21 @@ func (impl Implementation) Dgeqrf(m, n int, a []float64, lda int, tau, work []fl
if k == 0 {
return
}
nbmin := 2 // Minimal number of blocks
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 number of blocks is > 1 and the
// number of columns is sufficiently large.
if nb > 1 && k > nb {
// nx is the crossover point. Above this value the blocked routine should be used.
// 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 {
// nx is the block size at which the code switches from blocked
// to unblocked.
nx = max(0, impl.Ilaenv(3, "DGEQRF", " ", m, n, -1, -1))
if k > nx {
iws = ldwork * n
if lwork < iws {
// Not enough workspace to use the optimal number of blocks. Instead,
// get the maximum allowable number of blocks.
// Not enough workspace to use the optimal block
// size. Get the minimum block size instead.
nb = lwork / n
nbmin = max(2, impl.Ilaenv(2, "DGEQRF", " ", m, n, -1, -1))
}
Expand All @@ -67,7 +68,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 nb >= nbmin && nb < k && nx < k {
if nbmin <= nb && nb < k && nx < k {
for i = 0; i < k-nx; i += nb {
ib := min(k-i, nb)
// Compute the QR factorization of the current block.
Expand Down

0 comments on commit 17f9778

Please sign in to comment.