lalsd(3)

πŸŽ€ NAME πŸŽ€

lalsd β€” uses SVD for least squares, step in gelsd


✨ SYNOPSIS ✨

Functions

  • clalsd β€” subroutine clalsd (uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, rwork, iwork, info) CLALSD uses the singular value decomposition of A to solve the least squares problem.
  • dlalsd β€” subroutine dlalsd (uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, iwork, info) DLALSD uses the singular value decomposition of A to solve the least squares problem.
  • slalsd β€” subroutine slalsd (uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, iwork, info) SLALSD uses the singular value decomposition of A to solve the least squares problem.
  • zlalsd β€” subroutine zlalsd (uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, rwork, iwork, info) ZLALSD uses the singular value decomposition of A to solve the least squares problem.

🌸 Detailed Description 🌸

Like, the vibe here is: this page has so much going on, bestie, and it's all the same four subroutines but in different precisions. We love a consistent queen πŸ’…

πŸ¦‹ Function Documentation πŸ¦‹


πŸ’œ subroutine clalsd (character uplo, integer smlsiz, integer n, integer nrhs, real, dimension( * ) d, real, dimension( * ) e, complex, dimension( ldb, * ) b, integer ldb, real rcond, integer rank, complex, dimension( * ) work, real, dimension( * ) rwork, integer, dimension( * ) iwork, integer info) πŸ’œ

CLALSD uses the singular value decomposition of A to solve the least squares problem.

πŸ”₯ Purpose

CLALSD uses the singular value decomposition of A to solve the least squares problem of finding X to minimize the Euclidean norm of each column of A*X-B, where A is N-by-N upper bidiagonal, and X and B are N-by-NRHS. The solution X overwrites B. The singular values of A smaller than RCOND times the largest singular value are treated as zero in solving the least squares problem; in this case a minimum norm solution is returned. The actual singular values are returned in D in ascending order.

Okay so like, rephrase for the girlies: you hand it a bidiagonal A, it hands you back the X that's least-squares-closest, and it straight up overwrites B with the answer. Rude? A little. Iconic? Also yes. πŸ’€

🌈 Parameters

  • UPLO β€” UPLO is CHARACTER*1
    • = 'U': D and E define an upper bidiagonal matrix.
    • = 'L': D and E define a lower bidiagonal matrix.
  • SMLSIZ β€” SMLSIZ is INTEGER The maximum size of the subproblems at the bottom of the computation tree.
  • N β€” N is INTEGER The dimension of the bidiagonal matrix. N >= 0.
  • NRHS β€” NRHS is INTEGER The number of columns of B. NRHS must be at least 1.
  • D β€” D is REAL array, dimension (N) On entry D contains the main diagonal of the bidiagonal matrix. On exit, if INFO = 0, D contains its singular values.
  • E β€” E is REAL array, dimension (N-1) Contains the super-diagonal entries of the bidiagonal matrix. On exit, E has been destroyed.
  • B β€” B is COMPLEX array, dimension (LDB,NRHS) On input, B contains the right hand sides of the least squares problem. On output, B contains the solution X.
  • LDB β€” LDB is INTEGER The leading dimension of B in the calling subprogram. LDB must be at least max(1,N).
  • RCOND β€” RCOND is REAL The singular values of A less than or equal to RCOND times the largest singular value are treated as zero in solving the least squares problem. If RCOND is negative, machine precision is used instead. For example, if diag(S)*X=B were the least squares problem, where diag(S) is a diagonal matrix of singular values, the solution would be X(i) = B(i) / S(i) if S(i) is greater than RCOND*max(S), and X(i) = 0 if S(i) is less than or equal to RCOND*max(S).
  • RANK β€” RANK is INTEGER The number of singular values of A greater than RCOND times the largest singular value.
  • WORK β€” WORK is COMPLEX array, dimension (N * NRHS).
  • RWORK β€” RWORK is REAL array, dimension at least
(9*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +
MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS ),
where
NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
  • IWORK β€” IWORK is INTEGER array, dimension (3*N*NLVL + 11*N).
  • INFO β€” INFO is INTEGER
