Skip to content

Commit 11d3fa9

Browse files
committed
Fix mixed up column count of rhs (n) and original matrix (k)
* add input parameter tests * revert check of n when it denotes the column of the matrix to be updated and correct the docs * relax constraint on mb and update docs - special cases outside of the docs are handled by a call to GEQRT
1 parent 2f132ee commit 11d3fa9

File tree

12 files changed

+159
-47
lines changed

12 files changed

+159
-47
lines changed

SRC/clamtsqr.f

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*> SIDE = 'L' SIDE = 'R'
2626
*> TRANS = 'N': Q * C C * Q
2727
*> TRANS = 'C': Q**H * C C * Q**H
28-
*> where Q is a real orthogonal matrix defined as the product
28+
*> where Q is a complex unitary matrix defined as the product
2929
*> of blocked elementary reflectors computed by tall skinny
3030
*> QR factorization (CLATSQR)
3131
*> \endverbatim
@@ -56,15 +56,14 @@
5656
*> \param[in] N
5757
*> \verbatim
5858
*> N is INTEGER
59-
*> The number of columns of the matrix C. M >= N >= 0.
59+
*> The number of columns of the matrix C. N >= 0.
6060
*> \endverbatim
6161
*>
6262
*> \param[in] K
6363
*> \verbatim
6464
*> K is INTEGER
6565
*> The number of elementary reflectors whose product defines
66-
*> the matrix Q.
67-
*> N >= K >= 0;
66+
*> the matrix Q. M >= K >= 0;
6867
*>
6968
*> \endverbatim
7069
*>
@@ -164,8 +163,8 @@
164163
* =====================
165164
*>
166165
*> \verbatim
167-
*> Tall-Skinny QR (TSQR) performs QR by a sequence of orthogonal transformations,
168-
*> representing Q as a product of other orthogonal matrices
166+
*> Tall-Skinny QR (TSQR) performs QR by a sequence of unitary transformations,
167+
*> representing Q as a product of other unitary matrices
169168
*> Q = Q(1) * Q(2) * . . . * Q(k)
170169
*> where each Q(i) zeros out subdiagonal entries of a block of MB rows of A:
171170
*> Q(1) zeros out the subdiagonal entries of rows 1:MB of A
@@ -244,12 +243,12 @@ SUBROUTINE CLAMTSQR( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
244243
INFO = -1
245244
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
246245
INFO = -2
246+
ELSE IF( M.LT.K ) THEN
247+
INFO = -3
248+
ELSE IF( N.LT.0 ) THEN
249+
INFO = -4
247250
ELSE IF( K.LT.0 ) THEN
248251
INFO = -5
249-
ELSE IF( N.LT.K ) THEN
250-
INFO = -4
251-
ELSE IF( M.LT.N ) THEN
252-
INFO = -3
253252
ELSE IF( K.LT.NB .OR. NB.LT.1 ) THEN
254253
INFO = -7
255254
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN

SRC/clatsqr.f

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ SUBROUTINE CLATSQR( M, N, MB, NB, A, LDA, T, LDT, WORK,
202202
INFO = -1
203203
ELSE IF( N.LT.0 .OR. M.LT.N ) THEN
204204
INFO = -2
205-
ELSE IF( MB.LE.N ) THEN
205+
ELSE IF( MB.LT.1 ) THEN
206206
INFO = -3
207207
ELSE IF( NB.LT.1 .OR. ( NB.GT.N .AND. N.GT.0 )) THEN
208208
INFO = -4
209209
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
210-
INFO = -5
210+
INFO = -6
211211
ELSE IF( LDT.LT.NB ) THEN
212212
INFO = -8
213213
ELSE IF( LWORK.LT.(N*NB) .AND. (.NOT.LQUERY) ) THEN

SRC/dlamtsqr.f

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@
5656
*> \param[in] N
5757
*> \verbatim
5858
*> N is INTEGER
59-
*> The number of columns of the matrix C. M >= N >= 0.
59+
*> The number of columns of the matrix C. N >= 0.
6060
*> \endverbatim
6161
*>
6262
*> \param[in] K
6363
*> \verbatim
6464
*> K is INTEGER
6565
*> The number of elementary reflectors whose product defines
66-
*> the matrix Q.
67-
*> N >= K >= 0;
66+
*> the matrix Q. M >= K >= 0;
6867
*>
6968
*> \endverbatim
7069
*>
@@ -244,12 +243,12 @@ SUBROUTINE DLAMTSQR( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
244243
INFO = -1
245244
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
246245
INFO = -2
246+
ELSE IF( M.LT.K ) THEN
247+
INFO = -3
248+
ELSE IF( N.LT.0 ) THEN
249+
INFO = -4
247250
ELSE IF( K.LT.0 ) THEN
248251
INFO = -5
249-
ELSE IF( N.LT.K ) THEN
250-
INFO = -4
251-
ELSE IF( M.LT.N ) THEN
252-
INFO = -3
253252
ELSE IF( K.LT.NB .OR. NB.LT.1 ) THEN
254253
INFO = -7
255254
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN

SRC/dlatsqr.f

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
*> \verbatim
5858
*> MB is INTEGER
5959
*> The row block size to be used in the blocked QR.
60-
*> MB > N.
60+
*> MB > 0.
6161
*> \endverbatim
6262
*>
6363
*> \param[in] NB
@@ -202,12 +202,12 @@ SUBROUTINE DLATSQR( M, N, MB, NB, A, LDA, T, LDT, WORK,
202202
INFO = -1
203203
ELSE IF( N.LT.0 .OR. M.LT.N ) THEN
204204
INFO = -2
205-
ELSE IF( MB.LE.N ) THEN
205+
ELSE IF( MB.LT.1 ) THEN
206206
INFO = -3
207207
ELSE IF( NB.LT.1 .OR. ( NB.GT.N .AND. N.GT.0 )) THEN
208208
INFO = -4
209209
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
210-
INFO = -5
210+
INFO = -6
211211
ELSE IF( LDT.LT.NB ) THEN
212212
INFO = -8
213213
ELSE IF( LWORK.LT.(N*NB) .AND. (.NOT.LQUERY) ) THEN

SRC/slamtsqr.f

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@
5656
*> \param[in] N
5757
*> \verbatim
5858
*> N is INTEGER
59-
*> The number of columns of the matrix C. M >= N >= 0.
59+
*> The number of columns of the matrix C. N >= 0.
6060
*> \endverbatim
6161
*>
6262
*> \param[in] K
6363
*> \verbatim
6464
*> K is INTEGER
6565
*> The number of elementary reflectors whose product defines
66-
*> the matrix Q.
67-
*> N >= K >= 0;
66+
*> the matrix Q. M >= K >= 0;
6867
*>
6968
*> \endverbatim
7069
*>
@@ -244,12 +243,12 @@ SUBROUTINE SLAMTSQR( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
244243
INFO = -1
245244
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
246245
INFO = -2
246+
ELSE IF( M.LT.K ) THEN
247+
INFO = -3
248+
ELSE IF( N.LT.0 ) THEN
249+
INFO = -4
247250
ELSE IF( K.LT.0 ) THEN
248251
INFO = -5
249-
ELSE IF( N.LT.K ) THEN
250-
INFO = -4
251-
ELSE IF( M.LT.N ) THEN
252-
INFO = -3
253252
ELSE IF( K.LT.NB .OR. NB.LT.1 ) THEN
254253
INFO = -7
255254
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN

SRC/slatsqr.f

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ SUBROUTINE SLATSQR( M, N, MB, NB, A, LDA, T, LDT, WORK,
202202
INFO = -1
203203
ELSE IF( N.LT.0 .OR. M.LT.N ) THEN
204204
INFO = -2
205-
ELSE IF( MB.LE.N ) THEN
205+
ELSE IF( MB.LT.1 ) THEN
206206
INFO = -3
207207
ELSE IF( NB.LT.1 .OR. ( NB.GT.N .AND. N.GT.0 )) THEN
208208
INFO = -4
209209
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
210-
INFO = -5
210+
INFO = -6
211211
ELSE IF( LDT.LT.NB ) THEN
212212
INFO = -8
213213
ELSE IF( LWORK.LT.(N*NB) .AND. (.NOT.LQUERY) ) THEN

SRC/zlamtsqr.f

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*> SIDE = 'L' SIDE = 'R'
2626
*> TRANS = 'N': Q * C C * Q
2727
*> TRANS = 'C': Q**H * C C * Q**H
28-
*> where Q is a real orthogonal matrix defined as the product
28+
*> where Q is a complex unitary matrix defined as the product
2929
*> of blocked elementary reflectors computed by tall skinny
3030
*> QR factorization (ZLATSQR)
3131
*> \endverbatim
@@ -56,15 +56,14 @@
5656
*> \param[in] N
5757
*> \verbatim
5858
*> N is INTEGER
59-
*> The number of columns of the matrix C. M >= N >= 0.
59+
*> The number of columns of the matrix C. N >= 0.
6060
*> \endverbatim
6161
*>
6262
*> \param[in] K
6363
*> \verbatim
6464
*> K is INTEGER
6565
*> The number of elementary reflectors whose product defines
66-
*> the matrix Q.
67-
*> N >= K >= 0;
66+
*> the matrix Q. M >= K >= 0;
6867
*>
6968
*> \endverbatim
7069
*>
@@ -164,8 +163,8 @@
164163
* =====================
165164
*>
166165
*> \verbatim
167-
*> Tall-Skinny QR (TSQR) performs QR by a sequence of orthogonal transformations,
168-
*> representing Q as a product of other orthogonal matrices
166+
*> Tall-Skinny QR (TSQR) performs QR by a sequence of unitary transformations,
167+
*> representing Q as a product of other unitary matrices
169168
*> Q = Q(1) * Q(2) * . . . * Q(k)
170169
*> where each Q(i) zeros out subdiagonal entries of a block of MB rows of A:
171170
*> Q(1) zeros out the subdiagonal entries of rows 1:MB of A
@@ -244,12 +243,12 @@ SUBROUTINE ZLAMTSQR( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
244243
INFO = -1
245244
ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
246245
INFO = -2
246+
ELSE IF( M.LT.K ) THEN
247+
INFO = -3
248+
ELSE IF( N.LT.0 ) THEN
249+
INFO = -4
247250
ELSE IF( K.LT.0 ) THEN
248251
INFO = -5
249-
ELSE IF( N.LT.K ) THEN
250-
INFO = -4
251-
ELSE IF( M.LT.N ) THEN
252-
INFO = -3
253252
ELSE IF( K.LT.NB .OR. NB.LT.1 ) THEN
254253
INFO = -7
255254
ELSE IF( LDA.LT.MAX( 1, Q ) ) THEN

SRC/zlatsqr.f

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ SUBROUTINE ZLATSQR( M, N, MB, NB, A, LDA, T, LDT, WORK,
202202
INFO = -1
203203
ELSE IF( N.LT.0 .OR. M.LT.N ) THEN
204204
INFO = -2
205-
ELSE IF( MB.LE.N ) THEN
205+
ELSE IF( MB.LT.1 ) THEN
206206
INFO = -3
207207
ELSE IF( NB.LT.1 .OR. ( NB.GT.N .AND. N.GT.0 )) THEN
208208
INFO = -4
209209
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
210-
INFO = -5
210+
INFO = -6
211211
ELSE IF( LDT.LT.NB ) THEN
212212
INFO = -8
213213
ELSE IF( LWORK.LT.(N*NB) .AND. (.NOT.LQUERY) ) THEN

TESTING/LIN/cerrtsqr.f

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SUBROUTINE CERRTSQR( PATH, NUNIT )
7070
PARAMETER ( NMAX = 2 )
7171
* ..
7272
* .. Local Scalars ..
73-
INTEGER I, INFO, J, NB
73+
INTEGER I, INFO, J, MB, NB
7474
* ..
7575
* .. Local Arrays ..
7676
COMPLEX A( NMAX, NMAX ), T( NMAX, NMAX ), W( NMAX ),
@@ -130,6 +130,35 @@ SUBROUTINE CERRTSQR( PATH, NUNIT )
130130
CALL CGEQR( 3, 2, A, 3, TAU, 8, W, 0, INFO )
131131
CALL CHKXER( 'CGEQR', INFOT, NOUT, LERR, OK )
132132
*
133+
* CLATSQR
134+
*
135+
MB = 1
136+
NB = 1
137+
SRNAMT = 'CLATSQR'
138+
INFOT = 1
139+
CALL CLATSQR( -1, 0, MB, NB, A, 1, TAU, 1, W, 1, INFO )
140+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
141+
INFOT = 2
142+
CALL CLATSQR( 1, 2, MB, NB, A, 1, TAU, 1, W, 1, INFO )
143+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
144+
CALL CLATSQR( 0, -1, MB, NB, A, 1, TAU, 1, W, 1, INFO )
145+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
146+
INFOT = 3
147+
CALL CLATSQR( 2, 1, -1, NB, A, 2, TAU, 1, W, 1, INFO )
148+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
149+
INFOT = 4
150+
CALL CLATSQR( 2, 1, MB, 2, A, 2, TAU, 1, W, 1, INFO )
151+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
152+
INFOT = 6
153+
CALL CLATSQR( 2, 1, MB, NB, A, 1, TAU, 1, W, 1, INFO )
154+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
155+
INFOT = 8
156+
CALL CLATSQR( 2, 1, MB, NB, A, 2, TAU, 0, W, 1, INFO )
157+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
158+
INFOT = 10
159+
CALL CLATSQR( 2, 1, MB, NB, A, 2, TAU, 2, W, 0, INFO )
160+
CALL CHKXER( 'CLATSQR', INFOT, NOUT, LERR, OK )
161+
*
133162
* CGEMQR
134163
*
135164
TAU(1)=1

TESTING/LIN/derrtsqr.f

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SUBROUTINE DERRTSQR( PATH, NUNIT )
7070
PARAMETER ( NMAX = 2 )
7171
* ..
7272
* .. Local Scalars ..
73-
INTEGER I, INFO, J, NB
73+
INTEGER I, INFO, J, MB, NB
7474
* ..
7575
* .. Local Arrays ..
7676
DOUBLE PRECISION A( NMAX, NMAX ), T( NMAX, NMAX ), W( NMAX ),
@@ -130,6 +130,35 @@ SUBROUTINE DERRTSQR( PATH, NUNIT )
130130
CALL DGEQR( 3, 2, A, 3, TAU, 7, W, 0, INFO )
131131
CALL CHKXER( 'DGEQR', INFOT, NOUT, LERR, OK )
132132
*
133+
* DLATSQR
134+
*
135+
MB = 1
136+
NB = 1
137+
SRNAMT = 'DLATSQR'
138+
INFOT = 1
139+
CALL DLATSQR( -1, 0, MB, NB, A, 1, TAU, 1, W, 1, INFO )
140+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
141+
INFOT = 2
142+
CALL DLATSQR( 1, 2, MB, NB, A, 1, TAU, 1, W, 1, INFO )
143+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
144+
CALL DLATSQR( 0, -1, MB, NB, A, 1, TAU, 1, W, 1, INFO )
145+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
146+
INFOT = 3
147+
CALL DLATSQR( 2, 1, -1, NB, A, 2, TAU, 1, W, 1, INFO )
148+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
149+
INFOT = 4
150+
CALL DLATSQR( 2, 1, MB, 2, A, 2, TAU, 1, W, 1, INFO )
151+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
152+
INFOT = 6
153+
CALL DLATSQR( 2, 1, MB, NB, A, 1, TAU, 1, W, 1, INFO )
154+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
155+
INFOT = 8
156+
CALL DLATSQR( 2, 1, MB, NB, A, 2, TAU, 0, W, 1, INFO )
157+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
158+
INFOT = 10
159+
CALL DLATSQR( 2, 1, MB, NB, A, 2, TAU, 2, W, 0, INFO )
160+
CALL CHKXER( 'DLATSQR', INFOT, NOUT, LERR, OK )
161+
*
133162
* DGEMQR
134163
*
135164
TAU(1)=1

0 commit comments

Comments
 (0)