Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions lapack-netlib/SRC/cgelq.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,17 +506,10 @@ static integer c__2 = 2;

/* Determine if the workspace size satisfies minimal size */

if (*n <= *m || nb <= *m || nb >= *n) {
lwmin = f2cmax(1,*n);
/* Computing MAX */
i__1 = 1, i__2 = mb * *n;
lwopt = f2cmax(i__1,i__2);
} else {
lwmin = f2cmax(1,*m);
lwmin = f2cmax(1,*m);
/* Computing MAX */
i__1 = 1, i__2 = mb * *m;
lwopt = f2cmax(i__1,i__2);
}
i__1 = 1, i__2 = mb * *m;
lwopt = f2cmax(i__1,i__2);
lminws = FALSE_;
/* Computing MAX */
i__1 = 1, i__2 = mb * *m * nblcks + 5;
Expand All @@ -534,15 +527,9 @@ static integer c__2 = 2;
mb = 1;
}
}
if (*n <= *m || nb <= *m || nb >= *n) {
/* Computing MAX */
i__1 = 1, i__2 = mb * *n;
lwreq = f2cmax(i__1,i__2);
} else {
/* Computing MAX */
i__1 = 1, i__2 = mb * *m;
lwreq = f2cmax(i__1,i__2);
}
i__1 = 1, i__2 = mb * *m;
lwreq = f2cmax(i__1,i__2);

if (*m < 0) {
*info = -1;
Expand Down
33 changes: 14 additions & 19 deletions lapack-netlib/SRC/cgelq.f
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= 1.
*> The dimension of the array WORK.
*> LWORK >= MAX(1,M), and LWORK >= MAX(1,MB*M) for the blocked
*> code, where MB is the row block size (see Further Details).
*> If LWORK = -1 or -2, then a workspace query is assumed. The routine
*> only calculates the sizes of the T and WORK arrays, returns these
*> values as the first entries of the T and WORK arrays, and no error
Expand Down Expand Up @@ -171,6 +173,7 @@
* =====================================================================
SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
$ INFO )
IMPLICIT NONE
*
* -- LAPACK computational routine --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
Expand All @@ -191,9 +194,8 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
INTEGER MB, NB, MINTSZ, NBLCKS, LWMIN, LWOPT, LWREQ
* ..
* .. External Functions ..
LOGICAL LSAME
REAL SROUNDUP_LWORK
EXTERNAL LSAME, SROUNDUP_LWORK
EXTERNAL SROUNDUP_LWORK
* ..
* .. External Subroutines ..
EXTERNAL CGELQT, CLASWLQ, XERBLA
Expand Down Expand Up @@ -245,13 +247,10 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
*
* Determine if the workspace size satisfies minimal size
*
IF( ( N.LE.M ) .OR. ( NB.LE.M ) .OR. ( NB.GE.N ) ) THEN
LWMIN = MAX( 1, N )
LWOPT = MAX( 1, MB*N )
ELSE
LWMIN = MAX( 1, M )
LWOPT = MAX( 1, MB*M )
END IF
* CGELQT and CLASWLQ both use MB*M entries of WORK.
*
LWMIN = MAX( 1, M )
LWOPT = MAX( 1, MB*M )
LMINWS = .FALSE.
IF( ( TSIZE.LT.MAX( 1, MB*M*NBLCKS + 5 ) .OR. LWORK.LT.LWOPT )
$ .AND. ( LWORK.GE.LWMIN ) .AND. ( TSIZE.GE.MINTSZ )
Expand All @@ -266,11 +265,7 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
MB = 1
END IF
END IF
IF( ( N.LE.M ) .OR. ( NB.LE.M ) .OR. ( NB.GE.N ) ) THEN
LWREQ = MAX( 1, MB*N )
ELSE
LWREQ = MAX( 1, MB*M )
END IF
LWREQ = MAX( 1, MB*M )
*
IF( M.LT.0 ) THEN
INFO = -1
Expand All @@ -288,12 +283,12 @@ SUBROUTINE CGELQ( M, N, A, LDA, T, TSIZE, WORK, LWORK,
*
IF( INFO.EQ.0 ) THEN
IF( MINT ) THEN
T( 1 ) = MINTSZ
T( 1 ) = CMPLX( MINTSZ )
ELSE
T( 1 ) = MB*M*NBLCKS + 5
T( 1 ) = CMPLX( MB*M*NBLCKS + 5 )
END IF
T( 2 ) = MB
T( 3 ) = NB
T( 2 ) = CMPLX( MB )
T( 3 ) = CMPLX( NB )
IF( MINW ) THEN
WORK( 1 ) = SROUNDUP_LWORK( LWMIN )
ELSE
Expand Down
7 changes: 6 additions & 1 deletion lapack-netlib/SRC/cgemlq.f
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= 1.
*> The dimension of the array WORK.
*> If MIN(M,N,K) = 0, LWORK >= 1.
*> If SIDE = 'L', LWORK >= MAX(1,N*MB).
*> If SIDE = 'R', LWORK >= MAX(1,M*MB).
*> MB = INT(T(2)) is the block size stored in T by CGELQ.
*> If LWORK = -1, then a workspace query is assumed. The routine
*> only calculates the size of the WORK array, returns this
*> value as WORK(1), and no error message related to WORK
Expand Down Expand Up @@ -170,6 +174,7 @@
* =====================================================================
SUBROUTINE CGEMLQ( SIDE, TRANS, M, N, K, A, LDA, T, TSIZE,
$ C, LDC, WORK, LWORK, INFO )
IMPLICIT NONE
*
* -- LAPACK computational routine --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
Expand Down
6 changes: 3 additions & 3 deletions lapack-netlib/SRC/cgemqr.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ typedef struct Namelist Namelist;
);
extern logical lsame_(char *, char *);
logical right;
integer mb, nb, mn, lw, nblcks;
integer mb, nb, mn, lw, nblcks, lwmin;
extern /* Subroutine */ void xerbla_(char *, integer *, ftnlen);
logical notran, lquery;
extern /* Subroutine */ void cgemqrt_(char *, char *, integer *, integer *,
Expand Down Expand Up @@ -472,7 +472,7 @@ typedef struct Namelist Namelist;
lw = *n * nb;
mn = *m;
} else {
lw = mb * nb;
lw = *m * nb;
mn = *n;
}

Expand Down Expand Up @@ -503,7 +503,7 @@ typedef struct Namelist Namelist;
*info = -9;
} else if (*ldc < f2cmax(1,*m)) {
*info = -11;
} else if (*lwork < f2cmax(1,lw) && ! lquery) {
} else if (*lwork < lwmin && ! lquery) {
*info = -13;
}

