SRC/dgelsd.f(3)
okay so welcome to the SRC/dgelsd.f(3) page in the Library Functions Manual, bestie π
β¨ this one is all about a Fortran subroutine getting its SVD least-squares moment, and honestly it's giving main character energy.
π NAME π
SRC/dgelsd.fβ that's the name, periodt. (Also: yes, this is theSRC/dgelsd.f(3)page π«Ά)
π SYNOPSIS π
π¦ Functions/Subroutines π¦
subroutine dgelsdβ the call looks like this exactly:
subroutine dgelsd (m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work,
lwork, iwork, info)
DGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices β¨
π Function/Subroutine Documentation π
β¨ subroutine dgelsd β¨
Full signature, exact:
subroutine dgelsd (integer m, integer n, integer nrhs, double precision,
dimension( lda, * ) a, integer lda, double precision, dimension( ldb, *
) b, integer ldb, double precision, dimension( * ) s, double precision
rcond, integer rank, double precision, dimension( * ) work, integer
lwork, integer, dimension( * ) iwork, integer info)
DGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices π
πΈ Purpose πΈ
okay so here's the actual goal, bestie: DGELSD computes the minimum-norm solution to a real linear least squares problem:
minimize 2-norm(| b - A*x |)
using the singular value decomposition (SVD) of A. A is an M-by-N matrix which may be rank-deficient. no cap.
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:
- Reduce the coefficient matrix
Ato bidiagonal form with Householder transformations, reducing the original problem into a (BLS). - Solve the BLS using a divide and conquer approach.
- 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 ofA.M >= 0. πΈNβN is INTEGER. The number of columns ofA.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 DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrixA. On exit,Ahas been destroyed. πLDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). β¨BβB is DOUBLE PRECISION array, dimension (LDB,NRHS). On entry, the M-by-NRHS right hand side matrixB. On exit,Bis overwritten by the N-by-NRHS solution matrixX. Ifm >= nandRANK = n, the residual sum-of-squares for the solution in the i-th column is given by the sum of squares of elementsn+1:min that column. π₯LDBβLDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,max(M,N)). π¦SβS is DOUBLE PRECISION 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 DOUBLE PRECISION.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 DOUBLE PRECISION 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 least12*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2,ifMis greater than or equal toNor12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2,ifMis less thanN, the code will execute correctly.SMLSIZis returned byILAENVand is equal to the maximum size of the subproblems at the bottom of the computation tree (usually about 25), andNLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 ). For good performance,LWORKshould generally be larger. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. π«Ά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: if INFO = -i, the i-th argument had an illegal value.
> 0: the algorithm for computing the SVD failed to converge;
if INFO = i, i off-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 201 of file dgelsd.f. π
π«Ά Author π«Ά
Generated automatically by Doxygen for LAPACK from the source code. β¨
and that's the whole page, bestie β footer/source/version sign-off: LAPACK, Version 3.12.0, SRC/dgelsd.f(3). πππ¦
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms