Skip to content

Commit

Permalink
Apply ROUNDUP_LWORK (Reference-LAPACK PR 904)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-frbg authored Nov 12, 2023
1 parent 225036f commit c9378ba
Show file tree
Hide file tree
Showing 46 changed files with 334 additions and 317 deletions.
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
11 changes: 7 additions & 4 deletions lapack-netlib/SRC/cgelq.f
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
*> the LQ factorization.
*> \endverbatim
*>
*> \ingroup gelq
*>
* =====================================================================
SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
$ INFO )
Expand All @@ -190,7 +192,8 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
* ..
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
REAL SROUNDUP_LWORK
EXTERNAL LSAME, SROUNDUP_LWORK
* ..
* .. External Subroutines ..
EXTERNAL CGELQT, CLASWLQ, XERBLA
Expand Down Expand Up @@ -292,9 +295,9 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
T( 2 ) = MB
T( 3 ) = NB
IF( MINW ) THEN
WORK( 1 ) = LWMIN
WORK( 1 ) = SROUNDUP_LWORK(LWMIN)
ELSE
WORK( 1 ) = LWREQ
WORK( 1 ) = SROUNDUP_LWORK(LWREQ)
END IF
END IF
IF( INFO.NE.0 ) THEN
Expand All @@ -319,7 +322,7 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
$ LWORK, INFO )
END IF
*
WORK( 1 ) = LWREQ
WORK( 1 ) = SROUNDUP_LWORK(LWREQ)
*
RETURN
*
Expand Down
9 changes: 5 additions & 4 deletions lapack-netlib/SRC/cgelqf.f
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup complexGEcomputational
*> \ingroup gelqf
*
*> \par Further Details:
* =====================
Expand Down Expand Up @@ -167,7 +167,8 @@ SUBROUTINE CGELQF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
REAL SROUNDUP_LWORK
EXTERNAL ILAENV, SROUNDUP_LWORK
* ..
* .. Executable Statements ..
*
Expand All @@ -176,7 +177,7 @@ SUBROUTINE CGELQF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
INFO = 0
NB = ILAENV( 1, 'CGELQF', ' ', M, N, -1, -1 )
LWKOPT = M*NB
WORK( 1 ) = LWKOPT
WORK( 1 ) = SROUNDUP_LWORK(LWKOPT)
LQUERY = ( LWORK.EQ.-1 )
IF( M.LT.0 ) THEN
INFO = -1
Expand Down Expand Up @@ -266,7 +267,7 @@ SUBROUTINE CGELQF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
$ CALL CGELQ2( M-I+1, N-I+1, A( I, I ), LDA, TAU( I ), WORK,
$ IINFO )
*
WORK( 1 ) = IWS
WORK( 1 ) = SROUNDUP_LWORK(IWS)
RETURN
*
* End of CGELQF
Expand Down
13 changes: 6 additions & 7 deletions lapack-netlib/SRC/cgelsd.f
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup complexGEsolve
*> \ingroup gelsd
*
*> \par Contributors:
* ==================
Expand Down Expand Up @@ -249,13 +249,13 @@ SUBROUTINE CGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
* .. External Subroutines ..
EXTERNAL CGEBRD, CGELQF, CGEQRF, CLACPY,
$ CLALSD, CLASCL, CLASET, CUNMBR,
$ CUNMLQ, CUNMQR, SLABAD, SLASCL,
$ CUNMLQ, CUNMQR, SLASCL,
$ SLASET, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
REAL CLANGE, SLAMCH
EXTERNAL CLANGE, SLAMCH, ILAENV
REAL CLANGE, SLAMCH, SROUNDUP_LWORK
EXTERNAL CLANGE, SLAMCH, ILAENV, SROUNDUP_LWORK
* ..
* .. Intrinsic Functions ..
INTRINSIC INT, LOG, MAX, MIN, REAL
Expand Down Expand Up @@ -367,7 +367,7 @@ SUBROUTINE CGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
END IF
END IF
MINWRK = MIN( MINWRK, MAXWRK )
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
IWORK( 1 ) = LIWORK
RWORK( 1 ) = LRWORK
*
Expand Down Expand Up @@ -396,7 +396,6 @@ SUBROUTINE CGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
SFMIN = SLAMCH( 'S' )
SMLNUM = SFMIN / EPS
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
*
* Scale A if max entry outside range [SMLNUM,BIGNUM].
*
Expand Down Expand Up @@ -647,7 +646,7 @@ SUBROUTINE CGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
END IF
*
10 CONTINUE
WORK( 1 ) = MAXWRK
WORK( 1 ) = SROUNDUP_LWORK(MAXWRK)
IWORK( 1 ) = LIWORK
RWORK( 1 ) = LRWORK
RETURN
Expand Down
Loading

0 comments on commit c9378ba

Please sign in to comment.