Skip to content

Commit

Permalink
Merge pull request #690 from weslleyspereira/master
Browse files Browse the repository at this point in the history
Fix the left-looking variant of geqrf following #638
  • Loading branch information
weslleyspereira authored Jul 18, 2022
2 parents 675d716 + e9c4a7a commit 79bfdd4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 20 deletions.
17 changes: 12 additions & 5 deletions SRC/VARIANTS/qr/LL/cgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
C> LWORK is INTEGER
C> \endverbatim
C> \verbatim
C> The dimension of the array WORK. The dimension can be divided into three parts.
C> The dimension of the array WORK. LWORK >= 1 if MIN(M,N) = 0,
C> otherwise the dimension can be divided into three parts.
C> \endverbatim
C> \verbatim
C> 1) The part for the triangular factor T. If the very last T is not bigger
Expand Down Expand Up @@ -212,7 +213,13 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
LLWORK = MAX (MAX((N-M)*K, (N-M)*NB), MAX(K*NB, NB*NB))
LLWORK = SCEIL(REAL(LLWORK)/REAL(NB))

IF ( NT.GT.NB ) THEN
IF( K.EQ.0 ) THEN

LBWORK = 0
LWKOPT = 1
WORK( 1 ) = LWKOPT

ELSE IF ( NT.GT.NB ) THEN

LBWORK = K-NT
*
Expand All @@ -239,8 +246,9 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
INFO = -7
ELSE IF ( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( M.GT.0 .AND. LWORK.LT.MAX( 1, N ) ) )
$ INFO = -7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CGEQRF', -INFO )
Expand All @@ -252,7 +260,6 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Quick return if possible
*
IF( K.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
*
Expand Down
17 changes: 12 additions & 5 deletions SRC/VARIANTS/qr/LL/dgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
C> LWORK is INTEGER
C> \endverbatim
C> \verbatim
C> The dimension of the array WORK. The dimension can be divided into three parts.
C> The dimension of the array WORK. LWORK >= 1 if MIN(M,N) = 0,
C> otherwise the dimension can be divided into three parts.
C> \endverbatim
C> \verbatim
C> 1) The part for the triangular factor T. If the very last T is not bigger
Expand Down Expand Up @@ -212,7 +213,13 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
LLWORK = MAX (MAX((N-M)*K, (N-M)*NB), MAX(K*NB, NB*NB))
LLWORK = SCEIL(REAL(LLWORK)/REAL(NB))

IF ( NT.GT.NB ) THEN
IF( K.EQ.0 ) THEN

LBWORK = 0
LWKOPT = 1
WORK( 1 ) = LWKOPT

ELSE IF ( NT.GT.NB ) THEN

LBWORK = K-NT
*
Expand All @@ -239,8 +246,9 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
INFO = -7
ELSE IF ( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( M.GT.0 .AND. LWORK.LT.MAX( 1, N ) ) )
$ INFO = -7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DGEQRF', -INFO )
Expand All @@ -252,7 +260,6 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Quick return if possible
*
IF( K.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
*
Expand Down
17 changes: 12 additions & 5 deletions SRC/VARIANTS/qr/LL/sgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
C> LWORK is INTEGER
C> \endverbatim
C> \verbatim
C> The dimension of the array WORK. The dimension can be divided into three parts.
C> The dimension of the array WORK. LWORK >= 1 if MIN(M,N) = 0,
C> otherwise the dimension can be divided into three parts.
C> \endverbatim
C> \verbatim
C> 1) The part for the triangular factor T. If the very last T is not bigger
Expand Down Expand Up @@ -212,7 +213,13 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
LLWORK = MAX (MAX((N-M)*K, (N-M)*NB), MAX(K*NB, NB*NB))
LLWORK = SCEIL(REAL(LLWORK)/REAL(NB))

IF ( NT.GT.NB ) THEN
IF( K.EQ.0 ) THEN

LBWORK = 0
LWKOPT = 1
WORK( 1 ) = LWKOPT

ELSE IF ( NT.GT.NB ) THEN

LBWORK = K-NT
*
Expand All @@ -239,8 +246,9 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
INFO = -7
ELSE IF ( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( M.GT.0 .AND. LWORK.LT.MAX( 1, N ) ) )
$ INFO = -7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SGEQRF', -INFO )
Expand All @@ -252,7 +260,6 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Quick return if possible
*
IF( K.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
*
Expand Down
17 changes: 12 additions & 5 deletions SRC/VARIANTS/qr/LL/zgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
C> LWORK is INTEGER
C> \endverbatim
C> \verbatim
C> The dimension of the array WORK. The dimension can be divided into three parts.
C> The dimension of the array WORK. LWORK >= 1 if MIN(M,N) = 0,
C> otherwise the dimension can be divided into three parts.
C> \endverbatim
C> \verbatim
C> 1) The part for the triangular factor T. If the very last T is not bigger
Expand Down Expand Up @@ -212,7 +213,13 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
LLWORK = MAX (MAX((N-M)*K, (N-M)*NB), MAX(K*NB, NB*NB))
LLWORK = SCEIL(REAL(LLWORK)/REAL(NB))

IF ( NT.GT.NB ) THEN
IF( K.EQ.0 ) THEN

LBWORK = 0
LWKOPT = 1
WORK( 1 ) = LWKOPT

ELSE IF ( NT.GT.NB ) THEN

LBWORK = K-NT
*
Expand All @@ -239,8 +246,9 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
INFO = -7
ELSE IF ( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( M.GT.0 .AND. LWORK.LT.MAX( 1, N ) ) )
$ INFO = -7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZGEQRF', -INFO )
Expand All @@ -252,7 +260,6 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Quick return if possible
*
IF( K.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
*
Expand Down

0 comments on commit 79bfdd4

Please sign in to comment.