= 0:  successful exit.
< 0:  if INFO = -i, the i-th argument had an illegal value.
> 0:  The algorithm failed to compute a singular value while
      working on the submatrix lying in rows and columns
      INFO/(N+1) through MOD(INFO,N+1).
ngl bestie, that > 0 case is the algorithm tapping out mid-submatrix β€” it's giving "I tried, I really did" 😭

πŸ‘‘ 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 178 of file clalsd.f.


πŸ’– subroutine dlalsd (character uplo, integer smlsiz, integer n, integer nrhs, double precision, dimension( * ) d, double precision, dimension( * ) e, double precision, dimension( ldb, * ) b, integer ldb, double precision rcond, integer rank, double precision, dimension( * ) work, integer, dimension( * ) iwork, integer info) πŸ’–

DLALSD uses the singular value decomposition of A to solve the least squares problem.

πŸ”₯ Purpose

DLALSD uses the singular value decomposition of A to solve the least squares problem of finding X to minimize the Euclidean norm of each column of A*X-B, where A is N-by-N upper bidiagonal, and X and B are N-by-NRHS. The solution X overwrites B. The singular values of A smaller than RCOND times the largest singular value are treated as zero in solving the least squares problem; in this case a minimum norm solution is returned. The actual singular values are returned in D in ascending order.

Same energy as her complex sister up there, just double precision. She said "I'll do it, and I'll do it in DOUBLE PRECISION" ✨

🌈 Parameters

  • UPLO β€” UPLO is CHARACTER*1
    • = 'U': D and E define an upper bidiagonal matrix.
    • = 'L': D and E define a lower bidiagonal matrix.
  • SMLSIZ β€” SMLSIZ is INTEGER The maximum size of the subproblems at the bottom of the computation tree.
  • N β€” N is INTEGER The dimension of the bidiagonal matrix. N >= 0.
  • NRHS β€” NRHS is INTEGER The number of columns of B. NRHS must be at least 1.
  • D β€” D is DOUBLE PRECISION array, dimension (N) On entry D contains the main diagonal of the bidiagonal matrix. On exit, if INFO = 0, D contains its singular values.
  • E β€” E is DOUBLE PRECISION array, dimension (N-1) Contains the super-diagonal entries of the bidiagonal matrix. On exit, E has been destroyed.
  • B β€” B is DOUBLE PRECISION array, dimension (LDB,NRHS) On input, B contains the right hand sides of the least squares problem. On output, B contains the solution X.
  • LDB β€” LDB is INTEGER The leading dimension of B in the calling subprogram. LDB must be at least max(1,N).
  • RCOND β€” RCOND is DOUBLE PRECISION The singular values of A less than or equal to RCOND times the largest singular value are treated as zero in solving the least squares problem. If RCOND is negative, machine precision is used instead. For example, if diag(S)*X=B were the least squares problem, where diag(S) is a diagonal matrix of singular values, the solution would be X(i) = B(i) / S(i) if S(i) is greater than RCOND*max(S), and X(i) = 0 if S(i) is less than or equal to RCOND*max(S).
  • RANK β€” RANK is INTEGER The number of singular values of A greater than RCOND times the largest singular value.
  • WORK β€” WORK is DOUBLE PRECISION array, dimension at least
(9*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2),
where NLVL = max(0, INT(log_2 (N/(SMLSIZ+1))) + 1).
  • IWORK β€” IWORK is INTEGER array, dimension at least
(3*N*NLVL + 11*N)
  • INFO β€” INFO is INTEGER
= 0:  successful exit.
< 0:  if INFO = -i, the i-th argument had an illegal value.
> 0:  The algorithm failed to compute a singular value while
      working on the submatrix lying in rows and columns
      INFO/(N+1) through MOD(INFO,N+1).

πŸ‘‘ 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 171 of file dlalsd.f.


πŸ“ subroutine slalsd (character uplo, integer smlsiz, integer n, integer nrhs, real, dimension( * ) d, real, dimension( * ) e, real, dimension( ldb, * ) b, integer ldb, real rcond, integer rank, real, dimension( * ) work, integer, dimension( * ) iwork, integer info) πŸ“

