/home/abui.../cgesvdq.f(3)
π /home/abui.../cgesvdq.f(3) β Library Functions Manual π
okay so bestie, this is the Library Functions Manual page for /home/abui.../cgesvdq.f(3), and we are absolutely doing LAPACK with sparkle. π«Ά No cap, every detail is staying.
β¨ NAME β¨
The NAME is literally this path, no extras, no side quests:
/home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/cgesvdq.f
β¨ SYNOPSIS β¨
π§ Functions/Subroutines π§
subroutine CGESVDQ (joba, jobp, jobr, jobu, jobv, m, n, a, lda, s, u,
ldu, v, ldv, numrank, iwork, liwork, cwork, lcwork, rwork, lrwork,
info)
CGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE matrices β¨
π Function/Subroutine Documentation π
subroutine CGESVDQ (character joba, character jobp, character jobr,
character jobu, character jobv, integer m, integer n, complex,
dimension( lda, * ) a, integer lda, real, dimension( * ) s, complex,
dimension( ldu, * ) u, integer ldu, complex, dimension( ldv, * ) v,
integer ldv, integer numrank, integer, dimension( * ) iwork, integer
liwork, complex, dimension( * ) cwork, integer lcwork, real, dimension(
* ) rwork, integer lrwork, integer info)
CGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE matrices π
π― Purpose π―
!>
!> CGESVDQ computes the singular value decomposition (SVD) of a complex
!> M-by-N matrix A, where M >= N. The SVD of A is written as
!> [++] [xx] [x0] [xx]
!> A = U * SIGMA * V^*, [++] = [xx] * [ox] * [xx]
!> [++] [xx]
!> where SIGMA is an N-by-N diagonal matrix, U is an M-by-N orthonormal
!> matrix, and V is an N-by-N unitary matrix. The diagonal elements
!> of SIGMA are the singular values of A. The columns of U and V are the
!> left and the right singular vectors of A, respectively.
!>
π§Έ Parameters π§Έ
JOBA
JOBA is CHARACTER*1 and it sets the accuracy level of the computed SVD, bestie. The values are:
'A'β the requested accuracy corresponds to having the backward error bounded by|| delta A ||_F <= f(m,n) * EPS * || A ||_F, whereEPS = SLAMCH('Epsilon'). This authorisesCGESVDQto truncate the computed triangular factor in a rank revealing QR factorization whenever the truncated part is below the threshold of the order ofEPS * ||A||_F. This is the aggressive truncation level, fr.'M'β similarly as with'A', but the truncation is more gentle: it is allowed only when there is a drop on the diagonal of the triangular factor in the QR factorization. This is the medium truncation level.'H'β high accuracy requested. No numerical rank determination based on the rank revealing QR factorization is attempted. Periodt.'E'β same as'H', and in addition the condition number of column scaled A is estimated and returned inRWORK(1). The bound isN^(-1/4)*RWORK(1) <= ||pinv(A_scaled)||_2 <= N^(1/4)*RWORK(1).
JOBP
JOBP is CHARACTER*1:
'P'β the rows of A are ordered in decreasing order with respect to||A(i,:)||_\infty. This enhances numerical accuracy at the cost of extra data movement. Recommended for numerical robustness.'N'β no row pivoting.
JOBR
JOBR is CHARACTER*1:
'T'β after the initial pivoted QR factorization,CGESVDis applied to the adjointR**Hof the computed triangular factor R. This involves some extra data movement (matrix transpositions). Useful for experiments, research and development.'N'β the triangular factor R is given as input toCGESVD. This may be preferred as it involves less data movement.
JOBU
JOBU is CHARACTER*1:
'A'β all M left singular vectors are computed and returned in the matrix U. See the description of U.'S'or'U'βN = min(M,N)left singular vectors are computed and returned in the matrix U. See the description of U.'R'β numerical rankNUMRANKis determined and onlyNUMRANKleft singular vectors are computed and returned in the matrix U.'F'β the N left singular vectors are returned in factored form as the product of the Q factor from the initial QR factorization and the N left singular vectors of(R**H , 0)**H. If row pivoting is used, then the necessary information on the row pivoting is stored inIWORK(N+1:N+M-1).'N'β the left singular vectors are not computed.
JOBV
JOBV is CHARACTER*1:
'A','V'β all N right singular vectors are computed and returned in the matrix V.'R'β numerical rankNUMRANKis determined and onlyNUMRANKright singular vectors are computed and returned in the matrix V. This option is allowed only ifJOBU = 'R'orJOBU = 'N'; otherwise it is illegal.'N'β the right singular vectors are not computed.
M
M is INTEGER. The number of rows of the input matrix A. M >= 0.
N
N is INTEGER. The number of columns of the input matrix A. M >= N >= 0.
A
A is COMPLEX array of dimensions LDA x N.
On entry, the input matrix A.
On exit, if JOBU .NE. 'N' or JOBV .NE. 'N', the lower triangle of A contains the Householder vectors as stored by CGEQP3. If JOBU = 'F', these Householder vectors together with CWORK(1:N) can be used to restore the Q factors from the initial pivoted QR factorization of A. See the description of U.
LDA
LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
S
S is REAL array of dimension N. The singular values of A, ordered so that S(i) >= S(i+1).
U
U is COMPLEX array, dimension:
LDU x MifJOBU = 'A'; see the description of LDU. In this case, on exit, U contains the M left singular vectors.LDU x NifJOBU = 'S','U','R'; see the description of LDU. In this case, U contains the leading N or the leadingNUMRANKleft singular vectors.LDU x NifJOBU = 'F'; see the description of LDU. In this case U containsN x Nunitary matrix that can be used to form the left singular vectors.
If JOBU = 'N', U is not referenced.
LDU
LDU is INTEGER. The leading dimension of the array U.
- If
JOBU = 'A','S','U','R',LDU >= max(1,M). - If
JOBU = 'F',LDU >= max(1,N). - Otherwise,
LDU >= 1.
V
V is COMPLEX array, dimension:
LDV x NifJOBV = 'A','V','R'or ifJOBA = 'E'.- If
JOBV = 'A', or'V', V contains the N-by-N unitary matrixV**H; - If
JOBV = 'R', V contains the firstNUMRANKrows ofV**H(the right singular vectors, stored rowwise, of theNUMRANKlargest singular values). - If
JOBV = 'N'andJOBA = 'E', V is used as a workspace. - If
JOBV = 'N', andJOBA.NE.'E', V is not referenced.
LDV
LDV is INTEGER. The leading dimension of the array V.
- If
JOBV = 'A','V','R', orJOBA = 'E',LDV >= max(1,N). - Otherwise,
LDV >= 1.
NUMRANK
NUMRANK is INTEGER. NUMRANK is the numerical rank first determined after the rank revealing QR factorization, following the strategy specified by the value of JOBA. If JOBV = 'R' and JOBU = 'R', only NUMRANK leading singular values and vectors are then requested in the call of CGESVD. The final value of NUMRANK might be further reduced if some singular values are computed as zeros.
IWORK
IWORK is INTEGER array, dimension (max(1, LIWORK)).
On exit, IWORK(1:N) contains column pivoting permutation of the rank revealing QR factorization.
If JOBP = 'P', IWORK(N+1:N+M-1) contains the indices of the sequence of row swaps used in row pivoting. These can be used to restore the left singular vectors in the case JOBU = 'F'.
If LIWORK, LCWORK, or LRWORK = -1, then on exit, if INFO = 0, IWORK(1) returns the minimal LIWORK.
LIWORK
LIWORK is INTEGER. The dimension of the array IWORK.
LIWORK >= N + M - 1, if JOBP = 'P';
LIWORK >= N if JOBP = 'N'.
If LIWORK = -1, then a workspace query is assumed; the routine only calculates and returns the optimal and minimal sizes for the CWORK, IWORK, and RWORK arrays, and no error message related to LCWORK is issued by XERBLA.
CWORK
CWORK is COMPLEX array, dimension (max(2, LCWORK)), used as a workspace.
On exit, if, on entry, LCWORK.NE.-1, CWORK(1:N) contains parameters needed to recover the Q factor from the QR factorization computed by CGEQP3.
If LIWORK, LCWORK, or LRWORK = -1, then on exit, if INFO = 0, CWORK(1) returns the optimal LCWORK, and CWORK(2) returns the minimal LCWORK.
LCWORK
LCWORK is INTEGER β okay so this is the workspace dimension for CWORK, and it is determined by a whole lil formula family, bestie. The dimension of the array CWORK is determined as follows:
Let LWQP3 = N+1, LWCON = 2*N, and let
LWUNQ = { MAX( N, 1 ), if JOBU = 'R', 'S', or 'U'
{ MAX( M, 1 ), if JOBU = 'A'
LWSVD = MAX( 3*N, 1 )
LWLQF = MAX( N/2, 1 ), LWSVD2 = MAX( 3*(N/2), 1 ), LWUNLQ = MAX( N, 1 ),
LWQRF = MAX( N/2, 1 ), LWUNQ2 = MAX( N, 1 )
Then the minimal value of LCWORK is:
= MAX( N + LWQP3, LWSVD ) if only the singular values are needed;
= MAX( N + LWQP3, LWCON, LWSVD ) if only the singular values are needed,
and a scaled condition estimate requested;
= N + MAX( LWQP3, LWSVD, LWUNQ ) if the singular values and the left
singular vectors are requested;
= N + MAX( LWQP3, LWCON, LWSVD, LWUNQ ) if the singular values and the left
singular vectors are requested, and also
a scaled condition estimate requested;
= N + MAX( LWQP3, LWSVD ) if the singular values and the right
singular vectors are requested;
= N + MAX( LWQP3, LWCON, LWSVD ) if the singular values and the right
singular vectors are requested, and also
a scaled condition etimate requested;
= N + MAX( LWQP3, LWSVD, LWUNQ ) if the full SVD is requested with JOBV = 'R';
independent of JOBR;
= N + MAX( LWQP3, LWCON, LWSVD, LWUNQ ) if the full SVD is requested,
JOBV = 'R' and, also a scaled condition
estimate requested; independent of JOBR;
= MAX( N + MAX( LWQP3, LWSVD, LWUNQ ),
N + MAX( LWQP3, N/2+LWLQF, N/2+LWSVD2, N/2+LWUNLQ, LWUNQ) ) if the
full SVD is requested with JOBV = 'A' or 'V', and
JOBR ='N'
= MAX( N + MAX( LWQP3, LWCON, LWSVD, LWUNQ ),
N + MAX( LWQP3, LWCON, N/2+LWLQF, N/2+LWSVD2, N/2+LWUNLQ, LWUNQ ) )
if the full SVD is requested with JOBV = 'A' or 'V', and
JOBR ='N', and also a scaled condition number estimate
requested.
= MAX( N + MAX( LWQP3, LWSVD, LWUNQ ),
N + MAX( LWQP3, N/2+LWQRF, N/2+LWSVD2, N/2+LWUNQ2, LWUNQ ) ) if the
full SVD is requested with JOBV = 'A', 'V', and JOBR ='T'
= MAX( N + MAX( LWQP3, LWCON, LWSVD, LWUNQ ),
N + MAX( LWQP3, LWCON, N/2+LWQRF, N/2+LWSVD2, N/2+LWUNQ2, LWUNQ ) )
if the full SVD is requested with JOBV = 'A', 'V' and
JOBR ='T', and also a scaled condition number estimate
requested.
Finally, LCWORK must be at least two: LCWORK = MAX( 2, LCWORK ).
And the finale, bestie: LCWORK must be at least two: LCWORK = MAX( 2, LCWORK ).
If LCWORK = -1, then a workspace query is assumed; the routine only calculates and returns the optimal and minimal sizes for the CWORK, IWORK, and RWORK arrays, and no error message related to LCWORK is issued by XERBLA.
RWORK is a REAL array, dimension (max(1, LRWORK)). On exit:
- If
JOBA = 'E',RWORK(1)contains an estimate of the condition number of column scaledA. IfA = C * DwhereDis diagonal andChas unit columns in the Euclidean norm, then, assuming full column rank,N^(-1/4) * RWORK(1) <= ||pinv(C)||_2 <= N^(1/4) * RWORK(1). Otherwise,RWORK(1) = -1. RWORK(2)contains the number of singular values computed as exact zeros inCGESVDapplied to the upper triangular or trapezoidalR(from the initial QR factorization). In case of early exit (no call toCGESVD, such as in the case of zero matrix)RWORK(2) = -1.
If LIWORK, LCWORK, or LRWORK = -1, then on exit, if INFO = 0, RWORK(1) returns the minimal LRWORK.
LRWORK is INTEGER. The dimension of the array RWORK.
If JOBP ='P', then LRWORK >= MAX(2, M, 5*N); Otherwise, LRWORK >= MAX(2, 5*N).
If LRWORK = -1, then a workspace query is assumed; the routine only calculates and returns the optimal and minimal sizes for the CWORK, IWORK, and RWORK arrays, and no error message related to LCWORK is issued by XERBLA.
INFO is INTEGER
= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifCBDSQRdid not converge,INFOspecifies how many superdiagonals of an intermediate bidiagonal formB(computed inCGESVD) did not converge to zero.
π‘ Further Details
- The data movement (matrix transpose) is coded using simple nested
DO-loopsbecause BLAS and LAPACK do not provide corresponding subroutines. ThoseDO-loopsare easily identified in this source code - by theCONTINUEstatements labeled with11**. In an optimized version of this code, the nestedDO loopsshould be replaced with calls to an optimized subroutine. - This code scales
Aby1/SQRT(M)if the largestABS(A(i,j))could cause column norm overflow. This is the minial precaution and it is left to the SVD routine (CGESVD) to do its own preemptive scaling if potential over- or underflows are detected. To avoid repeated scanning of the arrayA, an optimal implementation would do all necessary scaling before callingCGESVDand the scaling inCGESVDcan be switched off. - Other comments related to code optimization are given in comments in the code, enclosed in
[[double brackets]].
π Bugs, examples and comments
Please report all bugs and send interesting examples and/or comments to drmac@math.hr. Thank you.
π References
[1]Zlatko Drmac, Algorithm 977: A QR-Preconditioned QR SVD Method for Computing the SVD with High Accuracy. ACM Trans. Math. Softw. 44(1): 11:1-11:30 (2017)
SIGMA library, xGESVDQ section updated February 2016.
Developed and coded by Zlatko Drmac, Department of Mathematics University of Zagreb, Croatia, drmac@math.hr
π«Ά Contributors
Developed and coded by Zlatko Drmac, Department of Mathematics University of Zagreb, Croatia, drmac@math.hr
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 410 of file cgesvdq.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
π source/version: LAPACK Version 3.12.0; page: /home/abui.../cgesvdq.f(3). Now go query those workspaces, bestie β periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms