CGELSD(3)
π CGELSD(3) β Library Functions Manual π
okay bestie, this is the page for CGELSD(3) from the Library Functions Manual β yes, the whole manual page is named after one subroutine file, and it's giving math girlie who has her life together energy. β¨
π NAME π
The NAME is literally this file path: /home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/cgelsd.f β that's the cgelsd.f file, periodt. π
β¨ SYNOPSIS β¨
Functions/Subroutines
subroutine CGELSD (m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, iwork, info)
CGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices. π«Ά
π¦ Function/Subroutine Documentation π¦
subroutine CGELSD (integer m, integer n, integer nrhs, complex, dimension( lda, * ) a, integer lda, complex, dimension( ldb, * ) b, integer ldb, real, dimension( * ) s, real rcond, integer rank, complex, dimension( * ) work, integer lwork, real, dimension( * ) rwork, integer, dimension( * ) iwork, integer info)
CGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices. πΈ
π Purpose π
okay so CGELSD computes the minimum-norm solution to a real linear least squares problem:
minimize 2-norm(| b - A*x |)
It does this using the singular value decomposition (SVD) of A. A is an M-by-N matrix which may be rank-deficient. π
Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X. β¨
The problem is solved in three steps:
- (1) Reduce the coefficient matrix
Ato bidiagonal form with Householder transformations, reducing the original problem into a(BLS). - (2) Solve the BLS using a divide and conquer approach.
- (3) Apply back all the Householder transformations to solve the original least squares problem.
The effective rank of A is determined by treating as zero those singular values which are less than RCOND times the largest singular value. π
πΈ Parameters πΈ
MβM is INTEGER; the number of rows of the matrixA.M >= 0.NβN is INTEGER; the number of columns of the matrixA.N >= 0.NRHSβNRHS is INTEGER; the number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβA is COMPLEX array, dimension (LDA,N); on entry, theM-by-NmatrixA. On exit,Ahas been destroyed.LDAβLDA is INTEGER; the leading dimension of the arrayA.LDA >= max(1,M).BβB is COMPLEX array, dimension (LDB,NRHS); on entry, theM-by-NRHSright hand side matrixB. On exit,Bis overwritten by theN-by-NRHSsolution matrixX. Ifm >= nandRANK = n, the residual sum-of-squares for the solution in thei-th column is given by the sum of squares of the modulus of elementsn+1:min that column.LDBβLDB is INTEGER; the leading dimension of the arrayB.LDB >= max(1,M,N).SβS is REAL array, dimension (min(M,N)); the singular values ofAin decreasing order. The condition number ofAin the 2-norm =S(1)/S(min(m,n)).RCONDβRCOND is REAL;RCONDis used to determine the effective rank ofA. Singular valuesS(i) <= RCOND*S(1)are treated as zero. IfRCOND < 0, machine precision is used instead.RANKβRANK is INTEGER; the effective rank ofA, i.e., the number of singular values which are greater thanRCOND*S(1).WORKβWORK is COMPLEX array, dimension (MAX(1,LWORK)); on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβLWORK is INTEGER; the dimension of the arrayWORK.LWORKmust be at least 1. The exact minimum amount of workspace needed depends onM,NandNRHS. As long asLWORKis at least
2 * N + N * NRHS
if M is greater than or equal to N or
2 * M + M * NRHS
if M is less than N, the code will execute correctly. For good performance, LWORK should generally be larger.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the array WORK and the minimum sizes of the arrays RWORK and IWORK, and returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK is issued by XERBLA.
RWORKβRWORK is REAL array, dimension (MAX(1,LRWORK));
LRWORK >=
10*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +
MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS )
if M is greater than or equal to N or
LRWORK >=
10*M + 2*M*SMLSIZ + 8*M*NLVL + 3*SMLSIZ*NRHS +
MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS )
if M is less than N, the code will execute correctly. SMLSIZ is returned by ILAENV and is equal to the maximum size of the subproblems at the bottom of the computation tree (usually about 25), and
NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
On exit, if INFO = 0, RWORK(1) returns the minimum LRWORK.
IWORKβIWORK is INTEGER array, dimension (MAX(1,LIWORK));LIWORK >= max(1, 3*MINMN*NLVL + 11*MINMN), whereMINMN = MIN( M,N ). On exit, ifINFO = 0,IWORK(1)returns the minimumLIWORK.INFOβINFO is INTEGER;= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.> 0: the algorithm for computing the SVD failed to converge; ifINFO = i,ioff-diagonal elements of an intermediate bidiagonal form did not converge to zero.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π Contributors π
- Ming Gu and Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA
- Osni Marques, LBNL/NERSC, USA
π Definition at line 217 of file cgelsd.f π
That's where the definition is, bestie: line 217 of cgelsd.f. β¨
π§ Author π§
Generated automatically by Doxygen for LAPACK from the source code.
Source/version: LAPACK Version 3.12.0. Footer date/path line: /home/abui...RC/cgelsd.f(3). Bye bestie, go slay those least squares! π
πβ¨
π¦ 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