SLALSD uses the singular value decomposition of A to solve the least squares problem.

πŸ”₯ Purpose

Okay so this is the real-precision one, and bestie β€” this is exactly where part one of the page cuts off 🫢 her purpose block continues in part two, so hold that thought, don't go anywhere πŸ’…

πŸ’– Parameters (the slaysd roster)

Bestie. Every single one of these is a real argument and you will pass them in this order, okay? No vibes-based argument shuffling. ✨

  • UPLO β€” UPLO is CHARACTER*1. It tells the routine which way your bidiagonal matrix is leaning, and there are exactly two moods:
    • 'U': D and E define an upper bidiagonal matrix.
    • 'L': D and E define a lower bidiagonal matrix.
  • SMLSIZ β€” SMLSIZ is INTEGER. The maximum size of the subproblems at the bottom of the computation tree. It's giving "how small do we chop things before we stop chopping". πŸͺ“
  • N β€” N is INTEGER. The dimension of the bidiagonal matrix. Constraint, and it is not optional: N >= 0.
  • NRHS β€” NRHS is INTEGER. The number of columns of B. NRHS must be at least 1 β€” zero columns is not a personality, it's an error.
  • D β€” D is REAL array, dimension (N). On entry D contains the main diagonal of the bidiagonal matrix. On exit, if INFO = 0, D contains its singular values. Glow-up arc, honestly. ✨
  • E β€” E is REAL array, dimension (N-1). Contains the super-diagonal entries of the bidiagonal matrix. On exit, E has been destroyed. πŸ’€ Yeah. She does not survive the function. This is normal. Do not come for her.
  • B β€” B is REAL array, dimension (LDB,NRHS). On input, B contains the right hand sides of the least squares problem. On output, B contains the solution X. She gets overwritten with the answer, main character behavior only. πŸ‘‘
  • LDB β€” LDB is INTEGER. The leading dimension of B in the calling subprogram. LDB must be at least max(1,N).
  • RCOND β€” RCOND is REAL. The singular values of A less than or equal to RCOND times the largest singular value are treated as zero in solving the least squares problem. If RCOND is negative, machine precision is used instead. Concretely: if diag(S)*X=B were the least squares problem, where diag(S) is a diagonal matrix of singular values, the solution would be X(i) = B(i) / S(i) if S(i) is greater than RCOND*max(S), and X(i) = 0 if S(i) is less than or equal to RCOND*max(S). Tiny singular value? Straight to zero. Not sorry. πŸ’…
  • RANK β€” RANK is INTEGER. The number of singular values of A greater than RCOND times the largest singular value. i.e. how many of them actually made the cut.
  • WORK β€” WORK is REAL array, dimension at least
(9*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2),

where

NLVL = max(0, INT(log_2 (N/(SMLSIZ+1))) + 1).

Do not guess this size. Do not "eyeball it". She will take you out. πŸ™ˆ

  • IWORK β€” IWORK is INTEGER array, dimension at least
(3*N*NLVL + 11*N)
  • INFO β€” INFO is INTEGER, the vibe report:
    • = 0: successful exit. πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value. You passed something cursed.
    • > 0: The algorithm failed to compute a singular value while working on the submatrix lying in rows and columns INFO/(N+1) through MOD(INFO,N+1). Not your fault, but like… it happened.

🌈 subroutine zlalsd

Okay now the complex twin, and yes she is literally the same girl in a different outfit. Here's the whole signature, character for character:

subroutine zlalsd (character uplo, integer smlsiz, integer n, integer nrhs,
    double precision, dimension( * ) d, double precision, dimension( * ) e,
    complex*16, dimension( ldb, * ) b, integer ldb, double precision rcond,
    integer rank, complex*16, dimension( * ) work, double precision,
    dimension( * ) rwork, integer, dimension( * ) iwork, integer info)

ZLALSD uses the singular value decomposition of A to solve the least squares problem.

Purpose (the why, the lore) πŸ¦‹

