Skip to content

Commit

Permalink
Merge pull request #4310 from martin-frbg/lapack904
Browse files Browse the repository at this point in the history
Apply rounding up to workspace calculations done with reals (Reference-LAPACK PR 904)
  • Loading branch information
martin-frbg authored Nov 12, 2023
2 parents feeb104 + 2ce67e2 commit d58c88c
Show file tree
Hide file tree
Showing 216 changed files with 1,334 additions and 1,187 deletions.
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/VARIANTS/qr/LL/cgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
REAL SROUNDUP_LWORK
EXTERNAL ILAENV, SROUNDUP_LWORK
* ..
* .. Executable Statements ..

Expand Down Expand Up @@ -225,13 +226,13 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Optimal workspace for dlarfb = MAX(1,N)*NT
*
LWKOPT = (LBWORK+LLWORK)*NB
WORK( 1 ) = (LWKOPT+NT*NT)
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT+NT*NT)

ELSE

LBWORK = CEILING(REAL(K)/REAL(NB))*NB
LWKOPT = (LBWORK+LLWORK-NB)*NB
WORK( 1 ) = LWKOPT
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT)

END IF

Expand Down Expand Up @@ -413,7 +414,7 @@ SUBROUTINE CGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )

END IF

WORK( 1 ) = IWS
WORK( 1 ) = SROUNDUP_LWORK(IWS)
RETURN
*
* End of CGEQRF
Expand Down
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/VARIANTS/qr/LL/dgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
DOUBLE PRECISION DROUNDUP_LWORK
EXTERNAL ILAENV, DROUNDUP_LWORK
* ..
* .. Executable Statements ..

Expand Down Expand Up @@ -225,13 +226,13 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Optimal workspace for dlarfb = MAX(1,N)*NT
*
LWKOPT = (LBWORK+LLWORK)*NB
WORK( 1 ) = (LWKOPT+NT*NT)
WORK( 1 ) = DROUNDUP_LWORK(LWKOPT+NT*NT)

ELSE

LBWORK = CEILING(REAL(K)/REAL(NB))*NB
LWKOPT = (LBWORK+LLWORK-NB)*NB
WORK( 1 ) = LWKOPT
WORK( 1 ) = DROUNDUP_LWORK(LWKOPT)

END IF

Expand Down Expand Up @@ -413,7 +414,7 @@ SUBROUTINE DGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )

END IF

WORK( 1 ) = IWS
WORK( 1 ) = DROUNDUP_LWORK(IWS)
RETURN
*
* End of DGEQRF
Expand Down
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/VARIANTS/qr/LL/sgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
DOUBLE PRECISION DROUNDUP_LWORK
EXTERNAL ILAENV, DROUNDUP_LWORK
* ..
* .. Executable Statements ..

Expand Down Expand Up @@ -225,13 +226,13 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Optimal workspace for dlarfb = MAX(1,N)*NT
*
LWKOPT = (LBWORK+LLWORK)*NB
WORK( 1 ) = (LWKOPT+NT*NT)
WORK( 1 ) = DROUNDUP_LWORK(LWKOPT+NT*NT)

ELSE

LBWORK = CEILING(REAL(K)/REAL(NB))*NB
LWKOPT = (LBWORK+LLWORK-NB)*NB
WORK( 1 ) = LWKOPT
WORK( 1 ) = DROUNDUP_LWORK(LWKOPT)

END IF

Expand Down Expand Up @@ -413,7 +414,7 @@ SUBROUTINE SGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )

END IF

WORK( 1 ) = IWS
WORK( 1 ) = DROUNDUP_LWORK(IWS)
RETURN
*
* End of SGEQRF
Expand Down
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/VARIANTS/qr/LL/zgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
REAL SROUNDUP_LWORK
EXTERNAL ILAENV, SROUNDUP_LWORK
* ..
* .. Executable Statements ..

Expand Down Expand Up @@ -225,13 +226,13 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* Optimal workspace for dlarfb = MAX(1,N)*NT
*
LWKOPT = (LBWORK+LLWORK)*NB
WORK( 1 ) = (LWKOPT+NT*NT)
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT+NT*NT)

ELSE

LBWORK = CEILING(REAL(K)/REAL(NB))*NB
LWKOPT = (LBWORK+LLWORK-NB)*NB
WORK( 1 ) = LWKOPT
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT)

END IF

Expand Down Expand Up @@ -413,7 +414,7 @@ SUBROUTINE ZGEQRF ( M, N, A, LDA, TAU, WORK, LWORK, INFO )

END IF