Expand Down
11 changes: 8 additions & 3 deletions lapack-netlib/SRC/cgemqr.f
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= 1.
*> The dimension of the array WORK.
*> If MIN(M,N,K) = 0, LWORK >= 1.
*> If SIDE = 'L', LWORK >= MAX(1,N*NB).
*> If SIDE = 'R', LWORK >= MAX(1,M*NB).
*> NB = INT(T(3)) is the block size stored in T by CGEQR.
*> If LWORK = -1, then a workspace query is assumed. The routine
*> only calculates the size of the WORK array, returns this
*> value as WORK(1), and no error message related to WORK
Expand Down Expand Up @@ -172,6 +176,7 @@
* =====================================================================
SUBROUTINE CGEMQR( SIDE, TRANS, M, N, K, A, LDA, T, TSIZE,
$ C, LDC, WORK, LWORK, INFO )
IMPLICIT NONE
*
* -- LAPACK computational routine --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
Expand Down Expand Up @@ -219,7 +224,7 @@ SUBROUTINE CGEMQR( SIDE, TRANS, M, N, K, A, LDA, T, TSIZE,
LW = N * NB
MN = M
ELSE
LW = MB * NB
LW = M * NB
MN = N
END IF
*
Expand Down Expand Up @@ -257,7 +262,7 @@ SUBROUTINE CGEMQR( SIDE, TRANS, M, N, K, A, LDA, T, TSIZE,
INFO = -9
ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
INFO = -11
ELSE IF( ( LWORK.LT.MAX( 1, LW ) ) .AND. ( .NOT.LQUERY ) ) THEN
ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -13
END IF
*
Expand Down
25 changes: 22 additions & 3 deletions lapack-netlib/SRC/cggsvd3.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ static integer c__1 = 1;
integer *, complex *, integer *, complex *, integer *, complex *,
integer *, integer *);
extern void xerbla_(char *, integer *, ftnlen);
integer lwkopt;
integer lwkopt, lwmin;
logical lquery;
extern /* Subroutine */ void cggsvp3_(char *, char *, char *, integer *,
integer *, integer *, complex *, integer *, complex *, integer *,
Expand Down Expand Up @@ -666,6 +666,25 @@ static integer c__1 = 1;
lquery = *lwork == -1;
lwkopt = 1;

/* WORK(1:N) holds the TAU of CGGSVP3, which gets WORK(N+1:LWORK) */
/* as its workspace, and CTGSJA uses WORK(1:2*N). */

if (*n > 0 && f2cmax(*m,*p) > 0) {
if (wantv) {
/* Computing MAX */
i__1 = f2cmax(*m,*p), i__2 = *n + 1;
lwmin = *n + f2cmax(i__1,i__2);
} else {
/* Computing MAX */
i__1 = *m, i__2 = *n + 1;
lwmin = *n + f2cmax(i__1,i__2);
}
} else {
/* Computing MAX */
i__1 = 1, i__2 = *n << 1;
lwmin = f2cmax(i__1,i__2);
}

/* Test the input arguments */

*info = 0;
Expand All @@ -691,7 +710,7 @@ static integer c__1 = 1;
*info = -18;
} else if (*ldq < 1 || (wantq && *ldq < *n)) {
*info = -20;
} else if (*lwork < 1 && ! lquery) {
} else if (*lwork < lwmin && ! lquery) {
*info = -24;
}

Expand All @@ -706,7 +725,7 @@ static integer c__1 = 1;
/* Computing MAX */
i__1 = *n << 1;
lwkopt = f2cmax(i__1,lwkopt);
lwkopt = f2cmax(1,lwkopt);
lwkopt = f2cmax(lwmin,lwkopt);
q__1.r = (real) lwkopt, q__1.i = 0.f;
work[1].r = q__1.r, work[1].i = q__1.i;
}
Expand Down
24 changes: 20 additions & 4 deletions lapack-netlib/SRC/cggsvd3.f
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= 1.
*> The dimension of the array WORK.
*> If N > 0 and MAX(M,P) > 0, LWORK >= N+MAX(M,P,N+1) if
*> JOBV = 'V', and LWORK >= N+MAX(M,N+1) otherwise.
*> LWORK >= MAX(1,2*N) if N = 0 or MAX(M,P) = 0.
*>
*> If LWORK = -1, then a workspace query is assumed; the routine
*> only calculates the optimal size of the WORK array, returns
Expand Down Expand Up @@ -371,7 +374,7 @@ SUBROUTINE CGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,
*
* .. Local Scalars ..
LOGICAL WANTQ, WANTU, WANTV, LQUERY
INTEGER I, IBND, ISUB, J, NCYCLE, LWKOPT
INTEGER I, IBND, ISUB, J, NCYCLE, LWKOPT, LWMIN
REAL ANORM, BNORM, SMAX, TEMP, TOLA, TOLB, ULP, UNFL
* ..
* .. External Functions ..
Expand All @@ -395,6 +398,19 @@ SUBROUTINE CGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,
LQUERY = ( LWORK.EQ.-1 )
LWKOPT = 1
*
* WORK(1:N) holds the TAU of CGGSVP3, which gets WORK(N+1:LWORK)
* as its workspace, and CTGSJA uses WORK(1:2*N).
*
IF( N.GT.0 .AND. MAX( M, P ).GT.0 ) THEN
IF( WANTV ) THEN
LWMIN = N + MAX( M, P, N+1 )
ELSE
LWMIN = N + MAX( M, N+1 )
END IF
ELSE
LWMIN = MAX( 1, 2*N )
END IF
*
* Test the input arguments
*
INFO = 0
Expand All @@ -420,7 +436,7 @@ SUBROUTINE CGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,
INFO = -18
ELSE IF( LDQ.LT.1 .OR. ( WANTQ .AND. LDQ.LT.N ) ) THEN
INFO = -20
ELSE IF( LWORK.LT.1 .AND. .NOT.LQUERY ) THEN
ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -22
END IF
*
Expand All @@ -433,7 +449,7 @@ SUBROUTINE CGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,
$ WORK, WORK, -1, INFO )
LWKOPT = N + INT( WORK( 1 ) )
LWKOPT = MAX( 2*N, LWKOPT )
LWKOPT = MAX( 1, LWKOPT )
LWKOPT = MAX( LWMIN, LWKOPT )
WORK( 1 ) = CMPLX( LWKOPT )
END IF
*
Expand Down
24 changes: 21 additions & 3 deletions lapack-netlib/SRC/cggsvp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ static integer c_n1 = -1;
extern void clapmt_(logical *, integer *, integer
*, complex *, integer *, integer *);
logical forwrd;
integer lwkopt;
integer lwkopt, lwmin;
logical lquery;


Expand Down Expand Up @@ -594,6 +594,24 @@ static integer c_n1 = -1;
lquery = *lwork == -1;
lwkopt = 1;

/* CGEQP3 needs N+1, the unblocked QR, RQ and */
/* unitary-transformation routines need M or N, and */
/* CUNG2R needs P to form V. */

if (*n > 0 && f2cmax(*m,*p) > 0) {
if (wantv) {
/* Computing MAX */
i__1 = f2cmax(*m,*p), i__2 = *n + 1;
lwmin = f2cmax(i__1,i__2);
} else {
/* Computing MAX */
i__1 = *m, i__2 = *n + 1;
lwmin = f2cmax(i__1,i__2);
}
} else {
lwmin = 1;
}

/* Test the input arguments */

*info = 0;
Expand All @@ -619,7 +637,7 @@ static integer c_n1 = -1;
*info = -18;
} else if (*ldq < 1 || (wantq && *ldq < *n)) {
*info = -20;
} else if (*lwork < 1 && ! lquery) {
} else if (*lwork < lwmin && ! lquery) {
*info = -24;
}

Expand All @@ -644,7 +662,7 @@ static integer c_n1 = -1;
/* Computing MAX */
i__1 = lwkopt, i__2 = (integer) work[1].r;
lwkopt = f2cmax(i__1,i__2);
lwkopt = f2cmax(1,lwkopt);
lwkopt = f2cmax(lwmin,lwkopt);
q__1.r = (real) lwkopt, q__1.i = 0.f;
work[1].r = q__1.r, work[1].i = q__1.i;
}
Expand Down
Loading
Loading