!>
!> ZLALSD uses the singular value decomposition of A to solve the least
!> squares problem of finding X to minimize the Euclidean norm of each
!> column of A*X-B, where A is N-by-N upper bidiagonal, and X and B
!> are N-by-NRHS. The solution X overwrites B.
!>
!> The singular values of A smaller than RCOND times the largest
!> singular value are treated as zero in solving the least squares
!> problem; in this case a minimum norm solution is returned.
!> The actual singular values are returned in D in ascending order.
!>
!>

Ascending order singular values, minimum norm solution when things get zeroed out β€” that's the whole plot. ✨

Parameters ✨

Same energy, slightly different types. Watch the DOUBLE PRECISION and COMPLEX*16, bestie, they are not interchangeable with the real version. πŸŽ€

  • UPLO β€” UPLO is CHARACTER*1. Again, two options only:
    • 'U': D and E define an upper bidiagonal matrix.
    • 'L': D and E define a lower bidiagonal matrix.
  • SMLSIZ β€” SMLSIZ is INTEGER. The maximum size of the subproblems at the bottom of the computation tree.
  • N β€” N is INTEGER. The dimension of the bidiagonal matrix. N >= 0.
  • NRHS β€” NRHS is INTEGER. The number of columns of B. NRHS must be at least 1.
  • D β€” D is DOUBLE PRECISION array, dimension (N). On entry D contains the main diagonal of the bidiagonal matrix. On exit, if INFO = 0, D contains its singular values.
  • E β€” E is DOUBLE PRECISION array, dimension (N-1). Contains the super-diagonal entries of the bidiagonal matrix. On exit, E has been destroyed. Rip in peace, same as always. πŸ’€
  • B β€” B is COMPLEX*16 array, dimension (LDB,NRHS). On input, B contains the right hand sides of the least squares problem. On output, B contains the solution X.
  • LDB β€” LDB is INTEGER. The leading dimension of B in the calling subprogram. LDB must be at least max(1,N).
  • RCOND β€” RCOND is DOUBLE PRECISION. The singular values of A less than or equal to RCOND times the largest singular value are treated as zero in solving the least squares problem. If RCOND is negative, machine precision is used instead. Exact same deal as before: if diag(S)*X=B were the least squares problem, where diag(S) is a diagonal matrix of singular values, the solution would be X(i) = B(i) / S(i) if S(i) is greater than RCOND*max(S), and X(i) = 0 if S(i) is less than or equal to RCOND*max(S).
  • RANK β€” RANK is INTEGER. The number of singular values of A greater than RCOND times the largest singular value.
  • WORK β€” WORK is COMPLEX*16 array, dimension (N * NRHS). Tiny queen, love that for her. 🫢
  • RWORK β€” RWORK is DOUBLE PRECISION array, dimension at least
(9*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +
MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS ),

where

NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )

⚠️ Heads up: RWORK carries the big scary formula here, and yes it literally says MIN( M,N ) in that NLVL line even though M isn't one of the arguments β€” copy it exactly as written, don't get creative and "fix" it. Lowkey important.

  • IWORK β€” IWORK is INTEGER array, dimension at least
(3*N*NLVL + 11*N).
  • INFO β€” INFO is INTEGER, the tell-all:
    • = 0: successful exit. 🌸
    • < 0: if INFO = -i, the i-th argument had an illegal value.
    • > 0: The algorithm failed to compute a singular value while working on the submatrix lying in rows and columns INFO/(N+1) through MOD(INFO,N+1).

πŸ‘‘ 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

slalsd lives at definition at line 171 of file slalsd.f. zlalsd is at definition at line 179 of file zlalsd.f. Two files, two icons, one bidiagonal destiny. πŸ’œ


πŸŽ€ Author (the meta one)

Generated automatically by Doxygen for LAPACK from the source code. Not a human, not a vibe-haver, just a doc generator doing her thing. πŸ€–


That's the whole page, bestie β€” you ate. LAPACK, Version 3.12.0, lalsd(3) β€” go forth and solve those least squares problems, and remember: pass WORK the right size or it's on you. πŸ’…βœ¨πŸ¦‹
πŸ“¦ where this page comes from