WORK( 1 ) = IWS
WORK( 1 ) = SROUNDUP_LWORK(IWS)
RETURN
*
* End of ZGEQRF
Expand Down
13 changes: 6 additions & 7 deletions lapack-netlib/SRC/cgees.f
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup complexGEeigen
*> \ingroup gees
*
* =====================================================================
SUBROUTINE CGEES( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
Expand Down Expand Up @@ -230,13 +230,13 @@ SUBROUTINE CGEES( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
* ..
* .. External Subroutines ..
EXTERNAL CCOPY, CGEBAK, CGEBAL, CGEHRD, CHSEQR, CLACPY,
$ CLASCL, CTRSEN, CUNGHR, SLABAD, XERBLA
$ CLASCL, CTRSEN, CUNGHR, XERBLA
* ..
* .. External Functions ..
LOGICAL LSAME
INTEGER ILAENV
REAL CLANGE, SLAMCH
EXTERNAL LSAME, ILAENV, CLANGE, SLAMCH
REAL CLANGE, SLAMCH, SROUNDUP_LWORK
EXTERNAL LSAME, ILAENV, CLANGE, SLAMCH, SROUNDUP_LWORK
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, SQRT
Expand Down Expand Up @@ -292,7 +292,7 @@ SUBROUTINE CGEES( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
MAXWRK = MAX( MAXWRK, HSWORK )
END IF
END IF
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
*
IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
INFO = -12
Expand All @@ -318,7 +318,6 @@ SUBROUTINE CGEES( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
EPS = SLAMCH( 'P' )
SMLNUM = SLAMCH( 'S' )
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
SMLNUM = SQRT( SMLNUM ) / EPS
BIGNUM = ONE / SMLNUM
*
Expand Down Expand Up @@ -413,7 +412,7 @@ SUBROUTINE CGEES( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
CALL CCOPY( N, A, LDA+1, W, 1 )
END IF
*
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
RETURN
*
* End of CGEES
Expand Down
13 changes: 6 additions & 7 deletions lapack-netlib/SRC/cgeesx.f
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup complexGEeigen
*> \ingroup geesx
*
* =====================================================================
SUBROUTINE CGEESX( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
Expand Down Expand Up @@ -274,13 +274,13 @@ SUBROUTINE CGEESX( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
* ..
* .. External Subroutines ..
EXTERNAL CCOPY, CGEBAK, CGEBAL, CGEHRD, CHSEQR, CLACPY,
$ CLASCL, CTRSEN, CUNGHR, SLABAD, SLASCL, XERBLA
$ CLASCL, CTRSEN, CUNGHR, SLASCL, XERBLA
* ..
* .. External Functions ..
LOGICAL LSAME
INTEGER ILAENV
REAL CLANGE, SLAMCH
EXTERNAL LSAME, ILAENV, CLANGE, SLAMCH
REAL CLANGE, SLAMCH, SROUNDUP_LWORK
EXTERNAL LSAME, ILAENV, CLANGE, SLAMCH, SROUNDUP_LWORK
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, SQRT
Expand Down Expand Up @@ -350,7 +350,7 @@ SUBROUTINE CGEESX( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
IF( .NOT.WANTSN )
$ LWRK = MAX( LWRK, ( N*N )/2 )
END IF
WORK( 1 ) = LWRK
WORK( 1 ) = SROUNDUP_LWORK(LWRK)
*
IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
INFO = -15
Expand All @@ -376,7 +376,6 @@ SUBROUTINE CGEESX( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
EPS = SLAMCH( 'P' )
SMLNUM = SLAMCH( 'S' )
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
SMLNUM = SQRT( SMLNUM ) / EPS
BIGNUM = ONE / SMLNUM
*
Expand Down Expand Up @@ -488,7 +487,7 @@ SUBROUTINE CGEESX( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
END IF
END IF
*
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
RETURN
*
* End of CGEESX
Expand Down
14 changes: 7 additions & 7 deletions lapack-netlib/SRC/cgeev.f
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
*
* @generated from zgeev.f, fortran z -> c, Tue Apr 19 01:47:44 2016
*
*> \ingroup complexGEeigen
*> \ingroup geev
*
* =====================================================================
SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
Expand Down Expand Up @@ -212,14 +212,15 @@ SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
REAL DUM( 1 )
* ..
* .. External Subroutines ..
EXTERNAL SLABAD, XERBLA, CSSCAL, CGEBAK, CGEBAL, CGEHRD,
EXTERNAL XERBLA, CSSCAL, CGEBAK, CGEBAL, CGEHRD,
$ CHSEQR, CLACPY, CLASCL, CSCAL, CTREVC3, CUNGHR
* ..
* .. External Functions ..
LOGICAL LSAME
INTEGER ISAMAX, ILAENV
REAL SLAMCH, SCNRM2, CLANGE
EXTERNAL LSAME, ISAMAX, ILAENV, SLAMCH, SCNRM2, CLANGE
REAL SLAMCH, SCNRM2, CLANGE, SROUNDUP_LWORK
EXTERNAL LSAME, ISAMAX, ILAENV, SLAMCH, SCNRM2, CLANGE,
$ SROUNDUP_LWORK
* ..
* .. Intrinsic Functions ..
INTRINSIC REAL, CMPLX, CONJG, AIMAG, MAX, SQRT
Expand Down Expand Up @@ -291,7 +292,7 @@ SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
HSWORK = INT( WORK(1) )
MAXWRK = MAX( MAXWRK, HSWORK, MINWRK )
END IF
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
*
IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
INFO = -12
Expand All @@ -315,7 +316,6 @@ SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
EPS = SLAMCH( 'P' )
SMLNUM = SLAMCH( 'S' )
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
SMLNUM = SQRT( SMLNUM ) / EPS
BIGNUM = ONE / SMLNUM
*
Expand Down Expand Up @@ -493,7 +493,7 @@ SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
END IF
END IF
*
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
RETURN
*
* End of CGEEV
Expand Down
14 changes: 7 additions & 7 deletions lapack-netlib/SRC/cgeevx.f
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
*
* @generated from zgeevx.f, fortran z -> c, Tue Apr 19 01:47:44 2016
*
*> \ingroup complexGEeigen
*> \ingroup geevx
*
* =====================================================================
SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
Expand Down Expand Up @@ -323,15 +323,16 @@ SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
REAL DUM( 1 )
* ..
* .. External Subroutines ..
EXTERNAL SLABAD, SLASCL, XERBLA, CSSCAL, CGEBAK, CGEBAL,
EXTERNAL SLASCL, XERBLA, CSSCAL, CGEBAK, CGEBAL,
$ CGEHRD, CHSEQR, CLACPY, CLASCL, CSCAL, CTREVC3,
$ CTRSNA, CUNGHR
* ..
* .. External Functions ..
LOGICAL LSAME
INTEGER ISAMAX, ILAENV
REAL SLAMCH, SCNRM2, CLANGE
EXTERNAL LSAME, ISAMAX, ILAENV, SLAMCH, SCNRM2, CLANGE
REAL SLAMCH, SCNRM2, CLANGE, SROUNDUP_LWORK
EXTERNAL LSAME, ISAMAX, ILAENV, SLAMCH, SCNRM2, CLANGE,
$ SROUNDUP_LWORK
* ..
* .. Intrinsic Functions ..
INTRINSIC REAL, CMPLX, CONJG, AIMAG, MAX, SQRT
Expand Down Expand Up @@ -434,7 +435,7 @@ SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
END IF
MAXWRK = MAX( MAXWRK, MINWRK )
END IF
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
*
IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
INFO = -20
Expand All @@ -458,7 +459,6 @@ SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
EPS = SLAMCH( 'P' )
SMLNUM = SLAMCH( 'S' )
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
SMLNUM = SQRT( SMLNUM ) / EPS
BIGNUM = ONE / SMLNUM
*
Expand Down Expand Up @@ -657,7 +657,7 @@ SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
END IF
END IF
*
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
RETURN
*
* End of CGEEVX
Expand Down
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/cgehrd.f
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup complexGEcomputational
*> \ingroup gehrd
*
*> \par Further Details:
* =====================
Expand Down Expand Up @@ -201,7 +201,8 @@ SUBROUTINE CGEHRD( N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
REAL SROUNDUP_LWORK
EXTERNAL ILAENV, SROUNDUP_LWORK
* ..
* .. Executable Statements ..
*
Expand All @@ -227,7 +228,7 @@ SUBROUTINE CGEHRD( N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO )
*
NB = MIN( NBMAX, ILAENV( 1, 'CGEHRD', ' ', N, ILO, IHI, -1 ) )
LWKOPT = N*NB + TSIZE
WORK( 1 ) = LWKOPT
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT)
END IF
*
IF( INFO.NE.0 ) THEN
Expand Down Expand Up @@ -344,7 +345,7 @@ SUBROUTINE CGEHRD( N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO )
* Use unblocked code to reduce the rest of the matrix
*
CALL CGEHD2( N, I, IHI, A, LDA, TAU, WORK, IINFO )
WORK( 1 ) = LWKOPT
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT)
*
RETURN
*
Expand Down
Loading

0 comments on commit d58c88c

Please sign in to comment.