SRC/sbbcsd.f(3)
π SRC/sbbcsd.f β¨
okay so bestie, welcome to SRC/sbbcsd.f π β this is a <pink>Library Functions Manual</pink> moment and honestly it's giving main character energy. Sit down, grab a strawberry π, we're doing bidiagonal-block CS decomposition together and it's gonna slay.
β¨ SYNOPSIS β¨
π Functions/Subroutines
subroutine sbbcsd (jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q, theta,
phi, u1, ldu1, u2, ldu2, v1t, ldv1t, v2t, ldv2t, b11d, b11e, b12d,
b12e, b21d, b21e, b22d, b22e, work, lwork, info)
SBBCSD π¦
πΈ Function/Subroutine Documentation πΈ
π the actual subroutine, spelled out
subroutine sbbcsd (character jobu1, character jobu2, character jobv1t,
character jobv2t, character trans, integer m, integer p, integer q,
real, dimension( * ) theta, real, dimension( * ) phi, real, dimension(
ldu1, * ) u1, integer ldu1, real, dimension( ldu2, * ) u2, integer ldu2,
real, dimension( ldv1t, * ) v1t, integer ldv1t, real, dimension( ldv2t,
* ) v2t, integer ldv2t, real, dimension( * ) b11d, real, dimension( * )
b11e, real, dimension( * ) b12d, real, dimension( * ) b12e, real,
dimension( * ) b21d, real, dimension( * ) b21e, real, dimension( * )
b22d, real, dimension( * ) b22e, real, dimension( * ) work, integer
lwork, integer info)
SBBCSD β yeah that's the whole vibe, she's iconic π
π₯ Purpose π₯
ok so SBBCSD computes the CS decomposition of an orthogonal matrix that's in bidiagonal-block form, and the way that it does this is genuinely so satisfying. look at her:
[ B11 | B12 0 0 ]
[ 0 | 0 -I 0 ]
X = [----------------]
[ B21 | B22 0 0 ]
[ 0 | 0 0 I ]
[ C | -S 0 0 ]
[ U1 | ] [ 0 | 0 -I 0 ] [ V1 | ]**T
= [---------] [---------------] [---------] .
[ | U2 ] [ S | C 0 0 ] [ | V2 ]
[ 0 | 0 0 I ]
so X is M-by-M, its top-left block is P-by-Q, and Q must be no larger than P, M-P, or M-Q β no negotiations on that one bestie π (if Q is not the smallest index, then X must be transposed and/or permuted. this can be done in constant time using the TRANS and SIGNS options. see SORCSD for details.)
the bidiagonal matrices B11, B12, B21, and B22 are represented implicitly by angles THETA(1:Q) and PHI(1:Q-1) β¨
the orthogonal matrices U1, U2, V1T, and V2T are input/output. the input matrices are pre- or post-multiplied by the appropriate singular vector matrices. it's giving teamwork, fr fr π«Ά
π Parameters π
JOBU1β isCHARACTER.= 'Y':U1is updated; otherwise:U1is not updated.JOBU2β isCHARACTER.= 'Y':U2is updated; otherwise:U2is not updated.JOBV1Tβ isCHARACTER.= 'Y':V1Tis updated; otherwise:V1Tis not updated.JOBV2Tβ isCHARACTER.= 'Y':V2Tis updated; otherwise:V2Tis not updated.TRANSβ isCHARACTER.= 'T':X,U1,U2,V1T, andV2Tare stored in row-major order; otherwise:X,U1,U2,V1T, andV2Tare stored in column-major order.Mβ isINTEGER. the number of rows and columns inX, the orthogonal matrix in bidiagonal-block form.Pβ isINTEGER. the number of rows in the top-left block ofX.0 <= P <= M.Qβ isINTEGER. the number of columns in the top-left block ofX.0 <= Q <= MIN(P,M-P,M-Q).THETAβ isREAL array, dimension (Q). on entry, the anglesTHETA(1),...,THETA(Q)that, along withPHI(1), ...,PHI(Q-1), define the matrix in bidiagonal-block form. on exit, the angles whose cosines and sines define the diagonal blocks in the CS decomposition. glow-up incoming π«PHIβ isREAL array, dimension (Q-1). the anglesPHI(1),...,PHI(Q-1)that, along withTHETA(1),...,THETA(Q), define the matrix in bidiagonal-block form.U1β isREAL array, dimension (LDU1,P). on entry, aP-by-Pmatrix. on exit,U1is postmultiplied by the left singular vector matrix common to[ B11 ; 0 ]and[ B12 0 0 ; 0 -I 0 0 ].LDU1β isINTEGER. the leading dimension of the arrayU1,LDU1 >= MAX(1,P). respect the leading dimension, she's load-bearing πU2β isREAL array, dimension (LDU2,M-P). on entry, an(M-P)-by-(M-P)matrix. on exit,U2is postmultiplied by the left singular vector matrix common to[ B21 ; 0 ]and[ B22 0 0 ; 0 0 I ].LDU2β isINTEGER. the leading dimension of the arrayU2,LDU2 >= MAX(1,M-P).V1Tβ isREAL array, dimension (LDV1T,Q). on entry, aQ-by-Qmatrix. on exit,V1Tis premultiplied by the transpose of the right singular vector matrix common to[ B11 ; 0 ]and[ B21 ; 0 ].LDV1Tβ isINTEGER. the leading dimension of the arrayV1T,LDV1T >= MAX(1,Q).V2Tβ isREAL array, dimension (LDV2T,M-Q). on entry, an(M-Q)-by-(M-Q)matrix. on exit,V2Tis premultiplied by the transpose of the right singular vector matrix common to[ B12 0 0 ; 0 -I 0 0 ]and[ B22 0 0 ; 0 0 I ].LDV2Tβ isINTEGER. the leading dimension of the arrayV2T,LDV2T >= MAX(1,M-Q).B11Dβ isREAL array, dimension (Q). whenSBBCSDconverges,B11Dcontains the cosines ofTHETA(1), ..., THETA(Q). ifSBBCSDfails to converge, thenB11Dcontains the diagonal of the partially reduced top-left block. π the failure case is real, note it.B11Eβ isREAL array, dimension (Q-1). whenSBBCSDconverges,B11Econtains zeros. ifSBBCSDfails to converge, thenB11Econtains the superdiagonal of the partially reduced top-left block.B12Dβ isREAL array, dimension (Q). whenSBBCSDconverges,B12Dcontains the negative sines ofTHETA(1), ..., THETA(Q). ifSBBCSDfails to converge, thenB12Dcontains the diagonal of the partially reduced top-right block.B12Eβ isREAL array, dimension (Q-1). whenSBBCSDconverges,B12Econtains zeros. ifSBBCSDfails to converge, thenB12Econtains the subdiagonal of the partially reduced top-right block.B21Dβ isREAL array, dimension (Q). whenSBBCSDconverges,B21Dcontains the negative sines ofTHETA(1), ..., THETA(Q). ifSBBCSDfails to converge, thenB21Dcontains the diagonal of the partially reduced bottom-left block.B21Eβ isREAL array, dimension (Q-1). whenSBBCSDconverges,B21Econtains zeros. ifSBBCSDfails to converge, thenB21Econtains the subdiagonal of the partially reduced bottom-left block.B22Dβ isREAL array, dimension (Q). whenSBBCSDconverges,B22Dcontains the negative sines ofTHETA(1), ..., THETA(Q). ifSBBCSDfails to converge, thenB22Dcontains the diagonal of the partially reduced bottom-right block.B22Eβ isREAL array, dimension (Q-1). whenSBBCSDconverges,B22Econtains zeros. ifSBBCSDfails to converge, thenB22Econtains the subdiagonal of the partially reduced bottom-right block.WORKβ isREAL array, dimension (MAX(1,LWORK)). on exit, ifINFO = 0,WORK(1)returns the optimalLWORK. πLWORKβ isINTEGER. the dimension of the arrayWORK.LWORK >= MAX(1,8*Q).
if LWORK = -1, then a workspace query is assumed β the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the work array, and no error message related to LWORK is issued by XERBLA. it's giving "just checking the size bestie, no drama" π
INFOβ isINTEGER.= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.> 0: ifSBBCSDdid not converge,INFOspecifies the number of nonzero entries inPHI, andB11D,B11E, etc., contain the partially reduced matrix. π«Ά heads up, this one matters.
π§ Internal Parameters π§
TOLMULβREAL, default = MAX(10,MIN(100,EPS**(-1/8))).TOLMULcontrols the convergence criterion of the QR loop. anglesTHETA(i),PHI(i)are rounded to0orPI/2when they are withinTOLMUL*EPSof either bound. lowkey the most important little guy in the whole routine ngl π
π References π
- Brian D. Sutton. Computing the complete CS decomposition. Numer. Algorithms, 50(1):33-65, 2009.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 328 of file sbbcsd.f. π
π Author (of this page) π
Generated automatically by Doxygen for LAPACK from the source code. yeah she was auto-generated and she still ate π
and that's the whole page bestie β LAPACK, Version 3.12.0, dated SRC/sbbcsd.f(3). go forth and decompose those bidiagonal blocks, ily, bye πβ¨π
π¦ 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