Skip to content

Commit 2909c1b

Browse files
committed
one pass to correct typos and such
1 parent e0809b0 commit 2909c1b

File tree

4 files changed

+79
-91
lines changed

4 files changed

+79
-91
lines changed

SRC/cgesvdq.f

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
*{SIGMA/xGESVDQ/cgesvdq.f}
21
*
32
* Definition:
43
* ===========
@@ -68,7 +67,7 @@
6867
* JOBR (input)
6968
* JOBR is CHARACTER*1
7069
* = 'T' After the initial pivoted QR factorization, CGESVD is applied to
71-
* the adjoint R**H of the computed trinagular factor R. This involves
70+
* the adjoint R**H of the computed triangular factor R. This involves
7271
* some extra data movement (matrix transpositions). Useful for
7372
* experiments, research and development.
7473
* = 'N' The triangular factor R is given as input to CGESVD. This may be
@@ -109,8 +108,8 @@
109108
* A (input/workspace/output)
110109
* A is COMPLEX array of dimensions LDA x N
111110
* On entry, the input matrix A.
112-
* On exit, if JOBU .NE. 'N' o JOBV .NE. 'N', the lower triangle of A contains
113-
* the Householder vectorsas stored by CGEQP3. If JOBU = 'F', these Househlder
111+
* On exit, if JOBU .NE. 'N' or JOBV .NE. 'N', the lower triangle of A contains
112+
* the Householder vectors as stored by CGEQP3. If JOBU = 'F', these Householder
114113
* vectors together with CWORK(1:N) can be used to restore the Q factors from
115114
* the initial pivoted QR factorization of A. See the description of U.
116115
*..............................................................................
@@ -231,7 +230,7 @@
231230
* if the full SVD is requested with JOBV='A', 'V' and
232231
* JOBR ='T', and also a scaled condition number estimate
233232
* requested.
234-
* Finally, LCWORK must be at lest two: LCWORK = MAX( 2, LCWORK ).
233+
* Finally, LCWORK must be at least two: LCWORK = MAX( 2, LCWORK ).
235234
* If, on entry, LCWORK = -1, (workspace query) then the optimal and the
236235
* minimal length of CWORK are computed and returned in the first two entries
237236
* of CWORK. See the description of CWORK.
@@ -270,7 +269,7 @@
270269
* DO-loops because BLAS and LAPACK do not provide corresponding subroutines.
271270
* Those DO-loops are easily identified in this source code - by the CONTINUE
272271
* statements labeled wit 11**. In an optimized version of this code, the
273-
* nested DO loops should be replaced with calls to an optimized subrotine.
272+
* nested DO loops should be replaced with calls to an optimized subroutine.
274273
* 2. This code scales A by 1/SQRT(M) if the largest ABS(A(i,j)) could cause
275274
* column norm overflow. This is the minial precaution and it is left to the
276275
* SVD routine (CGESVD) to do its own preemptive scaling if potential over-
@@ -318,7 +317,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
318317
REAL ZERO, ONE
319318
PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
320319
COMPLEX CZERO, CONE
321-
PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ), CONE = ( 1.0E0, 0.0E0 ) )
320+
PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ), CONE = ( 1.0E0, 0.0E0 ) )
322321
* .. Local Scalars ..
323322
INTEGER IERR, NR, N1, OPTRATIO, p, q
324323
INTEGER LWCON, LWQP3, LWRK_CGELQF, LWRK_CGESVD, LWRK_CGESVD2,
@@ -404,7 +403,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
404403
* [[The expressions for computing the minimal and the optimal
405404
* values of LCWORK are written with a lot of redundancy and
406405
* can be simplified. However, this detailed form is easier for
407-
* maintenace and modififactions of the code.]]
406+
* maintenance and modifications of the code.]]
408407
*
409408
* .. minimal workspace length for CGEQP3 of an M x N matrix
410409
LWQP3 = N+1
@@ -526,7 +525,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
526525
IF ( CONDA ) MINWRK = MAX( MINWRK, LWCON )
527526
MINWRK = MINWRK + N
528527
IF ( WNTVA ) THEN
529-
* .. minimal workspace length for N/2 x N CGELQF
528+
* .. minimal workspace length for N/2 x N CGELQF
530529
LWLQF = MAX( N/2, 1 )
531530
LWSVD2 = MAX( 3 * (N/2), 1 )
532531
LWUNLQ = MAX( N , 1 )
@@ -675,9 +674,9 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
675674
CALL CLASWP( N, A, LDA, 1, M-1, IWORK(N+1), 1 )
676675
END IF
677676
*
678-
* .. At this stage, preemptive scaling is done only to avoid column
679-
* norms overflows during the QR factorization. The SVD procedure should
680-
* have its own scaling to save the singular values from overlows and
677+
* .. At this stage, preemptive scaling is done only to avoid column
678+
* norms overflows during the QR factorization. The SVD procedure should
679+
* have its own scaling to save the singular values from overflows and
681680
* underflows. That depends on the SVD procedure.
682681
*
683682
IF ( .NOT.ROWPRM ) THEN
@@ -714,7 +713,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
714713
*
715714
EPSLN = SLAMCH('E')
716715
SFMIN = SLAMCH('S')
717-
* SMALL = SFMIN / EPSLN
716+
* SMALL = SFMIN / EPSLN
718717
NR = N
719718
*
720719
IF ( ACCLA ) THEN
@@ -734,7 +733,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
734733
ELSEIF ( ACCLM ) THEN
735734
* .. similarly as above, only slightly more gentle (less agressive).
736735
* Sudden drop on the diagonal of R is used as the criterion for being
737-
* close-to-rank-defficient. The threshold is set to EPSLN=SLAMCH('E').
736+
* close-to-rank-deficient. The threshold is set to EPSLN=SLAMCH('E').
738737
* [[This can be made more flexible by replacing this hard-coded value
739738
* with a user specified threshold.]] Also, the values that underflow
740739
* will be truncated.
@@ -759,7 +758,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
759758
3502 CONTINUE
760759
*
761760
IF ( CONDA ) THEN
762-
* Estimate the scled condition number of A. Use the fact that it is
761+
* Estimate the scaled condition number of A. Use the fact that it is
763762
* the same as the scaled condition number of R.
764763
* .. V is used as workspace
765764
CALL CLACPY( 'U', N, N, A, LDA, V, LDV )
@@ -782,7 +781,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
782781
SCONDA = ONE / SQRT(RTMP)
783782
* For NR=N, SCONDA is an estimate of SQRT(||(R^* * R)^(-1)||_1),
784783
* N^(-1/4) * SCONDA <= ||R^(-1)||_2 <= N^(1/4) * SCONDA
785-
* See the references [1], [2] fo more details.
784+
* See the references [1], [2] for more details.
786785
END IF
787786
*
788787
ENDIF
@@ -930,7 +929,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
930929
CALL CLAPMT( .FALSE., NR, N, V, LDV, IWORK )
931930
ELSE
932931
* .. need all N right singular vectors and NR < N
933-
* [!] This is simple implemetation that augments [V](1:N,1:NR)
932+
* [!] This is simple implementation that augments [V](1:N,1:NR)
934933
* by padding a zero block. In the case NR << N, a more efficient
935934
* way is to first use the QR factorization. For more details
936935
* how to implement this, see the " FULL SVD " branch.
@@ -964,7 +963,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
964963
* .. now [V](1:NR,1:N) contains V(1:N,1:NR)**H
965964
ELSE
966965
* .. need all N right singular vectors and NR < N
967-
* [!] This is simple implemetation that augments [V](1:NR,1:N)
966+
* [!] This is simple implementation that augments [V](1:NR,1:N)
968967
* by padding a zero block. In the case NR << N, a more efficient
969968
* way is to first use the LQ factorization. For more details
970969
* how to implement this, see the " FULL SVD " branch.
@@ -1240,7 +1239,7 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
12401239
4001 CONTINUE
12411240
4002 CONTINUE
12421241
*
1243-
* .. if numerical rank defficiency is detected, the truncated
1242+
* .. if numerical rank deficiency is detected, the truncated
12441243
* singular values are set to zero.
12451244
IF ( NR .LT. N ) CALL SLASET( 'G', N-NR,1, ZERO,ZERO, S(NR+1), N )
12461245
* .. undo scaling; this may cause overflow in the largest singular
@@ -1250,12 +1249,10 @@ SUBROUTINE CGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
12501249
IF ( CONDA ) RWORK(1) = SCONDA
12511250
RWORK(2) = p - NR
12521251
* .. p-NR is the number of singular values that are computed as
1253-
* exact zeros in CGESVD() aplied to the (possibly truncated)
1252+
* exact zeros in CGESVD() applied to the (possibly truncated)
12541253
* full row rank triangular (trapezoidal) factor of A.
12551254
NUMRANK = NR
12561255
*
12571256
RETURN
12581257
END
12591258
* .. end of CGESVDQ
1260-
1261-

