SGESVJ(3)
π SGESVJ(3) β Library Functions Manual π
okay so bestie, this is SGESVJ(3) from the Library Functions Manual, and the NAME line points at /home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/sgesvj.f. Itβs giving βserious linear algebra, but make it cute.β π
π NAME π
SGESVJ(3) β from the Library Functions Manual, with the original NAME pointing at /home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/sgesvj.f.
β¨ SYNOPSIS β¨
π¦ Functions/Subroutines π¦
subroutine SGESVJ (joba, jobu, jobv, m, n, a, lda, sva, mv, v, ldv,
work, lwork, info)
π Function/Subroutine Documentation π
okay, hereβs the full signature, no cap:
subroutine SGESVJ (character*1 joba, character*1 jobu, character*1 jobv,
integer m, integer n, real, dimension( lda, * ) a, integer lda, real,
dimension( n ) sva, integer mv, real, dimension( ldv, * ) v, integer
ldv, real, dimension( lwork ) work, integer lwork, integer info)
SGESVJ
π Purpose π
SGESVJ computes the singular value decomposition (SVD) of a real M-by-N matrix A, where M >= N. The SVD of A is written as:
[++] [xx] [x0] [xx]
A = U * SIGMA * V^t, [++] = [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 orthogonal 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.
SGESVJ can sometimes compute tiny singular values and their singular vectors much more accurately than other SVD routines, see below under Further Details. π
πΈ Parameters πΈ
π JOBA
JOBA is CHARACTER*1. It specifies the structure of A.
'L'β the input matrixAis lower triangular.'U'β the input matrixAis upper triangular.'G'β the input matrixAis a general M-by-N matrix,M >= N.
π JOBU
JOBU is CHARACTER*1. It specifies whether to compute the left singular vectors β the columns of U:
'U'β the left singular vectors corresponding to the nonzero singular values are computed and returned in the leading columns ofA. See more details in the description ofA. The default numerical orthogonality threshold is set to approximatelyTOL=CTOL*EPS,CTOL=SQRT(M),EPS=SLAMCH('E').'C'β analogous toJOBU='U', except that the user can control the level of numerical orthogonality of the computed left singular vectors.TOLcan be set toTOL = CTOL*EPS, whereCTOLis given on input in the arrayWORK. NoCTOLsmaller thanONEis allowed.CTOLgreater than1 / EPSis meaningless. The option'C'can be used ifM*EPSis satisfactory orthogonality of the computed left singular vectors, soCTOL=Mcould save few sweeps of Jacobi rotations. See the descriptions ofAandWORK(1).'N'β the matrixUis not computed. However, see the description ofA.
bestie, thoseCTOLlimits are not a vibe suggestion β noCTOLsmaller thanONE, fr fr. π«Ά
π JOBV
JOBV is CHARACTER*1. It specifies whether to compute the right singular vectors, that is, the matrix V:
'V'β the matrixVis computed and returned in the arrayV.'A'β the Jacobi rotations are applied to the MV-by-N arrayV. In other words, the right singular vector matrixVis not computed explicitly; instead it is applied to an MV-by-N matrix initially stored in the firstMVrows ofV.'N'β the matrixVis not computed and the arrayVis not referenced.
π M
M is INTEGER. Itβs the number of rows of the input matrix A. 1/SLAMCH('E') > M >= 0.
π N
N is INTEGER. Itβs the number of columns of the input matrix A. M >= N >= 0.
π A
A is a REAL array, dimension (LDA,N).
On entry, itβs the M-by-N matrix A.
On exit:
- If
JOBU = 'U'.OR.JOBU = 'C':- If
INFO = 0:RANKAorthonormal columns ofUare returned in the leadingRANKAcolumns of the arrayA. HereRANKA <= Nis the number of computed singular values ofAthat are above the underflow thresholdSLAMCH('S'). The singular vectors corresponding to underflowed or zero singular values are not computed. The value ofRANKAis returned in the arrayWORKasRANKA=NINT(WORK(2)). Also see the descriptions ofSVAandWORK. The computed columns ofUare mutually numerically orthogonal up to approximatelyTOL=SQRT(M)*EPS(default); orTOL=CTOL*EPS(JOBU = 'C'), see the description ofJOBU. - If
INFO > 0: the procedureSGESVJdid not converge in the given number of iterations (sweeps). In that case, the computed columns ofUmay not be orthogonal up toTOL. The outputU(stored inA),SIGMA(given by the computed singular values inSVA(1:N)) andVis still a decomposition of the input matrixAin the sense that the residual||A-SCALE*U*SIGMA*V^T||_2 / ||A||_2is small.
- If
- If
JOBU = 'N':- If
INFO = 0: note that the left singular vectors are βfor freeβ in the one-sided Jacobi SVD algorithm. However, if only the singular values are needed, the level of numerical orthogonality ofUis not an issue and iterations are stopped when the columns of the iterated matrix are numerically orthogonal up to approximatelyM*EPS. Thus, on exit,Acontains the columns ofUscaled with the corresponding singular values. - If
INFO > 0: the procedureSGESVJdid not converge in the given number of iterations (sweeps).
- If
π LDA
LDA is INTEGER. Itβs the leading dimension of the array A. LDA >= max(1,M).
π SVA
SVA is a REAL array, dimension (N).
On exit:
- If
INFO = 0: depending on the valueSCALE = WORK(1), we have:- If
SCALE = ONE:SVA(1:N)contains the computed singular values ofA. During the computationSVAcontains the Euclidean column norms of the iterated matrices in the arrayA. - If
SCALE .NE. ONE: the singular values ofAareSCALE*SVA(1:N), and this factored representation is due to the fact that some of the singular values ofAmight underflow or overflow.
- If
- If
INFO > 0: the procedureSGESVJdid not converge in the given number of iterations (sweeps) andSCALE*SVA(1:N)may not be accurate.
π MV
MV is INTEGER.
If JOBV = 'A', then the product of Jacobi rotations in SGESVJ is applied to the first MV rows of V. See the description of JOBV.
π V
V is a REAL array, dimension (LDV,N).
- If
JOBV = 'V', thenVcontains on exit the N-by-N matrix of the right singular vectors. - If
JOBV = 'A', thenVcontains the product of the computed right singular vector matrix and the initial matrix in the arrayV. - If
JOBV = 'N', thenVis not referenced.
π LDV
LDV is INTEGER. Itβs the leading dimension of the array V, LDV >= 1.
- If
JOBV = 'V', thenLDV >= max(1,N). - If
JOBV = 'A', thenLDV >= max(1,MV).
π WORK
WORK is a REAL array, dimension (LWORK).
On entry:
- If
JOBU = 'C':WORK(1) = CTOL, whereCTOLdefines the threshold for convergence. The process stops if all columns ofAare mutually orthogonal up toCTOL*EPS,EPS=SLAMCH('E'). It is required thatCTOL >= ONE, i.e. it is not allowed to force the routine to obtain orthogonality belowEPSILON.
On exit:
WORK(1) = SCALEis the scaling factor such thatSCALE*SVA(1:N)are the computed singular values ofA. (See description ofSVA().)WORK(2) = NINT(WORK(2))is the number of the computed nonzero singular values.WORK(3) = NINT(WORK(3))is the number of the computed singular values that are larger than the underflow threshold.WORK(4) = NINT(WORK(4))is the number of sweeps of Jacobi rotations needed for numerical convergence.WORK(5) = max_{i.NE.j} |COS(A(:,i),A(:,j))|in the last sweep. This is useful information in cases whenSGESVJdid not converge, as it can be used to estimate whether the output is still useful and for post festum analysis.WORK(6) =the largest absolute value over all sines of the Jacobi rotation angles in the last sweep. It can be useful for a post festum analysis.
warning-ish reminder: thatCTOL >= ONEthing is real. Do not try to force orthogonality belowEPSILON, bestie. The routine said what it said. π
π LWORK
LWORK is INTEGER. Itβs the length of WORK, WORK >= MAX(6,M+N).
π INFO
INFO starts here, and part 1 cuts off right at this point β the rest is in part 2. π«Ά
INFOπ β this one's anINTEGER, and it's basically the vibe check on your entire call:= 0: successful exit. we ate, no crumbs. β¨< 0: ifINFO = -i, then the i-th argument had an illegal value π (bestie, something you passed in was cursed).> 0: SGESVJ did not converge in the maximal allowed number (30) of sweeps. The output may still be useful. See the description ofWORK. π«Ά
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π Further Details:
The orthogonal N-by-N matrix V is obtained as a product of Jacobi plane rotations. The rotations are implemented as fast scaled rotations of Anda and Park [1]. In the case of underflow of the Jacobi angle, a modified Jacobi transformation of Drmac [4] is used. Pivot strategy uses column interchanges of de Rijk [2]. The relative accuracy of the computed singular values and the accuracy of the computed singular vectors (in angle metric) is as guaranteed by the theory of Demmel and Veselic [3]. The condition number that determines the accuracy in the full rank case is essentially min_{D=diag} kappa(A*D), where kappa(.) is the spectral condition number. The best performance of this Jacobi SVD procedure is achieved if used in an accelerated version of Drmac and Veselic [5,6], and it is the kernel routine in the SIGMA library [7]. Some tuning parameters (marked with [TP]) are available for the implementer.
The computational range for the nonzero singular values is the machine number interval ( UNDERFLOW , OVERFLOW ). In extreme cases, even denormalized singular values can be computed with the corresponding gradual loss of accurate digits. π (like, that's lowkey impressive but also pls know what you're doing.)
π«Ά Contributors:
Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
π References:
- [1] A. A. Anda and H. Park: Fast plane rotations with dynamic scaling. SIAM J. matrix Anal. Appl., Vol. 15 (1994), pp. 162-174.
- [2] P. P. M. De Rijk: A one-sided Jacobi algorithm for computing the singular value decomposition on a vector computer. SIAM J. Sci. Stat. Comp., Vol. 10 (1998), pp. 359-371.
- [3] J. Demmel and K. Veselic: Jacobi method is more accurate than QR.
- [4] Z. Drmac: Implementation of Jacobi rotations for accurate singular value computation in floating point arithmetic. SIAM J. Sci. Comp., Vol. 18 (1997), pp. 1200-1222.
- [5] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm I. SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1322-1342. LAPACK Working note 169.
- [6] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm II. SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1343-1362. LAPACK Working note 170.
- [7] Z. Drmac: SIGMA - mathematical software library for accurate SVD, PSV, QSVD, (H,K)-SVD computations. Department of Mathematics, University of Zagreb, 2008.
π Bugs, Examples and Comments:
Please report all bugs and send interesting test examples and comments to drmac@math.hr. Thank you. π«Ά (yes fr, they actually want your weird test cases, it's giving "the authors are nice actually")
Definition at line 321 of file sgesvj.f.
π Author
Generated automatically by Doxygen for LAPACK from the source code.
β¨ and that's the whole page, bestie β¨ this was LAPACK, Version 3.12.0, straight out of /home/abui...RC/sgesvj.f(3) β go forth and decompose some singular values, you absolute icon π
ππ¦
π¦ 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