Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve input argument check swlq #656

Merged
merged 1 commit into from
Mar 17, 2022
Merged
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
16 changes: 10 additions & 6 deletions SRC/cgemlqt.f
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*>
*> \verbatim
*>
*> CGEMLQT overwrites the general real M-by-N matrix C with
*> CGEMLQT overwrites the general complex M-by-N matrix C with
*>
*> SIDE = 'L' SIDE = 'R'
*> TRANS = 'N': Q C C Q
*> TRANS = 'C': Q**H C C Q**H
*>
*> where Q is a complex orthogonal matrix defined as the product of K
*> where Q is a complex unitary matrix defined as the product of K
*> elementary reflectors:
*>
*> Q = H(1) H(2) . . . H(K) = I - V T V**H
Expand Down Expand Up @@ -95,7 +95,9 @@
*> \param[in] LDV
*> \verbatim
*> LDV is INTEGER
*> The leading dimension of the array V. LDV >= max(1,K).
*> The leading dimension of the array V.
*> If SIDE = 'L', M >= K >= 0;
*> if SIDE = 'R', N >= K >= 0.
*> \endverbatim
*>
*> \param[in] T
Expand Down Expand Up @@ -168,7 +170,7 @@ SUBROUTINE CGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN
INTEGER I, IB, LDWORK, KF
INTEGER I, IB, LDWORK, KF, Q
* ..
* .. External Functions ..
LOGICAL LSAME
Expand All @@ -192,8 +194,10 @@ SUBROUTINE CGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
*
IF( LEFT ) THEN
LDWORK = MAX( 1, N )
Q = M
ELSE IF ( RIGHT ) THEN
LDWORK = MAX( 1, M )
Q = N
END IF
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
INFO = -1
Expand All @@ -203,11 +207,11 @@ SUBROUTINE CGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( K.LT.0) THEN
ELSE IF( K.LT.0 .OR. K.GT.Q ) THEN
INFO = -5
ELSE IF( MB.LT.1 .OR. (MB.GT.K .AND. K.GT.0)) THEN
INFO = -6
ELSE IF( LDV.LT.MAX( 1, K ) ) THEN
ELSE IF( LDV.LT.MAX( 1, Q ) ) THEN
INFO = -8
ELSE IF( LDT.LT.MB ) THEN
INFO = -10
Expand Down
30 changes: 17 additions & 13 deletions SRC/clamswlq.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*>
*> \verbatim
*>
*> CLAMQRTS overwrites the general real M-by-N matrix C with
*> CLAMSWLQ overwrites the general complex M-by-N matrix C with
*>
*>
*> SIDE = 'L' SIDE = 'R'
*> TRANS = 'N': Q * C C * Q
*> TRANS = 'T': Q**H * C C * Q**H
*> where Q is a real orthogonal matrix defined as the product of blocked
*> where Q is a complex unitary matrix defined as the product of blocked
*> elementary reflectors computed by short wide LQ
*> factorization (CLASWLQ)
*> \endverbatim
Expand Down Expand Up @@ -70,14 +70,14 @@
*> \param[in] MB
*> \verbatim
*> MB is INTEGER
*> The row block size to be used in the blocked QR.
*> The row block size to be used in the blocked LQ.
*> M >= MB >= 1
*> \endverbatim
*>
*> \param[in] NB
*> \verbatim
*> NB is INTEGER
*> The column block size to be used in the blocked QR.
*> The column block size to be used in the blocked LQ.
*> NB > M.
*> \endverbatim
*>
Expand Down Expand Up @@ -163,8 +163,8 @@
* =====================
*>
*> \verbatim
*> Short-Wide LQ (SWLQ) performs LQ by a sequence of orthogonal transformations,
*> representing Q as a product of other orthogonal matrices
*> Short-Wide LQ (SWLQ) performs LQ by a sequence of unitary transformations,
*> representing Q as a product of other unitary matrices
*> Q = Q(1) * Q(2) * . . . * Q(k)
*> where each Q(i) zeros out upper diagonal entries of a block of NB rows of A:
*> Q(1) zeros out the upper diagonal entries of rows 1:NB of A
Expand All @@ -181,7 +181,7 @@
*> stored in columns [(i-1)*(NB-M)+M+1:i*(NB-M)+M] of A, and by upper triangular
*> block reflectors, stored in array T(1:LDT,(i-1)*M+1:i*M).
*> The last Q(k) may use fewer rows.
*> For more information see Further Details in TPQRT.
*> For more information see Further Details in TPLQT.
*>
*> For more details of the overall algorithm, see the description of
*> Sequential TSQR in Section 2.2 of [1].
Expand Down Expand Up @@ -213,7 +213,7 @@ SUBROUTINE CLAMSWLQ( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN, LQUERY
INTEGER I, II, KK, LW, CTR
INTEGER I, II, KK, LW, CTR, Q
* ..
* .. External Functions ..
LOGICAL LSAME
Expand All @@ -232,22 +232,26 @@ SUBROUTINE CLAMSWLQ( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
RIGHT = LSAME( SIDE, 'R' )
IF (LEFT) THEN
LW = N * MB
Q = M
ELSE
LW = M * MB
Q = N
END IF
*
INFO = 0
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
INFO = -1
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
INFO = -2
ELSE IF( M.LT.0 ) THEN
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( K.LT.0 ) THEN
INFO = -5
ELSE IF( LDA.LT.MAX( 1, K ) ) THEN
ELSE IF( M.LT.K ) THEN
INFO = -3
ELSE IF( N.LT.M ) THEN
INFO = -4
ELSE IF( K.LT.MB .OR. MB.LT.1) THEN
INFO = -6
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN
INFO = -9
ELSE IF( LDT.LT.MAX( 1, MB) ) THEN
INFO = -11
Expand Down
14 changes: 8 additions & 6 deletions SRC/ctpmlqt.f
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*>
*> \verbatim
*>
*> CTPMLQT applies a complex orthogonal matrix Q obtained from a
*> CTPMLQT applies a complex unitary matrix Q obtained from a
*> "triangular-pentagonal" complex block reflector H to a general
*> complex matrix C, which consists of two blocks A and B.
*> \endverbatim
Expand Down Expand Up @@ -120,8 +120,8 @@
*> \verbatim
*> LDA is INTEGER
*> The leading dimension of the array A.
*> If SIDE = 'L', LDC >= max(1,K);
*> If SIDE = 'R', LDC >= max(1,M).
*> If SIDE = 'L', LDA >= max(1,K);
*> If SIDE = 'R', LDA >= max(1,M).
*> \endverbatim
*>
*> \param[in,out] B
Expand Down Expand Up @@ -184,7 +184,7 @@
*>
*> If SIDE = 'R': C = [A B] where A is M-by-K, B is M-by-N and V is K-by-N.
*>
*> The real orthogonal matrix Q is formed from V and T.
*> The complex unitary matrix Q is formed from V and T.
*>
*> If TRANS='N' and SIDE='L', C is on exit replaced with Q * C.
*>
Expand Down Expand Up @@ -217,7 +217,7 @@ SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN
INTEGER I, IB, NB, LB, KF, LDAQ
INTEGER I, IB, NB, LB, KF, LDAQ, LDVQ
* ..
* .. External Functions ..
LOGICAL LSAME
Expand All @@ -240,8 +240,10 @@ SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
NOTRAN = LSAME( TRANS, 'N' )
*
IF ( LEFT ) THEN
LDVQ = MAX( 1, M )
LDAQ = MAX( 1, K )
ELSE IF ( RIGHT ) THEN
LDVQ = MAX( 1, N )
LDAQ = MAX( 1, M )
END IF
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
Expand All @@ -258,7 +260,7 @@ SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
INFO = -6
ELSE IF( MB.LT.1 .OR. (MB.GT.K .AND. K.GT.0) ) THEN
INFO = -7
ELSE IF( LDV.LT.K ) THEN
ELSE IF( LDV.LT.LDVQ ) THEN
INFO = -9
ELSE IF( LDT.LT.MB ) THEN
INFO = -11
Expand Down
12 changes: 8 additions & 4 deletions SRC/dgemlqt.f
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
*> \param[in] LDV
*> \verbatim
*> LDV is INTEGER
*> The leading dimension of the array V. LDV >= max(1,K).
*> The leading dimension of the array V.
*> If SIDE = 'L', LDV >= max(1,M);
*> if SIDE = 'R', LDV >= max(1,N).
*> \endverbatim
*>
*> \param[in] T
Expand Down Expand Up @@ -183,7 +185,7 @@ SUBROUTINE DGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN
INTEGER I, IB, LDWORK, KF
INTEGER I, IB, LDWORK, KF, Q
* ..
* .. External Functions ..
LOGICAL LSAME
Expand All @@ -207,8 +209,10 @@ SUBROUTINE DGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
*
IF( LEFT ) THEN
LDWORK = MAX( 1, N )
Q = M
ELSE IF ( RIGHT ) THEN
LDWORK = MAX( 1, M )
Q = N
END IF
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
INFO = -1
Expand All @@ -218,11 +222,11 @@ SUBROUTINE DGEMLQT( SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT,
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( K.LT.0) THEN
ELSE IF( K.LT.0 .OR. K.GT.Q ) THEN
INFO = -5
ELSE IF( MB.LT.1 .OR. (MB.GT.K .AND. K.GT.0)) THEN
INFO = -6
ELSE IF( LDV.LT.MAX( 1, K ) ) THEN
ELSE IF( LDV.LT.MAX( 1, Q ) ) THEN
INFO = -8
ELSE IF( LDT.LT.MB ) THEN
INFO = -10
Expand Down
24 changes: 14 additions & 10 deletions SRC/dlamswlq.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*>
*> \verbatim
*>
*> DLAMQRTS overwrites the general real M-by-N matrix C with
*> DLAMSWLQ overwrites the general real M-by-N matrix C with
*>
*>
*> SIDE = 'L' SIDE = 'R'
Expand Down Expand Up @@ -70,14 +70,14 @@
*> \param[in] MB
*> \verbatim
*> MB is INTEGER
*> The row block size to be used in the blocked QR.
*> The row block size to be used in the blocked LQ.
*> M >= MB >= 1
*> \endverbatim
*>
*> \param[in] NB
*> \verbatim
*> NB is INTEGER
*> The column block size to be used in the blocked QR.
*> The column block size to be used in the blocked LQ.
*> NB > M.
*> \endverbatim
*>
Expand Down Expand Up @@ -181,7 +181,7 @@
*> stored in columns [(i-1)*(NB-M)+M+1:i*(NB-M)+M] of A, and by upper triangular
*> block reflectors, stored in array T(1:LDT,(i-1)*M+1:i*M).
*> The last Q(k) may use fewer rows.
*> For more information see Further Details in TPQRT.
*> For more information see Further Details in TPLQT.
*>
*> For more details of the overall algorithm, see the description of
*> Sequential TSQR in Section 2.2 of [1].
Expand Down Expand Up @@ -213,7 +213,7 @@ SUBROUTINE DLAMSWLQ( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN, LQUERY
INTEGER I, II, KK, CTR, LW
INTEGER I, II, KK, CTR, LW, Q
* ..
* .. External Functions ..
LOGICAL LSAME
Expand All @@ -232,22 +232,26 @@ SUBROUTINE DLAMSWLQ( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
RIGHT = LSAME( SIDE, 'R' )
IF (LEFT) THEN
LW = N * MB
Q = M
ELSE
LW = M * MB
Q = N
END IF
*
INFO = 0
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
INFO = -1
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
INFO = -2
ELSE IF( M.LT.0 ) THEN
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( K.LT.0 ) THEN
INFO = -5
ELSE IF( LDA.LT.MAX( 1, K ) ) THEN
ELSE IF( M.LT.K ) THEN
INFO = -3
ELSE IF( N.LT.M ) THEN
INFO = -4
ELSE IF( K.LT.MB .OR. MB.LT.1) THEN
INFO = -6
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN
INFO = -9
ELSE IF( LDT.LT.MAX( 1, MB) ) THEN
INFO = -11
Expand Down
12 changes: 7 additions & 5 deletions SRC/dtpmlqt.f
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
*> \verbatim
*> LDA is INTEGER
*> The leading dimension of the array A.
*> If SIDE = 'L', LDC >= max(1,K);
*> If SIDE = 'R', LDC >= max(1,M).
*> If SIDE = 'L', LDA >= max(1,K);
*> If SIDE = 'R', LDA >= max(1,M).
*> \endverbatim
*>
*> \param[in,out] B
Expand Down Expand Up @@ -232,14 +232,14 @@ SUBROUTINE DTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
* ..
* .. Local Scalars ..
LOGICAL LEFT, RIGHT, TRAN, NOTRAN
INTEGER I, IB, NB, LB, KF, LDAQ
INTEGER I, IB, NB, LB, KF, LDAQ, LDVQ
* ..
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
* ..
* .. External Subroutines ..
EXTERNAL XERBLA, DLARFB, DTPRFB
EXTERNAL XERBLA, DTPRFB
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
Expand All @@ -255,8 +255,10 @@ SUBROUTINE DTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
NOTRAN = LSAME( TRANS, 'N' )
*
IF ( LEFT ) THEN
LDVQ = MAX( 1, M )
LDAQ = MAX( 1, K )
ELSE IF ( RIGHT ) THEN
LDVQ = MAX( 1, N )
LDAQ = MAX( 1, M )
END IF
IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
Expand All @@ -273,7 +275,7 @@ SUBROUTINE DTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
INFO = -6
ELSE IF( MB.LT.1 .OR. (MB.GT.K .AND. K.GT.0) ) THEN
INFO = -7
ELSE IF( LDV.LT.K ) THEN
ELSE IF( LDV.LT.LDVQ ) THEN
INFO = -9
ELSE IF( LDT.LT.MB ) THEN
INFO = -11
Expand Down
Loading