SRC/dgesvdq.f

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
*{SIGMA/xGESVDQ/dgesvdq.f}
21
*
32
* Definition:
43
* ===========
@@ -68,7 +67,7 @@
6867
* JOBR (input)
6968
* JOBR is CHARACTER*1
7069
* = 'T' After the initial pivoted QR factorization, DGESVD is applied to
71-
* the transposed R**T of the computed trinagular factor R. This involves
70+
* the transposed R**T of the computed triangular factor R. This involves
7271
* some extra data movement (matrix transpositions). Useful for
7372
* experiments, research and development.
7473
* = 'N' The triangular factor R is given as input to DGESVD. This may be
@@ -109,8 +108,8 @@
109108
* A (input/workspace/output)
110109
* A is REAL array of dimensions LDA x N
111110
* On entry, the input matrix A.
112-
* On exit, if JOBU .NE. 'N' o JOBV .NE. 'N', the lower triangle of A contains
113-
* the Householder vectorsas stored by DGEQP3. If JOBU = 'F', these Househlder
111+
* On exit, if JOBU .NE. 'N' or JOBV .NE. 'N', the lower triangle of A contains
112+
* the Householder vectors as stored by DGEQP3. If JOBU = 'F', these Householder
114113
* vectors together with WORK(1:N) can be used to restore the Q factors from
115114
* the initial pivoted QR factorization of A. See the description of U.
116115
*..............................................................................
@@ -233,7 +232,7 @@
233232
* if the full SVD is requested with JOBV='A' or 'V', and
234233
* JOBR ='T', and also a scaled condition number estimate
235234
* requested.
236-
* Finally, LWORK must be at lest two: LWORK = MAX( 2, LWORK ).
235+
* Finally, LWORK must be at least two: LWORK = MAX( 2, LWORK ).
237236
* If, on entry, LWORK = -1, (workspace query) then the optimal and the
238237
* minimal length of WORK are computed and returned in the first two entries
239238
* of WORK. See the description of WORK.
@@ -272,7 +271,7 @@
272271
* DO-loops because BLAS and LAPACK do not provide corresponding subroutines.
273272
* Those DO-loops are easily identified in this source code - by the CONTINUE
274273
* statements labeled wit 11**. In an optimized version of this code, the
275-
* nested DO loops should be replaced with calls to an optimized subrotine.
274+
* nested DO loops should be replaced with calls to an optimized subroutine.
276275
* 2. This code scales A by 1/SQRT(M) if the largest ABS(A(i,j)) could cause
277276
* column norm overflow. This is the minial precaution and it is left to the
278277
* SVD routine (DGESVD) to do its own preemptive scaling if potential over-
@@ -402,7 +401,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
402401
* [[The expressions for computing the minimal and the optimal
403402
* values of LWORK are written with a lot of redundancy and
404403
* can be simplified. However, this detailed form is easier for
405-
* maintenace and modififactions of the code.]]
404+
* maintenance and modifications of the code.]]
406405
*
407406
* .. minimal workspace length for DGEQP3 of an M x N matrix
408407
LWQP3 = 3 * N + 1
@@ -435,7 +434,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
435434
MINWRK = 2
436435
OPTWRK = 2
437436
IF ( .NOT. (LSVEC .OR. RSVEC )) THEN
438-
* .. minimal and optimal sizes of the workspace if
437+
* .. minimal and optimal sizes of the workspace if
439438
* only the singular values are requested
440439
IF ( CONDA ) THEN
441440
MINWRK = MAX( N+LWQP3, LWCON, LWSVD )
@@ -478,7 +477,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
478477
END IF
479478
END IF
480479
ELSE IF ( RSVEC .AND. (.NOT.LSVEC) ) THEN
481-
* .. minimal and optimal sizes of the workspace if the
480+
* .. minimal and optimal sizes of the workspace if the
482481
* singular values and the right singular vectors are requested
483482
IF ( CONDA ) THEN
484483
MINWRK = N + MAX( LWQP3, LWCON, LWSVD )
@@ -501,7 +500,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
501500
END IF
502501
END IF
503502
ELSE
504-
* .. minimal and optimal sizes of the workspace if the
503+
* .. minimal and optimal sizes of the workspace if the
505504
* full SVD is requested
506505
IF ( RTRANS ) THEN
507506
MINWRK = MAX( LWQP3, LWSVD, LWORQ )
@@ -524,7 +523,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
524523
IF ( CONDA ) MINWRK = MAX( MINWRK, LWCON )
525524
MINWRK = MINWRK + N
526525
IF ( WNTVA ) THEN
527-
* .. minimal workspace length for N/2 x N DGELQF
526+
* .. minimal workspace length for N/2 x N DGELQF
528527
LWLQF = MAX( N/2, 1 )
529528
LWSVD2 = MAX( 5 * (N/2), 1 )
530529
LWORLQ = MAX( N , 1 )
@@ -675,9 +674,9 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
675674
CALL DLASWP( N, A, LDA, 1, M-1, IWORK(N+1), 1 )
676675
END IF
677676
*
678-
* .. At this stage, preemptive scaling is done only to avoid column
679-
* norms overflows during the QR factorization. The SVD procedure should
680-
* have its own scaling to save the singular values from overlows and
677+
* .. At this stage, preemptive scaling is done only to avoid column
678+
* norms overflows during the QR factorization. The SVD procedure should
679+
* have its own scaling to save the singular values from overflows and
681680
* underflows. That depends on the SVD procedure.
682681
*
683682
IF ( .NOT.ROWPRM ) THEN
@@ -714,7 +713,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
714713
*
715714
EPSLN = DLAMCH('E')
716715
SFMIN = DLAMCH('S')
717-
* SMALL = SFMIN / EPSLN
716+
* SMALL = SFMIN / EPSLN
718717
NR = N
719718
*
720719
IF ( ACCLA ) THEN
@@ -734,7 +733,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
734733
ELSEIF ( ACCLM ) THEN
735734
* .. similarly as above, only slightly more gentle (less agressive).
736735
* Sudden drop on the diagonal of R is used as the criterion for being
737-
* close-to-rank-defficient. The threshold is set to EPSLN=DLAMCH('E').
736+
* close-to-rank-deficient. The threshold is set to EPSLN=DLAMCH('E').
738737
* [[This can be made more flexible by replacing this hard-coded value
739738
* with a user specified threshold.]] Also, the values that underflow
740739
* will be truncated.
@@ -759,7 +758,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
759758
3502 CONTINUE
760759
*
761760
IF ( CONDA ) THEN
762-
* Estimate the scled condition number of A. Use the fact that it is
761+
* Estimate the scaled condition number of A. Use the fact that it is
763762
* the same as the scaled condition number of R.
764763
* .. V is used as workspace
765764
CALL DLACPY( 'U', N, N, A, LDA, V, LDV )
@@ -782,7 +781,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
782781
SCONDA = ONE / SQRT(RTMP)
783782
* For NR=N, SCONDA is an estimate of SQRT(||(R^* * R)^(-1)||_1),
784783
* N^(-1/4) * SCONDA <= ||R^(-1)||_2 <= N^(1/4) * SCONDA
785-
* See the references [1], [2] fo more details.
784+
* See the references [1], [2] for more details.
786785
END IF
787786
*
788787
ENDIF
@@ -927,7 +926,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
927926
CALL DLAPMT( .FALSE., NR, N, V, LDV, IWORK )
928927
ELSE
929928
* .. need all N right singular vectors and NR < N
930-
* [!] This is simple implemetation that augments [V](1:N,1:NR)
929+
* [!] This is simple implementation that augments [V](1:N,1:NR)
931930
* by padding a zero block. In the case NR << N, a more efficient
932931
* way is to first use the QR factorization. For more details
933932
* how to implement this, see the " FULL SVD " branch.
@@ -960,7 +959,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
960959
* .. now [V](1:NR,1:N) contains V(1:N,1:NR)**T
961960
ELSE
962961
* .. need all N right singular vectors and NR < N
963-
* [!] This is simple implemetation that augments [V](1:NR,1:N)
962+
* [!] This is simple implementation that augments [V](1:NR,1:N)
964963
* by padding a zero block. In the case NR << N, a more efficient
965964
* way is to first use the LQ factorization. For more details
966965
* how to implement this, see the " FULL SVD " branch.
@@ -1231,7 +1230,7 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
12311230
4001 CONTINUE
12321231
4002 CONTINUE
12331232
*
1234-
* .. if numerical rank defficiency is detected, the truncated
1233+
* .. if numerical rank deficiency is detected, the truncated
12351234
* singular values are set to zero.
12361235
IF ( NR .LT. N ) CALL DLASET( 'G', N-NR,1, ZERO,ZERO, S(NR+1), N )
12371236
* .. undo scaling; this may cause overflow in the largest singular
@@ -1241,12 +1240,10 @@ SUBROUTINE DGESVDQ( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
12411240
IF ( CONDA ) RWORK(1) = SCONDA
12421241
RWORK(2) = p - NR
12431242
* .. p-NR is the number of singular values that are computed as
1244-
* exact zeros in DGESVD() aplied to the (possibly truncated)
1243+
* exact zeros in DGESVD() applied to the (possibly truncated)
12451244
* full row rank triangular (trapezoidal) factor of A.
12461245
NUMRANK = NR
12471246
*
12481247
RETURN
12491248
END
12501249
* .. end of DGESVDQ
1251-
1252-

0 commit comments

Comments
 (0)