OTHERauxiliary(3)
OTHERauxiliary(3) ๐
LAPACK โ like, the actual LAPACK manual, bestie, we're doing this
โจ NAME โจ
OTHERauxiliary โ Other Auxiliary Routines ๐ฆ
Okay so real talk: this is the lil grab-bag corner of LAPACK where all the other auxiliary routines live. Not the main-character factorization girls, not the eigenvalue icons โ the other ones. The support squad. The backbone. The ones who hold the whole vibe together and never get a shoutout. We see them tho. ๐
๐ธ SYNOPSIS ๐ธ
๐ Modules
The routines in here are split across four modules, one per data type, because LAPACK does not do the whole "just use one generic type and figure it out" thing. No cap. Each flavor gets its own module:
doubleโ ๐ the double precision real ones, i.e. theDroutines, living their best 64-bit liferealโ ๐ธ the single precision real ones, theSgirls, floatin' along at 32 bitscomplexโ โจ the single precision complex ones, theCcrew, imaginary parts included, no extra chargecomplex16โ ๐ฆ the double precision complex ones, theZicons, 128 bits of pure main character energy
and yes, that's it for this part โ more sections coming, don't go anywhere bestie ๐
โจ Functions โจ
okay bestie, here's the whole function lineup. every single one, no skips, periodt. let's go ๐
logical function disnan (DIN)โ DISNAN tests input for NaN. it's literally checking if your number is Not a Number, bestie. detective energy ๐ต๏ธโโ๏ธโจsubroutine dlabad (SMALL, LARGE)โ DLABAD. that's it. that's the whole manpage. iconic minimalism, no notes ๐subroutine dlacpy (UPLO, M, N, A, LDA, B, LDB)โ DLACPY copies all or part of one two-dimensional array to another. copy-paste but make it linear algebra โจsubroutine dlae2 (A, B, C, RT1, RT2)โ DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. small matrix, big main character energy ๐subroutine dlaebz (IJOB, NITMAX, N, MMAX, MINP, NBMIN, ABSTOL, RELTOL, PIVMIN, D, E, E2, NVAL, AB, C, MOUT, NAB, WORK, IWORK, INFO)โ DLAEBZ computes the number of eigenvalues of a real symmetric tridiagonal matrix which are less than or equal to a given value, and performs other tasks required by the routinesstebz. it's the backstage crew forsstebz, fr fr ๐ญsubroutine dlaev2 (A, B, C, RT1, RT2, CS1, SN1)โ DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. overachiever vibes ๐subroutine dlagts (JOB, N, A, B, C, D, IN, Y, TOL, INFO)โ DLAGTS solves the system of equations(T-ฮปI)x = yor(T-ฮปI)Tx = y,where T is a general tridiagonal matrix and ฮป a scalar, using the LU factorization computed byslagtf. math girlies, we love a solver ๐logical function dlaisnan (DIN1, DIN2)โ DLAISNAN tests input for NaN by comparing two arguments for inequality. it's like "are these two not the same? then one might be NaN" ๐คinteger function dlaneg (N, D, LLD, SIGMA, PIVMIN, R)โ DLANEG computes the Sturm count. that's it, that's the tweet ๐ฆdouble precision function dlanst (NORM, N, D, E)โ DLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix. norm buffet, pick your fave โจdouble precision function dlapy2 (X, Y)โ DLAPY2 returns sqrt(x2+y2). Pythagorean theorem but make it double precision ๐double precision function dlapy3 (X, Y, Z)โ DLAPY3 returns sqrt(x2+y2+z2). 3D Pythagoras, no cap ๐งdouble precision function dlarmm (ANORM, BNORM, CNORM)โ DLARMM. again, just the name. we love a mysterious king ๐subroutine dlarnv (IDIST, ISEED, N, X)โ DLARNV returns a vector of random numbers from a uniform or normal distribution. rng but for your linear algebra era ๐ฒsubroutine dlarra (N, D, E, E2, SPLTOL, TNRM, NSPLIT, ISPLIT, INFO)โ DLARRA computes the splitting points with the specified threshold. splitting? we're breaking up the matrix, not the friendship ๐ซถsubroutine dlarrb (N, D, LLD, IFIRST, ILAST, RTOL1, RTOL2, OFFSET, W, WGAP, WERR, WORK, IWORK, PIVMIN, SPDIAM, TWIST, INFO)โ DLARRB provides limited bisection to locate eigenvalues for more accuracy. it's giving "we need more precision, bestie" ๐ฏsubroutine dlarrc (JOBT, N, VL, VU, D, E, PIVMIN, EIGCNT, LCNT, RCNT, INFO)โ DLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. just the number, not the vibes ๐subroutine dlarrd (RANGE, ORDER, N, VL, VU, IL, IU, GERS, RELTOL, D, E, E2, PIVMIN, NSPLIT, ISPLIT, M, W, WERR, WL, WU, IBLOCK, INDEXW, WORK, IWORK, INFO)โ DLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy. "suitable" is doing a lot of heavy lifting but okay ๐subroutine dlarre (RANGE, N, VL, VU, IL, IU, D, E, E2, RTOL1, RTOL2, SPLTOL, NSPLIT, ISPLIT, M, W, WERR, WGAP, IBLOCK, INDEXW, GERS, PIVMIN, WORK, IWORK, INFO)โ DLARRE given the tridiagonal matrix T, sets small off-diagonal elements to zero and for each unreduced block Ti, finds base representations and eigenvalues. it's giving cleanup crew + finder of truth โจsubroutine dlarrf (N, D, L, LD, CLSTRT, CLEND, W, WGAP, WERR, SPDIAM, CLGAPL, CLGAPR, PIVMIN, SIGMA, DPLUS, LPLUS, WORK, INFO)โ DLARRF finds a new relatively robust representation such that at least one of the eigenvalues is relatively isolated. it's like giving one eigenvalue its own personal space ๐งโโ๏ธsubroutine dlarrj (N, D, E2, IFIRST, ILAST, RTOL, OFFSET, W, WERR, WORK, IWORK, PIVMIN, SPDIAM, INFO)โ DLARRJ performs refinement of the initial estimates of the eigenvalues of the matrix T. glow-up for numbers ๐subroutine dlarrk (N, IW, GL, GU, D, E2, PIVMIN, RELTOL, W, WERR, INFO)โ DLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. just one. singular focus, main character energy ๐subroutine dlarrr (N, D, E, INFO)โ DLARRR performs tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. it's the "is it worth it?" routine ๐ธsubroutine dlartgp (F, G, CS, SN, R)โ DLARTGP generates a plane rotation so that the diagonal is nonnegative. positive vibes only โจsubroutine dlaruv (ISEED, N, X)โ DLARUV returns a vector of n random real numbers from a uniform distribution. more random, but make it uniform ๐ฒsubroutine dlas2 (F, G, H, SSMIN, SSMAX)โ DLAS2 computes singular values of a 2-by-2 triangular matrix. tiny matrix, big SVD energy ๐subroutine dlascl (TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)โ DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom. scaling? we love a glow-up ๐subroutine dlasd0 (N, SQRE, D, E, U, LDU, VT, LDVT, SMLSIZ, IWORK, WORK, INFO)โ DLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e. Used bysbdsdc. it's the SVD plug ๐subroutine dlasd1 (NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO)โ DLASD1 computes the SVD of an upper bidiagonal matrix B of the specified size. Used bysbdsdc. another SVD baddie ๐subroutine dlasd2 (NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT, LDVT, DSIGMA, U2, LDU2, VT2, LDVT2, IDXP, IDX, IDXC, IDXQ, COLTYP, INFO)โ DLASD2 merges the two sets of singular values together into a single sorted set. Used bysbdsdc. it's giving merge sort but for singular values ๐งฌsubroutine dlasd3 (NL, NR, SQRE, K, D, Q, LDQ, DSIGMA, U, LDU, U2, LDU2, VT, LDVT, VT2, LDVT2, IDXC, CTOT, Z, INFO)โ DLASD3 finds all square roots of the roots of the secular equation, as defined by the values in D and Z, and then updates the singular vectors by matrix multiplication. Used bysbdsdc. math girlies, we love a secular equation ๐subroutine dlasd4 (N, I, D, Z, DELTA, RHO, SIGMA, WORK, INFO)โ DLASD4 computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix. Used bydbdsdc. that's a mouthful but we respect it ๐subroutine dlasd5 (I, D, Z, DELTA, RHO, DSIGMA, WORK)โ DLASD5 computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix. Used bysbdsdc. tiny matrix, big math โจsubroutine dlasd6 (ICOMPQ, NL, NR, SQRE, D, VF, VL, ALPHA, BETA, IDXQ, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, POLES, DIFL, DIFR, Z, K, C, S, WORK, IWORK, INFO)โ DLASD6 computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used bysbdsdc. it's the merge-and-append queen ๐subroutine dlasd7 (ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL, VLW, ALPHA, BETA, DSIGMA, IDX, IDXP, IDXQ, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, C, S, INFO)โ DLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. Used bysbdsdc. shrinkflation but make it math ๐subroutine dlasd8 (ICOMPQ, K, D, Z, VF, VL, DIFL, DIFR, LDDIFR, DSIGMA, WORK, INFO)โ DLASD8 finds the square roots of the roots of the secular equation, and stores, for each element in D, the distance to its two nearest poles. Used bysbdsdc. it's giving pole proximity awareness ๐subroutine dlasda (ICOMPQ, SMLSIZ, N, SQRE, D, E, U, LDU, VT, K, DIFL, DIFR, Z, POLES, GIVPTR, GIVCOL, LDGCOL, PERM, GIVNUM, C, S, WORK, IWORK, INFO)โ DLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonal d and off-diagonal e. Used bysbdsdc. the whole SVD experience โจsubroutine dlasdq (UPLO, SQRE, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, WORK, INFO)โ DLASDQ computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e. Used bysbdsdc. bidiagonal, but make it SVD ๐subroutine dlasdt (N, LVL, ND, INODE, NDIML, NDIMR, MSUB)โ DLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used bysbdsdc. divide and conquer, but tree-shaped ๐ณsubroutine dlaset (UPLO, M, N, ALPHA, BETA, A, LDA)โ DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values. setting the vibe of your matrix ๐subroutine dlasr (SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA)โ DLASR applies a sequence of plane rotations to a general rectangular matrix. spinning those vectors โจsubroutine dlasv2 (F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL)โ DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix. tiny but mighty ๐integer function ieeeck (ISPEC, ZERO, ONE)โ IEEECK. just the name. mysterious and iconic ๐integer function iladlc (M, N, A, LDA)โ ILADLC scans a matrix for its last non-zero column. it's giving "where does the party end?" ๐integer function iladlr (M, N, A, LDA)โ ILADLR scans a matrix for its last non-zero row. same energy, but rows ๐integer function ilaenv (ISPEC, NAME, OPTS, N1, N2, N3, N4)โ ILAENV. just the name. we love a mystery ๐integer function ilaenv2stage (ISPEC, NAME, OPTS, N1, N2, N3, N4)โ ILAENV2STAGE. also just the name. the sequel we didn't know we needed ๐integer function iparmq (ISPEC, NAME, OPTS, N, ILO, IHI, LWORK)โ IPARMQ. just the name. periodt ๐logical function lsamen (N, CA, CB)โ LSAMEN. just the name. iconic ๐logical function sisnan (SIN)โ SISNAN tests input for NaN. single precision version of the NaN detective ๐ต๏ธโโ๏ธsubroutine slabad (SMALL, LARGE)โ SLABAD. just the name. we stan a minimal description ๐subroutine slacpy (UPLO, M, N, A, LDA, B, LDB)โ SLACPY copies all or part of one two-dimensional array to another. copy-paste but single precision โจsubroutine slae2 (A, B, C, RT1, RT2)โ SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. small matrix, big slay ๐subroutine slaebz (IJOB, NITMAX, N, MMAX, MINP, NBMIN, ABSTOL, RELTOL, PIVMIN, D, E, E2, NVAL, AB, C, MOUT, NAB, WORK, IWORK, INFO)โ SLAEBZ computes the number of eigenvalues of a real symmetric tridiagonal matrix which are less than or equal to a given value, and performs other tasks required by the routinesstebz. the single precision twin ๐subroutine slaev2 (A, B, C, RT1, RT2, CS1, SN1)โ SLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. overachiever, single precision edition ๐subroutine slag2d (M, N, SA, LDSA, A, LDA, INFO)โ SLAG2D converts a single precision matrix to a double precision matrix. glow-up from float to double โจsubroutine slagts (JOB, N, A, B, C, D, IN, Y, TOL, INFO)โ SLAGTS solves the system of equations(T-ฮปI)x = yor(T-ฮปI)Tx = y,where T is a general tridiagonal matrix and ฮป a scalar, using the LU factorization computed byslagtf. single precision solver ๐logical function slaisnan (SIN1, SIN2)โ SLAISNAN tests input for NaN by comparing two arguments for inequality. single precision NaN check ๐คinteger function slaneg (N, D, LLD, SIGMA, PIVMIN, R)โ SLANEG computes the Sturm count. single precision Sturm count ๐real function slanst (NORM, N, D, E)โ SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix. norm buffet, single precision โจreal function slapy2 (X, Y)โ SLAPY2 returns sqrt(x2+y2). Pythagoras but single precision ๐real function slapy3 (X, Y, Z)โ SLAPY3 returns sqrt(x2+y2+z2). 3D Pythagoras, single precision ๐งreal function slarmm (ANORM, BNORM, CNORM)โ SLARMM. just the name. iconic minimalism ๐subroutine slarnv (IDIST, ISEED, N, X)โ SLARNV returns a vector of random numbers from a uniform or normal distribution. single precision rng ๐ฒsubroutine slarra (N, D, E, E2, SPLTOL, TNRM, NSPLIT, ISPLIT, INFO)โ SLARRA computes the splitting points with the specified threshold. single precision splitting ๐subroutine slarrb (N, D, LLD, IFIRST, ILAST, RTOL1, RTOL2, OFFSET, W, WGAP, WERR, WORK, IWORK, PIVMIN, SPDIAM, TWIST, INFO)โ SLARRB provides limited bisection to locate eigenvalues for more
accuracy.
subroutine slarrc(JOBT,N,VL,VU,D,E,PIVMIN,EIGCNT,LCNT,RCNT,INFO) โ SLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. bestie it just counts them, that's the whole job ๐subroutine slarrd(RANGE,ORDER,N,VL,VU,IL,IU,GERS,RELTOL,D,E,E2,PIVMIN,NSPLIT,ISPLIT,M,W,WERR,WL,WU,IBLOCK,INDEXW,WORK,IWORK,INFO) โ SLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.subroutine slarre(RANGE,N,VL,VU,IL,IU,D,E,E2,RTOL1,RTOL2,SPLTOL,NSPLIT,ISPLIT,M,W,WERR,WGAP,IBLOCK,INDEXW,GERS,PIVMIN,WORK,IWORK,INFO) โ SLARRE, given the tridiagonal matrixT, sets small off-diagonal elements to zero and, for each unreduced blockTi, finds base representations and eigenvalues.subroutine slarrf(N,D,L,LD,CLSTRT,CLEND,W,WGAP,WERR,SPDIAM,CLGAPL,CLGAPR,PIVMIN,SIGMA,DPLUS,LPLUS,WORK,INFO) โ SLARRF finds a new relatively robust representation such that at least one of the eigenvalues is relatively isolated.subroutine slarrj(N,D,E2,IFIRST,ILAST,RTOL,OFFSET,W,WERR,WORK,IWORK,PIVMIN,SPDIAM,INFO) โ SLARRJ performs refinement of the initial estimates of the eigenvalues of the matrixT.subroutine slarrk(N,IW,GL,GU,D,E2,PIVMIN,RELTOL,W,WERR,INFO) โ SLARRK computes one eigenvalue of a symmetric tridiagonal matrixTto suitable accuracy.subroutine slarrr(N,D,E,INFO) โ SLARRR performs tests to decide whether the symmetric tridiagonal matrixTwarrants expensive computations which guarantee high relative accuracy in the eigenvalues. it's giving vibe check for your matrix ๐subroutine slartgp(F,G,CS,SN,R) โ SLARTGP generates a plane rotation so that the diagonal is nonnegative.subroutine slaruv(ISEED,N,X) โ SLARUV returns a vector ofnrandom real numbers from a uniform distribution. ๐ฒsubroutine slas2(F,G,H,SSMIN,SSMAX) โ SLAS2 computes singular values of a 2-by-2 triangular matrix.subroutine slascl(TYPE,KL,KU,CFROM,CTO,M,N,A,LDA,INFO) โ SLASCL multiplies a general rectangular matrix by a real scalar defined ascto/cfrom.subroutine slasd0(N,SQRE,D,E,U,LDU,VT,LDVT,SMLSIZ,IWORK,WORK,INFO) โ SLASD0 computes the singular values of a real upper bidiagonal n-by-m matrixBwith diagonaldand off-diagonale. Used bysbdsdc.subroutine slasd1(NL,NR,SQRE,D,ALPHA,BETA,U,LDU,VT,LDVT,IDXQ,IWORK,WORK,INFO) โ SLASD1 computes the SVD of an upper bidiagonal matrixBof the specified size. Used bysbdsdc.subroutine slasd2(NL,NR,SQRE,K,D,Z,ALPHA,BETA,U,LDU,VT,LDVT,DSIGMA,U2,LDU2,VT2,LDVT2,IDXP,IDX,IDXC,IDXQ,COLTYP,INFO) โ SLASD2 merges the two sets of singular values together into a single sorted set. Used bysbdsdc.subroutine slasd3(NL,NR,SQRE,K,D,Q,LDQ,DSIGMA,U,LDU,U2,LDU2,VT,LDVT,VT2,LDVT2,IDXC,CTOT,Z,INFO) โ SLASD3 finds all square roots of the roots of the secular equation, as defined by the values inDandZ, and then updates the singular vectors by matrix multiplication. Used bysbdsdc.subroutine slasd4(N,I,D,Z,DELTA,RHO,SIGMA,WORK,INFO) โ SLASD4 computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix. Used bysbdsdc.subroutine slasd5(I,D,Z,DELTA,RHO,DSIGMA,WORK) โ SLASD5 computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix. Used bysbdsdc.subroutine slasd6(ICOMPQ,NL,NR,SQRE,D,VF,VL,ALPHA,BETA,IDXQ,PERM,GIVPTR,GIVCOL,LDGCOL,GIVNUM,LDGNUM,POLES,DIFL,DIFR,Z,K,C,S,WORK,IWORK,INFO) โ SLASD6 computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used bysbdsdc.subroutine slasd7(ICOMPQ,NL,NR,SQRE,K,D,Z,ZW,VF,VFW,VL,VLW,ALPHA,BETA,DSIGMA,IDX,IDXP,IDXQ,PERM,GIVPTR,GIVCOL,LDGCOL,GIVNUM,LDGNUM,C,S,INFO) โ SLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. Used bysbdsdc.subroutine slasd8(ICOMPQ,K,D,Z,VF,VL,DIFL,DIFR,LDDIFR,DSIGMA,WORK,INFO) โ SLASD8 finds the square roots of the roots of the secular equation, and stores, for each element inD, the distance to its two nearest poles. Used bysbdsdc.subroutine slasda(ICOMPQ,SMLSIZ,N,SQRE,D,E,U,LDU,VT,K,DIFL,DIFR,Z,POLES,GIVPTR,GIVCOL,LDGCOL,PERM,GIVNUM,C,S,WORK,IWORK,INFO) โ SLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonaldand off-diagonale. Used bysbdsdc.subroutine slasdq(UPLO,SQRE,N,NCVT,NRU,NCC,D,E,VT,LDVT,U,LDU,C,LDC,WORK,INFO) โ SLASDQ computes the SVD of a real bidiagonal matrix with diagonaldand off-diagonale. Used bysbdsdc.subroutine slasdt(N,LVL,ND,INODE,NDIML,NDIMR,MSUB) โ SLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used bysbdsdc. ๐ณsubroutine slaset(UPLO,M,N,ALPHA,BETA,A,LDA) โ SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.subroutine slasr(SIDE,PIVOT,DIRECT,M,N,C,S,A,LDA) โ SLASR applies a sequence of plane rotations to a general rectangular matrix.subroutine slasv2(F,G,H,SSMIN,SSMAX,SNR,CSR,SNL,CSL) โ SLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix.subroutine xerbla(SRNAME,INFO) โ XERBLAsubroutine xerbla_array(SRNAME_ARRAY,SRNAME_LEN,INFO) โ XERBLA_ARRAY
๐ Detailed Description ๐
This is the group of Other Auxiliary routines. like, the lil sidekicks of the LAPACK universe ๐ซถ
๐ Function Documentation ๐
logical function disnan (double precision, intent(in) DIN)
DISNAN tests input for NaN. no cap, that's it, that's the whole function ๐
Purpose:
DISNAN returns .TRUE. if its argument is NaN, and .FALSE.
otherwise. To be replaced by the Fortran 2003 intrinsic in the
future.
bestie it is literally getting replaced by a Fortran 2003 intrinsic one day, so don't get too attached ๐
Parameters
DINDINisDOUBLE PRECISION- Input to test for NaN.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine dlabad (double precision SMALL, double precision LARGE)
DLABAD
Purpose:
DLABAD takes as input the values computed by DLAMCH for underflow and
overflow, and returns the square root of each of these values if the
log of LARGE is sufficiently large. This subroutine is intended to
identify machines with a large exponent range, such as the Crays, and
redefine the underflow and overflow limits to be the square roots of
the values computed by DLAMCH. This subroutine is needed because
DLAMCH does not compensate for poor arithmetic in the upper half of
the exponent range, as is found on a Cray.
okay so this one is a Cray-era fix-it-up situation โ DLAMCH does not compensate for mid arithmetic in the top half of the exponent range on those machines, and DLABAD is the patch ๐ฉน
Parameters
SMALLSMALLisDOUBLE PRECISION- On entry, the underflow threshold as computed by
DLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, the square root ofSMALL, otherwise unchanged.
LARGELARGEisDOUBLE PRECISION- On entry, the overflow threshold as computed by
DLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, the square root ofLARGE, otherwise unchanged.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine dlacpy (character UPLO, integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( ldb, * ) B, integer LDB)
DLACPY copies all or part of one two-dimensional array to another. the original copy-paste, but make it linear algebra ๐
Purpose:
DLACPY copies all or part of a two-dimensional matrix A to another
matrix B.
Parameters
UPLOUPLOisCHARACTER*1- Specifies the part of the matrix
Ato be copied toB. = 'U':Upper triangular part= 'L':Lower triangular part- Otherwise: All of the matrix
A
MMisINTEGER- The number of rows of the matrix
A.M >= 0.
NNisINTEGER- The number of columns of the matrix
A.N >= 0.
AAisDOUBLE PRECISIONarray, dimension(LDA,N)- The m by n matrix
A. IfUPLO = 'U', only the upper triangle or trapezoid is accessed; ifUPLO = 'L', only the lower triangle or trapezoid is accessed.
LDALDAisINTEGER- The leading dimension of the array
A.LDA >= max(1,M).
BBisDOUBLE PRECISIONarray, dimension(LDB,N)- On exit,
B = Ain the locations specified byUPLO.
LDBLDBisINTEGER- The leading dimension of the array
B.LDB >= max(1,M).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine dlae2 (double precision A, double precision B, double precision C, double precision RT1, double precision RT2)
DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. tiny matrix, big energy โจ
Purpose:
DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix
[ A B ]
[ B C ].
On return, RT1 is the eigenvalue of larger absolute value, and RT2
is the eigenvalue of smaller absolute value.
Parameters
AAisDOUBLE PRECISION- The (1,1) element of the 2-by-2 matrix.
BBisDOUBLE PRECISION- The (1,2) and (2,1) elements of the 2-by-2 matrix.
CCisDOUBLE PRECISION- The (2,2) element of the 2-by-2 matrix.
RT1RT1isDOUBLE PRECISION- The eigenvalue of larger absolute value.
RT2RT2isDOUBLE PRECISION- The eigenvalue of smaller absolute value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
RT1 is accurate to a few ulps barring over/underflow.
RT2 may be inaccurate if there is massive cancellation in the
determinant A*C-B*B; higher precision or correctly rounded or
correctly truncated arithmetic would be needed to compute RT2
accurately in all cases.
๐จ okay this is the important one bestie:RT1is accurate to a few ulps barring over/underflow, butRT2may be inaccurate if there is massive cancellation in the determinantA*C-B*B. you'd need higher precision or correctly rounded or correctly truncated arithmetic to computeRT2accurately in all cases. so ifRT2acts up, it's not you, it's the arithmetic ๐ญ
Overflow is possible only if RT1 is within a factor of 5 of overflow. Underflow is harmless if the input data is 0 or exceeds underflow_threshold / macheps.
subroutine dlaebz ๐
subroutine dlaebz (integer IJOB, integer NITMAX, integer N, integer MMAX,
integer MINP, integer NBMIN, double precision ABSTOL, double precision
RELTOL, double precision PIVMIN, double precision, dimension( * ) D,
double precision, dimension( * ) E, double precision, dimension( * ) E2,
integer, dimension( * ) NVAL, double precision, dimension( mmax, * ) AB,
double precision, dimension( * ) C, integer MOUT, integer, dimension(
mmax, * ) NAB, double precision, dimension( * ) WORK, integer,
dimension( * ) IWORK, integer INFO)
So DLAEBZ is literally out here counting how many eigenvalues of a real symmetric tridiagonal matrix are less than or equal to a given value, and doing all the other tasks that sstebz needs. ๐
๐ฏ Purpose
DLAEBZ contains the iteration loops which compute and use the function N(w), which is the count of eigenvalues of a symmetric tridiagonal matrix T less than or equal to its argument w. It performs a choice of two types of loops:
IJOB=1, followed byIJOB=2: It takes as input a list of intervals and returns a list of sufficiently small intervals whose union contains the same eigenvalues as the union of the original intervals. The input intervals are(AB(j,1),AB(j,2)],j=1,...,MINP. The output interval(AB(j,1),AB(j,2)]will contain eigenvaluesNAB(j,1)+1,...,NAB(j,2), where1 <= j <= MOUT.IJOB=3: It performs a binary search in each input interval(AB(j,1),AB(j,2)]for a pointw(j)such thatN(w(j))=NVAL(j), and usesC(j)as the starting point of the search. If such aw(j)is found, then on outputAB(j,1)=AB(j,2)=w. If no suchw(j)is found, then on output(AB(j,1),AB(j,2)]will be a small interval containing the point whereN(w)jumps throughNVAL(j), unless that point lies outside the initial interval.
Note that the intervals are in all cases half-open intervals, i.e., of the form (a,b], which includes b but not a. ๐ฆ
To avoid underflow, the matrix should be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value. To assure the most accurate computation of small eigenvalues, the matrix should be scaled to be not much smaller than that, either.
See W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966
Note: the arguments are, in general, not checked for unreasonable values. ๐
๐ Parameters
IJOBโIJOBisINTEGER. Specifies what is to be done:= 1:ComputeNABfor the initial intervals.= 2:Perform bisection iteration to find eigenvalues ofT.= 3:Perform bisection iteration to invertN(w), i.e., to find a point which has a specified number of eigenvalues ofTto its left.- Other values will cause
DLAEBZto return withINFO=-1.
NITMAXโNITMAXisINTEGER. The maximum number of 'levels' of bisection to be performed, i.e., an interval of widthWwill not be made smaller than2^(-NITMAX) * W. If not all intervals have converged afterNITMAXiterations, thenINFOis set to the number of non-converged intervals.NโNisINTEGER. The dimensionnof the tridiagonal matrixT. It must be at least 1.MMAXโMMAXisINTEGER. The maximum number of intervals. If more thanMMAXintervals are generated, thenDLAEBZwill quit withINFO=MMAX+1.MINPโMINPisINTEGER. The initial number of intervals. It may not be greater thanMMAX.NBMINโNBMINisINTEGER. The smallest number of intervals that should be processed using a vector loop. If zero, then only the scalar loop will be used.ABSTOLโABSTOLisDOUBLE PRECISION. The minimum (absolute) width of an interval. When an interval is narrower thanABSTOL, or thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. This must be at least zero.RELTOLโRELTOLisDOUBLE PRECISION. The minimum relative width of an interval. When an interval is narrower thanABSTOL, or thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at leastradix*machine epsilon.PIVMINโPIVMINisDOUBLE PRECISION. The minimum absolute value of a 'pivot' in the Sturm sequence loop. This must be at leastmax |e(j)**2|*safe_minand at leastsafe_min, wheresafe_minis at least the smallest number that can divide one without overflow.DโDisDOUBLE PRECISIONarray, dimension(N). The diagonal elements of the tridiagonal matrixT.EโEisDOUBLE PRECISIONarray, dimension(N). The offdiagonal elements of the tridiagonal matrixTin positions 1 throughN-1.E(N)is arbitrary.E2โE2isDOUBLE PRECISIONarray, dimension(N). The squares of the offdiagonal elements of the tridiagonal matrixT.E2(N)is ignored.NVALโNVALisINTEGERarray, dimension(MINP). IfIJOB=1or2, not referenced. IfIJOB=3, the desired values ofN(w). The elements ofNVALwill be reordered to correspond with the intervals inAB. Thus,NVAL(j)on output will not, in general be the same asNVAL(j)on input, but it will correspond with the interval(AB(j,1),AB(j,2)]on output.ABโABisDOUBLE PRECISIONarray, dimension(MMAX,2). The endpoints of the intervals.AB(j,1)isa(j), the left endpoint of thej-th interval, andAB(j,2)isb(j), the right endpoint of thej-th interval. The input intervals will, in general, be modified, split, and reordered by the calculation.CโCisDOUBLE PRECISIONarray, dimension(MMAX). IfIJOB=1, ignored. IfIJOB=2, workspace. IfIJOB=3, then on inputC(j)should be initialized to the first search point in the binary search.MOUTโMOUTisINTEGER. IfIJOB=1, the number of eigenvalues in the intervals. IfIJOB=2or3, the number of intervals output. IfIJOB=3,MOUTwill equalMINP.NABโNABisINTEGERarray, dimension(MMAX,2). IfIJOB=1, then on outputNAB(i,j)will be set toN(AB(i,j)). IfIJOB=2, then on input,NAB(i,j)should be set. It must satisfy the condition:
N(AB(i,1)) <= NAB(i,1) <= NAB(i,2) <= N(AB(i,2)),
which means that in interval i only eigenvalues NAB(i,1)+1,...,NAB(i,2) will be considered. Usually, NAB(i,j)=N(AB(i,j)), from a previous call to DLAEBZ with IJOB=1. On output, NAB(i,j) will contain max(na(k),min(nb(k),N(AB(i,j)))), where k is the index of the input interval that the output interval (AB(j,1),AB(j,2)] came from, and na(k) and nb(k) are the input values of NAB(k,1) and NAB(k,2). If IJOB=3, then on output, NAB(i,j) contains N(AB(i,j)), unless N(w) > NVAL(i) for all search points w, in which case NAB(i,1) will not be modified, i.e., the output value will be the same as the input value (modulo reorderings -- see NVAL and AB), or unless N(w) < NVAL(i) for all search points w, in which case NAB(i,2) will not be modified. Normally, NAB should be set to some distinctive value(s) before DLAEBZ is called.
WORKโWORKisDOUBLE PRECISIONarray, dimension(MMAX). Workspace.IWORKโIWORKisINTEGERarray, dimension(MMAX). Workspace.INFOโINFOisINTEGER.= 0:All intervals converged.= 1--MMAX:The lastINFOintervals did not converge.= MMAX+1:More thanMMAXintervals were generated.
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ Further Details ๐ฆ
This routine is intended to be called only by other LAPACK routines, thus the interface is less user-friendly. It is intended for two purposes:
(a) finding eigenvalues. In this case, DLAEBZ should have one or more initial intervals set up in AB, and DLAEBZ should be called with IJOB=1. This sets up NAB, and also counts the eigenvalues. Intervals with no eigenvalues would usually be thrown out at this point. Also, if not all the eigenvalues in an interval i are desired, NAB(i,1) can be increased or NAB(i,2) decreased. For example, set NAB(i,1)=NAB(i,2)-1 to get the largest eigenvalue. DLAEBZ is then called with IJOB=2 and MMAX no smaller than the value of MOUT returned by the call with IJOB=1. After this (IJOB=2) call, eigenvalues NAB(i,1)+1 through NAB(i,2) are approximately AB(i,1) (or AB(i,2)) to the tolerance specified by ABSTOL and RELTOL.
- (b) finding an interval
(a',b']containing eigenvaluesw(f),...,w(l). In this case, start with a Gershgorin interval(a,b). Set upABto contain 2 search intervals, both initially(a,b). OneNVALelement should containf-1and the other should containl, whileCshould containaandb, resp.NAB(i,1)should be-1andNAB(i,2)should beN+1, to flag an error if the desired interval does not lie in(a,b).DLAEBZis then called withIJOB=3. On exit, ifw(f-1) < w(f), then one of the intervals --j-- will haveAB(j,1)=AB(j,2)andNAB(j,1)=NAB(j,2)=f-1, while if, to the specified tolerance,w(f-k)=...=w(f+r),k > 0andr >= 0, then the interval will haveN(AB(j,1))=NAB(j,1)=f-kandN(AB(j,2))=NAB(j,2)=f+r. The casesw(l) < w(l+1)andw(l-r)=...=w(l+k)are handled similarly. ๐
๐ฆ subroutine dlaev2 ๐ฆ
subroutine dlaev2 (double precision A, double precision B, double precision
C, double precision RT1, double precision RT2, double precision CS1,
double precision SN1)
okay bestie, DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. yes. the tiny little baby matrix. it ate. โจ
Purpose ๐
DLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix
[ A B ]
[ B C ].
On return, RT1 is the eigenvalue of larger absolute value, RT2 is the eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right eigenvector for RT1, giving the decomposition
[ CS1 SN1 ] [ A B ] [ CS1 -SN1 ] = [ RT1 0 ]
[-SN1 CS1 ] [ B C ] [ SN1 CS1 ] [ 0 RT2 ].
Parameters ๐
AโDOUBLE PRECISION. The(1,1)element of the 2-by-2 matrix.BโDOUBLE PRECISION. The(1,2)element and the conjugate of the(2,1)element of the 2-by-2 matrix.CโDOUBLE PRECISION. The(2,2)element of the 2-by-2 matrix.RT1โDOUBLE PRECISION. The eigenvalue of larger absolute value.RT2โDOUBLE PRECISION. The eigenvalue of smaller absolute value.CS1โDOUBLE PRECISIONSN1โDOUBLE PRECISION. The vector(CS1, SN1)is a unit right eigenvector forRT1.
Author ๐ธ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: โญ
RT1is accurate to a few ulps barring over/underflow.RT2may be inaccurate if there is massive cancellation in the determinantA*C-B*B; higher precision or correctly rounded or correctly truncated arithmetic would be needed to computeRT2accurately in all cases.CS1andSN1are accurate to a few ulps barring over/underflow.- Overflow is possible only if
RT1is within a factor of 5 of overflow. Underflow is harmless if the input data is 0 or exceedsunderflow_threshold / macheps.
๐ง subroutine dlagts ๐ง
subroutine dlagts (integer JOB, integer N, double precision, dimension( * )
A, double precision, dimension( * ) B, double precision, dimension( * )
C, double precision, dimension( * ) D, integer, dimension( * ) IN,
double precision, dimension( * ) Y, double precision TOL, integer INFO)
DLAGTS solves the system of equations (T-ฮปI)x = y or (T-ฮปI)Tx = y, where T is a general tridiagonal matrix and ฮป a scalar, using the LU factorization computed by slagtf. no cap, it's just out here solving for x ๐ซถ
Purpose ๐
DLAGTS may be used to solve one of the systems of equations
(T - lambda*I)*x = y or (T - lambda*I)**T*x = y,
where T is an n by n tridiagonal matrix, for x, following the factorization of (T - lambda*I) as
(T - lambda*I) = P*L*U ,
by routine DLAGTF. The choice of equation to be solved is controlled by the argument JOB, and in each case there is an option to perturb zero or very small diagonal elements of U, this option being intended for use in applications such as inverse iteration.
Parameters ๐
JOBโINTEGER. Specifies the job to be performed byDLAGTSas follows:= 1: The equations(T - lambda*I)x = yare to be solved, but diagonal elements ofUare not to be perturbed.= -1: The equations(T - lambda*I)x = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.= 2: The equations(T - lambda*I)**Tx = yare to be solved, but diagonal elements ofUare not to be perturbed.= -2: The equations(T - lambda*I)**Tx = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.
NโINTEGER. The order of the matrixT.AโDOUBLE PRECISION array, dimension (N). On entry,Amust contain the diagonal elements ofUas returned fromDLAGTF.BโDOUBLE PRECISION array, dimension (N-1). On entry,Bmust contain the first super-diagonal elements ofUas returned fromDLAGTF.CโDOUBLE PRECISION array, dimension (N-1). On entry,Cmust contain the sub-diagonal elements ofLas returned fromDLAGTF.DโDOUBLE PRECISION array, dimension (N-2). On entry,Dmust contain the second super-diagonal elements ofUas returned fromDLAGTF.INโINTEGER array, dimension (N). On entry,INmust contain details of the matrixPas returned fromDLAGTF.YโDOUBLE PRECISION array, dimension (N). On entry, the right hand side vectory. On exit,Yis overwritten by the solution vectorx. (she got a glow-up ๐ )TOLโDOUBLE PRECISION. On entry, withJOB < 0,TOLshould be the minimum perturbation to be made to very small diagonal elements ofU.TOLshould normally be chosen as abouteps*norm(U), whereepsis the relative machine precision, but ifTOLis supplied as non-positive, then it is reset toeps*max( abs( u(i,j) ) ). IfJOB > 0thenTOLis not referenced. On exit,TOLis changed as described above, only ifTOLis non-positive on entry. OtherwiseTOLis unchanged.INFOโINTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: overflow would occur when computing theINFO(th)element of the solution vectorx. This can only occur whenJOBis supplied as positive and either means that a diagonal element ofUis very small, or that the elements of the right-hand side vectoryare very large.
heads up bestie โ thatINFO > 0overflow situation is not a vibe. tinyUdiagonal or hugey, pick your poison. ๐ญ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ logical function dlaisnan ๐ธ
logical function dlaisnan (double precision, intent(in) DIN1, double
precision, intent(in) DIN2)
DLAISNAN tests input for NaN by comparing two arguments for inequality. sneaky little NaN detector, iykyk ๐
Purpose โจ
This routine is not for general use. It exists solely to avoid over-optimization in DISNAN.
DLAISNAN checks for NaNs by comparing its two arguments for inequality. NaN is the only floating-point value where NaN != NaN returns .TRUE. To check for NaNs, pass the same variable as both arguments.
A compiler must assume that the two arguments are not the same variable, and the test will not be optimized away. Interprocedural or whole-program optimization may delete this test. The ISNAN functions will be replaced by the correct Fortran 03 intrinsic once the intrinsic is widely available.
fr fr โ do NOT go using this in your general code, it's literally here for one (1) job.
Parameters ๐ฆ
DIN1โDOUBLE PRECISIONDIN2โDOUBLE PRECISION. Two numbers to compare for inequality.
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ integer function dlaneg ๐
integer function dlaneg (integer N, double precision, dimension( * ) D,
double precision, dimension( * ) LLD, double precision SIGMA, double
precision PIVMIN, integer R)
DLANEG computes the Sturm count. iconic name tbh ๐ฅ
Purpose โญ
DLANEG computes the Sturm count, the number of negative pivots encountered while factoring tridiagonal T - sigma I = L D L^T. This implementation works directly on the factors without forming the tridiagonal matrix T. The Sturm count is also the number of eigenvalues of T less than sigma.
This routine is called from DLARRB.
The current routine does not use the PIVMIN parameter but rather requires IEEE-754 propagation of Infinities and NaNs. This routine also has no input range restrictions but does require default exception handling such that x/0 produces Inf when x is non-zero, and Inf/Inf produces NaN. For more information, see:
Marques, Riedy, and Voemel, 'Benefits of IEEE-754 Features in
Modern Symmetric Tridiagonal Eigensolvers,' SIAM Journal on
Scientific Computing, v28, n5, 2006. DOI 10.1137/050641624
(Tech report version in LAWN 172 with the same title.)
not me being built entirely on IEEE-754 vibes ๐
Parameters ๐
NโINTEGER. The order of the matrix.DโDOUBLE PRECISION array, dimension (N). TheNdiagonal elements of the diagonal matrixD.LLDโDOUBLE PRECISION array, dimension (N-1). The(N-1)elementsL(i)*L(i)*D(i).SIGMAโDOUBLE PRECISION. Shift amount inT - sigma I = L D L^T.PIVMINโDOUBLE PRECISION. The minimum pivot in the Sturm sequence. May be used when zero pivots are encountered on non-IEEE-754 architectures.RโINTEGER. The twist index for the twisted factorization that is used for the negcount.
Author ๐
- Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: ๐
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
- Jason Riedy, University of California, Berkeley, USA
๐ธ double precision function dlanst (character NORM, integer N, double precision, dimension( * ) D, double precision, dimension( * ) E)
DLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix. bestie it does exactly what it says on the tin.
Purpose:
DLANST hands you back the one norm, the Frobenius norm, the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix A. no cap. โจ
Returns
DLANST is giving:
DLANST = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 is the one norm of a matrix (maximum column sum), normI is the infinity norm of a matrix (maximum row sum), and normF is the Frobenius norm of a matrix (square root of sum of squares). ๐
Heads up bestie: max(abs(A(i,j))) is not a consistent matrix norm. it's just built different, that's all. ๐
Parameters
NORMโNORMisCHARACTER*1. Specifies the value to be returned in DLANST as described above.NโNisINTEGER. The order of the matrixA.N >= 0. WhenN = 0, DLANST is set to zero. zero. nada. nothing. ๐ซถDโDisDOUBLE PRECISIONarray, dimension(N). The diagonal elements ofA.EโEisDOUBLE PRECISIONarray, dimension(N-1). The(n-1)sub-diagonal or super-diagonal elements ofA.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ double precision function dlapy2 (double precision X, double precision Y)
DLAPY2 returns sqrt(x2+y2). it's the hypotenuse function, basically Pythagoras but on the clock and clocking in ๐ฆ
Purpose:
DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary overflow and unnecessary underflow. it's giving careful. it's giving mindful. ๐
Parameters
XโXisDOUBLE PRECISION.YโYisDOUBLE PRECISION.XandYspecify the valuesxandy.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โญ double precision function dlapy3 (double precision X, double precision Y, double precision Z)
DLAPY3 returns sqrt(x2+y2+z2). the three-dimensional glow-up of DLAPY2, we love a sequel ๐
Purpose:
DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause unnecessary overflow and unnecessary underflow. again with the no unnecessary overflow, no unnecessary underflow agenda. iconic behaviour fr fr. โจ
Parameters
XโXisDOUBLE PRECISION.YโYisDOUBLE PRECISION.ZโZisDOUBLE PRECISION.X,YandZspecify the valuesx,yandz.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ double precision function dlarmm (double precision ANORM, double precision BNORM, double precision CNORM)
DLARMM
Purpose:
DLARMM returns a factor s in (0, 1] such that the linear updates
(s * C) - A * (s * B) and (s * C) - (s * A) * B
cannot overflow, where A, B, and C are matrices of conforming dimensions.
This is an auxiliary routine so there is no argument checking. bestie it trusts you. do not betray it. ๐ญ
Parameters
ANORMโANORMisDOUBLE PRECISION. The infinity norm ofA.ANORM >= 0. The number of rows of the matrixA.M >= 0.BNORMโBNORMisDOUBLE PRECISION. The infinity norm ofB.BNORM >= 0.CNORMโCNORMisDOUBLE PRECISION. The infinity norm ofC.CNORM >= 0.
References: C. C. Kjelgaard Mikkelsen and L. Karlsson, Blocked Algorithms for Robust Solution of Triangular Linear Systems. In: International Conference on Parallel Processing and Applied Mathematics, pages 68--78. Springer, 2017.
๐ subroutine dlarnv (integer IDIST, integer, dimension( 4 ) ISEED, integer N, double precision, dimension( * ) X)
DLARNV returns a vector of random numbers from a uniform or normal distribution. yes bestie, it's the RNG. it's random. it's chaotic. it's main character energy ๐
Purpose:
DLARNV returns a vector of n random real numbers from a uniform or normal distribution. ๐ฒ
Parameters
IDISTโIDISTisINTEGER. Specifies the distribution of the random numbers:= 1: uniform(0,1)= 2: uniform(-1,1)= 3: normal(0,1)
ISEEDโISEEDisINTEGERarray, dimension(4). On entry, the seed of the random number generator; the array elements must be between0and4095, andISEED(4)must be odd. On exit, the seed is updated. โจNโNisINTEGER. The number of random numbers to be generated.XโXisDOUBLE PRECISIONarray, dimension(N). The generated random numbers.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
This routine calls the auxiliary routine DLARUV to generate random real numbers from a uniform (0,1) distribution, in batches of up to 128 using vectorisable code. The Box-Muller method is used to transform numbers from a uniform to a normal distribution. the way that it batches 128 at a time?? obsessed. ๐ญ๐
๐ฆ subroutine dlarra (integer N, double precision, dimension( * ) D, double precision, dimension( * ) E, double precision, dimension( * ) E2, double precision SPLTOL, double precision TNRM, integer NSPLIT, integer, dimension( * ) ISPLIT, integer INFO)
DLARRA computes the splitting points with the specified threshold.
Purpose:
Compute the splitting points with threshold SPLTOL. DLARRA sets any 'small' off-diagonal elements to zero. it's giving โจdeclutteringโจ โจspring cleaningโจ ๐ง
Parameters
NโNisINTEGER. The order of the matrix.N > 0.DโDisDOUBLE PRECISIONarray, dimension(N). On entry, theNdiagonal elements of the tridiagonal matrixT.EโEisDOUBLE PRECISIONarray, dimension(N). On entry, the first(N-1)entries contain the subdiagonal elements of the tridiagonal matrixT;E(N)need not be set. On exit, the entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, are set to zero, the other entries ofEare untouched.E2โE2isDOUBLE PRECISIONarray, dimension(N). On entry, the first(N-1)entries contain the SQUARES of the subdiagonal elements of the tridiagonal matrixT;E2(N)need not be set. On exit, the entriesE2( ISPLIT( I ) ),1 <= I <= NSPLIT, have been set to zero.SPLTOLโSPLTOLisDOUBLE PRECISION. The threshold for splitting. Two criteria can be used:SPLTOL<0: criterion based on absolute off-diagonal valueSPLTOL>0: criterion that preserves relative accuracy
TNRMโTNRMisDOUBLE PRECISION. The norm of the matrix.NSPLITโNSPLITisINTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITโISPLITisINTEGERarray, dimension(N). The splitting points, at whichTbreaks up into blocks. The first block consists of rows/columns1toISPLIT(1), the second of rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th consists of rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N. ๐INFOโINFOisINTEGER.= 0: successful exit โจ
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors: ๐
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
๐ subroutine dlarrb (integer N, double precision, dimension( * ) D, double precision, dimension( * ) LLD, integer IFIRST, integer ILAST, double precision RTOL1, double precision RTOL2, integer OFFSET, double precision, dimension( * ) W, double precision, dimension( * ) WGAP, double precision, dimension( * ) WERR, double precision, dimension( * ) WORK, integer, dimension( * ) IWORK, double precision PIVMIN, double precision SPDIAM, integer TWIST, integer INFO)
DLARRB provides limited bisection to locate eigenvalues for more accuracy. limited bisection?? okay budget bisection, we respect the restraint ๐ซถ
Purpose:
Given the relatively robust representation (RRR) L D L^T, DLARRB does 'limited' bisection to refine the eigenvalues of L D L^T, W( IFIRST-OFFSET ) through W( ILAST-OFFSET ), to more accuracy. Initial guesses for these eigenvalues are input in W, the corresponding estimate of the error in these guesses and their gaps are input in WERR and WGAP, respectively. During bisection, intervals [left, right] are maintained by storing their mid-points and semi-widths in the arrays W and WERR respectively. ngl that's kind of elegant. ๐ธ
Parameters
NโNisINTEGER. The order of the matrix.DโDisDOUBLE PRECISIONarray, dimension(N). TheNdiagonal elements of the diagonal matrixD.LLDโLLDisDOUBLE PRECISIONarray, dimension(N-1). The(N-1)elementsL(i)*L(i)*D(i).IFIRSTโIFIRSTisINTEGER. The index of the first eigenvalue to be computed.ILASTโILASTisINTEGER. The index of the last eigenvalue to be computed.RTOL1โRTOL1isDOUBLE PRECISION.RTOL2โRTOL2isDOUBLE PRECISION. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )whereGAPis the (estimated) distance to the nearest eigenvalue. โญOFFSETOFFSETโOFFSETisINTEGER. It's the offset for the arraysW,WGAPandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are the ones getting used. bestie it's literally just a shift, iykyk ๐WโWisDOUBLE PRECISIONarray, dimension(N). On input,W( IFIRST-OFFSET )throughW( ILAST-OFFSET )are estimates of the eigenvalues ofL D L^TindexedIFIRSTthroughILAST. On output, these estimates are refined. glow up โจWGAPโWGAPisDOUBLE PRECISIONarray, dimension(N-1). On input, the (estimated) gaps between consecutive eigenvalues ofL D L^T, i.e.,WGAP(I-OFFSET)is the gap between eigenvaluesIandI+1. Note that ifIFIRST = ILASTthenWGAP(IFIRST-OFFSET)must be set toZERO. ๐ซถ On output, these gaps are refined.WERRโWERRisDOUBLE PRECISIONarray, dimension(N). On input,WERR( IFIRST-OFFSET )throughWERR( ILAST-OFFSET )are the errors in the estimates of the corresponding elements inW. On output, these errors are refined.WORKโWORKisDOUBLE PRECISIONarray, dimension(2*N). Workspace. the little backstage crew fr fr ๐IWORKโIWORKisINTEGERarray, dimension(2*N). Workspace.PIVMINโPIVMINisDOUBLE PRECISION. The minimum pivot in the Sturm sequence. โญSPDIAMโSPDIAMisDOUBLE PRECISION. The spectral diameter of the matrix.TWISTโTWISTisINTEGER. The twist index for the twisted factorization that is used for the negcount. ๐
TWIST = N: Compute negcount from L D L^T - LAMBDA I = L+ D+ L+^T
TWIST = 1: Compute negcount from L D L^T - LAMBDA I = U- D- U-^T
TWIST = R: Compute negcount from L D L^T - LAMBDA I = N(r) D(r) N(r)
INFOโINFOisINTEGER. Error flag. ๐ฉ
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors:
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
โจ subroutine dlarrc โจ
subroutine dlarrc (character JOBT, integer N, double precision VL, double
precision VU, double precision, dimension( * ) D, double precision,
dimension( * ) E, double precision PIVMIN, integer EIGCNT, integer LCNT,
integer RCNT, integer INFO)
DLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. counting era ๐โจ
๐ Purpose:
Find the number of eigenvalues of the symmetric tridiagonal matrix T that are in the interval (VL,VU] if JOBT = 'T', and of L D L^T if JOBT = 'L'.
๐ธ Parameters
JOBTโJOBTisCHARACTER*1= 'T': Compute Sturm count for matrixT.= 'L': Compute Sturm count for matrixL D L^T.
NโNisINTEGER. The order of the matrix.N > 0.VLโVLisDOUBLE PRECISION. The lower bound for the eigenvalues.VUโVUisDOUBLE PRECISION. The upper bound for the eigenvalues.DโDisDOUBLE PRECISIONarray, dimension(N)JOBT = 'T': TheNdiagonal elements of the tridiagonal matrixT.JOBT = 'L': TheNdiagonal elements of the diagonal matrixD.
EโEisDOUBLE PRECISIONarray, dimension(N)JOBT = 'T': TheN-1offdiagonal elements of the matrixT.JOBT = 'L': TheN-1offdiagonal elements of the matrixL.
PIVMINโPIVMINisDOUBLE PRECISION. The minimum pivot in the Sturm sequence forT.EIGCNTโEIGCNTisINTEGER. The number of eigenvalues of the symmetric tridiagonal matrixTthat are in the interval(VL,VU]. ๐ฅLCNTโLCNTisINTEGERRCNTโRCNTisINTEGER. The left and right negcounts of the interval.INFOโINFOisINTEGER
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors:
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
๐ subroutine dlarrd ๐
subroutine dlarrd (character RANGE, character ORDER, integer N, double
precision VL, double precision VU, integer IL, integer IU, double
precision, dimension( * ) GERS, double precision RELTOL, double
precision, dimension( * ) D, double precision, dimension( * ) E, double
precision, dimension( * ) E2, double precision PIVMIN, integer NSPLIT,
integer, dimension( * ) ISPLIT, integer M, double precision, dimension(
* ) W, double precision, dimension( * ) WERR, double precision WL,
double precision WU, integer, dimension( * ) IBLOCK, integer, dimension(
* ) INDEXW, double precision, dimension( * ) WORK, integer, dimension( *
) IWORK, integer INFO)
DLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy. it's giving precision, no cap ๐ฏ
๐ Purpose:
DLARRD computes the eigenvalues of a symmetric tridiagonal matrix T to suitable accuracy. This is an auxiliary code to be called from DSTEMR. The user may ask for all eigenvalues, all eigenvalues in the half-open interval (VL, VU], or the IL-th through IU-th eigenvalues.
To avoid overflow, the matrix must be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value, and for greatest accuracy, it should not be much smaller than that. โ ๏ธ
See W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966.
๐ธ Parameters
RANGEโRANGEisCHARACTER*1= 'A': ('All') all eigenvalues will be found.= 'V': ('Value') all eigenvalues in the half-open interval(VL, VU]will be found.= 'I': ('Index') theIL-th throughIU-th eigenvalues (of the entire matrix) will be found.
ORDERโORDERisCHARACTER*1= 'B': ('By Block') the eigenvalues will be grouped by split-off block (seeIBLOCK,ISPLIT) and ordered from smallest to largest within the block.= 'E': ('Entire matrix') the eigenvalues for the entire matrix will be ordered from smallest to largest.
NโNisINTEGER. The order of the tridiagonal matrixT.N >= 0.VLโVLisDOUBLE PRECISION. IfRANGE='V', the lower bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. Not referenced ifRANGE = 'A'or'I'.VUโVUisDOUBLE PRECISION. IfRANGE='V', the upper bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. Not referenced ifRANGE = 'A'or'I'.ILโILisINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.IUโIUisINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.GERSโGERSisDOUBLE PRECISIONarray, dimension(2*N). TheNGerschgorin intervals (thei-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i))). ๐ฆRELTOLโRELTOLisDOUBLE PRECISION. The minimum relative width of an interval. When an interval is narrower thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at leastradix*machine epsilon. โญDโDisDOUBLE PRECISIONarray, dimension(N). Thendiagonal elements of the tridiagonal matrixT.EโEisDOUBLE PRECISIONarray, dimension(N-1). The(n-1)off-diagonal elements of the tridiagonal matrixT.E2โE2isDOUBLE PRECISIONarray, dimension(N-1). The(n-1)squared off-diagonal elements of the tridiagonal matrixT.PIVMINโPIVMINisDOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence forT.NSPLITโNSPLITisINTEGER. The number of diagonal blocks in the matrixT.1 <= NSPLIT <= N.ISPLITโISPLITisINTEGERarray, dimension(N). The splitting points, at whichTbreaks up into submatrices. The first submatrix consists of rows/columns1toISPLIT(1), the second of rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th consists of rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N. (Only the firstNSPLITelements will actually be used, but since the user cannot know a priori what valueNSPLITwill have,Nwords must be reserved forISPLIT.)MโMisINTEGER. The actual number of eigenvalues found.0 <= M <= N. (See also the description ofINFO=2,3.)WWโWisDOUBLE PRECISIONarray, dimension(N). On exit, the firstMelements ofWhold the eigenvalue approximations, and this is the part that's lowkey iconic ๐ซถ. Here's the tea:DLARRDcomputes an intervalI_j = (a_j, b_j]that includes eigenvaluej. The eigenvalue approximation is literally just the interval midpoint:
W(j)= ( a_j + b_j)/2
and the corresponding error is bounded by
WERR(j) = abs( a_j - b_j)/2
WERRโWERRisDOUBLE PRECISIONarray, dimension(N). The error bound on the corresponding eigenvalue approximation inW. It's the receipts, basically โ the honest little number that tells you how much to trust eachW(j). ๐WLโWLisDOUBLE PRECISION. That's it, that's the whole entry, bestie.WUโWUisDOUBLE PRECISION. The interval(WL, WU]contains all the wanted eigenvalues. And the way it gets picked depends onRANGE:- If
RANGE='V', thenWL=VLandWU=VU. - If
RANGE='A', thenWLandWUare the global Gerschgorin bounds on the spectrum. - If
RANGE='I', thenWLandWUare computed byDLAEBZfrom the index range specified.
- If
IBLOCKโIBLOCKisINTEGERarray, dimension(N). At each row/columnjwhereE(j)is zero or small, the matrixTis considered to split into a block diagonal matrix. On exit, ifINFO = 0,IBLOCK(i)specifies to which block (from1to the number of blocks) the eigenvalueW(i)belongs. (DLARRDmay use the remainingN-Melements as workspace.)INDEXWโINDEXWisINTEGERarray, dimension(N). The indices of the eigenvalues within each block (submatrix); for example,INDEXW(i)= jandIBLOCK(i)=kimply that thei-th eigenvalueW(i)is thej-th eigenvalue in blockk. It's giving โจcoordinatesโจ for your eigenvalues.WORKโWORKisDOUBLE PRECISIONarray, dimension(4*N).IWORKโIWORKisINTEGERarray, dimension(3*N).INFOโINFOisINTEGER, and this one is the whole vibe check of the call:= 0: successful exit ๐< 0: ifINFO = -i, thei-th argument had an illegal value> 0: some or all of the eigenvalues failed to converge or were not computed:=1 or 3: Bisection failed to converge for some eigenvalues; these eigenvalues are flagged by a negative block number. The effect is that the eigenvalues may not be as accurate as the absolute and relative tolerances. This is generally caused by unexpectedly inaccurate arithmetic.=2 or 3:RANGE='I'only: Not all of the eigenvaluesIL:IUwere found.- Effect:
M < IU+1-IL - Cause: non-monotonic arithmetic, causing the Sturm sequence to be non-monotonic.
- Cure: recalculate, using
RANGE='A', and pick out eigenvaluesIL:IU. In some cases, increasing thePARAMETER'FUDGE'may make things work.
- Effect:
= 4:RANGE='I', and the Gershgorin interval initially used was too small. No eigenvalues were computed.- Probable cause: your machine has sloppy floating-point arithmetic.
- Cure: Increase the
PARAMETER'FUDGE', recompile, and try again.
โจ Internal Parameters โจ
FUDGEโDOUBLE PRECISION, default= 2. A'fudge factor'to widen the Gerschgorin intervals. Ideally, a value of1should work, but on machines with sloppy arithmetic, this needs to be larger. The default for publicly released versions should be large enough to handle the worst machine around. Note that this has no effect on accuracy of the solution โ it's just there to give the intervals some breathing room, not to change the answer. ๐ง
๐ Contributors ๐
These are the absolute legends who built this, no cap:
- W. Kahan, University of California, Berkeley, USA
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ subroutine dlarre ๐ธ
subroutine dlarre (character RANGE, integer N, double precision VL, double
precision VU, integer IL, integer IU, double precision, dimension( * )
D, double precision, dimension( * ) E, double precision, dimension( * )
E2, double precision RTOL1, double precision RTOL2, double precision
SPLTOL, integer NSPLIT, integer, dimension( * ) ISPLIT, integer M,
double precision, dimension( * ) W, double precision, dimension( * )
WERR, double precision, dimension( * ) WGAP, integer, dimension( * )
IBLOCK, integer, dimension( * ) INDEXW, double precision, dimension( * )
GERS, double precision PIVMIN, double precision, dimension( * ) WORK,
integer, dimension( * ) IWORK, integer INFO)
DLARRE given the tridiagonal matrix T, sets small off-diagonal elements to zero and for each unreduced block Ti, finds base representations and eigenvalues.
๐ฏ Purpose ๐ฏ
To find the desired eigenvalues of a given real symmetric tridiagonal matrix T, DLARRE sets any 'small' off-diagonal elements to zero, and for each unreduced block T_i, it finds
- a suitable shift at one end of the block's spectrum,
- the base representation,
T_i - sigma_i I = L_i D_i L_i^T, and - eigenvalues of each
L_i D_i L_i^T.
The representations and eigenvalues found are then used by DSTEMR to compute the eigenvectors of T.
The accuracy varies depending on whether bisection is used to find a few eigenvalues or the dqds algorithm (subroutine DLASQ2) to compute all and then discard any unwanted one.
As an added benefit, DLARRE also outputs the n Gerschgorin intervals for the matrices L_i D_i L_i^T. Free bonus content, we love that for us. ๐
๐ Parameters ๐
RANGEโRANGEisCHARACTER*1= 'A': ('All') all eigenvalues will be found.= 'V': ('Value') all eigenvalues in the half-open interval(VL, VU]will be found.= 'I': ('Index') theIL-th throughIU-th eigenvalues (of the entire matrix) will be found.
NโNisINTEGER. The order of the matrix.N > 0.VLโVLisDOUBLE PRECISION. IfRANGE='V', the lower bound for the eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. IfRANGE='I'or='A',DLARREcomputes bounds on the desired part of the spectrum.VUโVUisDOUBLE PRECISION. IfRANGE='V', the upper bound for the eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. IfRANGE='I'or='A',DLARREcomputes bounds on the desired part of the spectrum.ILโILisINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N.IUโIUisINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N.DโDisDOUBLE PRECISIONarray, dimension(N). On entry, theNdiagonal elements of the tridiagonal matrixT. On exit, theNdiagonal elements of the diagonal matricesD_i.EโEisDOUBLE PRECISIONarray, dimension(N). On entry, the first(N-1)entries contain the subdiagonal elements of the tridiagonal matrixT;E(N)need not be set. On exit,Econtains the subdiagonal elements of the unit bidiagonal matricesL_i. The entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, contain the base pointssigma_ion output.E2โE2isDOUBLE PRECISIONarray, dimension(N). On entry, the first(N-1)entries contain the SQUARES of the subdiagonal elements of the tridiagonal matrixT;E2(N)need not be set. On exit, the entriesE2( ISPLIT( I ) ),1 <= I <= NSPLIT, have been set to zero.RTOL1โRTOL1isDOUBLE PRECISION.RTOL2โRTOL2isDOUBLE PRECISION. Parameters for bisection. An interval[LEFT,RIGHT]has converged if
RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
SPLTOLโSPLTOLisDOUBLE PRECISION. The threshold for splitting.NSPLITโNSPLITisINTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITโISPLITisINTEGERarray, dimension(N). The splitting points, at whichTbreaks up into blocks. The first block consists of rows/columns1toISPLIT(1), the second of rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th consists of rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N. It's slicing the matrix like a cake ๐MโMisINTEGER. The total number of eigenvalues (of allL_i D_i L_i^T) found.WโWisDOUBLE PRECISIONarray, dimension(N). The firstMelements contain the eigenvalues. The eigenvalues of each of the blocks,L_i D_i L_i^T, are sorted in ascending order (DLARREmay use the remainingN-Melements as workspace).WERRโWERRisDOUBLE PRECISIONarray, dimension(N). The error bound on the corresponding eigenvalue inW.WGAPโDOUBLE PRECISION array, dimension (N). It's the separation from the right neighbor eigenvalue inW, bestie. Plot twist tho: the gap is only measured against the eigenvalues of the same block, because every block has its own representation tree. ๐ Exception to the exception: at the right end of a block, we store the left gap. Noted, moving on. ๐IBLOCKโINTEGER array, dimension (N). The indices of the blocks (submatrices) that go with the corresponding eigenvalues inW. SoIBLOCK(i)=1if eigenvalueW(i)belongs to the first block from the top,=2ifW(i)belongs to the second block, etc. Block two girlies, rise. โจINDEXWโINTEGER array, dimension (N). The indices of the eigenvalues within each block (submatrix). For example,INDEXW(i)= 10andIBLOCK(i)=2imply that the i-th eigenvalueW(i)is the 10-th eigenvalue in block 2. Receipts, in code. ๐งพGERSโDOUBLE PRECISION array, dimension (2*N). The N Gerschgorin intervals โ the i-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i)). ๐ฆPIVMINโDOUBLE PRECISION. The minimum pivot in the Sturm sequence forT. Little guy, big job. ๐ซถWORKโDOUBLE PRECISION array, dimension (6*N). Workspace. โจIWORKโINTEGER array, dimension (5*N). Workspace. โจINFOโINTEGER. The vibe report, and it has range:= 0: successful exit ๐> 0: A problem occurred inDLARRE. ๐ญ< 0: One of the called subroutines signaled an internal problem. Needs inspection of the corresponding parameterIINFOfor further information. ๐=-1: Problem inDLARRD.= 2: No base representation could be found inMAXTRYiterations. IncreasingMAXTRYand recompilation might be a remedy.=-3: Problem inDLARRBwhen computing the refined root representation forDLASQ2.=-4: Problem inDLARRBwhen preforming bisection on the desired part of the spectrum.=-5: Problem inDLASQ2.=-6: Problem inDLASQ2.
๐ธ Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
โจ Further Details: โจ
The base representations are required to suffer very little element growth and consequently define all their eigenvalues to high relative accuracy. No cap, they gotta stay humble so the accuracy stays iconic. ๐
๐ซถ Contributors: ๐ซถ
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
๐ subroutine dlarrf ๐
subroutine dlarrf (integer N, double precision, dimension( * ) D, double
precision, dimension( * ) L, double precision, dimension( * ) LD,
integer CLSTRT, integer CLEND, double precision, dimension( * ) W,
double precision, dimension( * ) WGAP, double precision, dimension( * )
WERR, double precision SPDIAM, double precision CLGAPL, double precision
CLGAPR, double precision PIVMIN, double precision SIGMA, double
precision, dimension( * ) DPLUS, double precision, dimension( * ) LPLUS,
double precision, dimension( * ) WORK, integer INFO)
DLARRF finds a new relatively robust representation such that at least one of the eigenvalues is relatively isolated. the way that one eigenvalue gets to be the main character ๐
Purpose:
Given the initial representation L D L^T and its cluster of close eigenvalues (in a relative measure), W( CLSTRT ), W( CLSTRT+1 ), ... W( CLEND ), DLARRF finds a new relatively robust representation
L D L^T - SIGMA I = L(+) D(+) L(+)^T
such that at least one of the eigenvalues of L(+) D(+) L(+)^T is relatively isolated. ๐ฆ
Parameters
NโN is INTEGER. The order of the matrix (subblock, if the matrix split). ๐ธDโD is DOUBLE PRECISION array, dimension (N). The N diagonal elements of the diagonal matrixD. โจLโL is DOUBLE PRECISION array, dimension (N-1). The(N-1)subdiagonal elements of the unit bidiagonal matrixL. ๐LDโLD is DOUBLE PRECISION array, dimension (N-1). The(N-1)elementsL(i)*D(i). ๐ฅCLSTRTโCLSTRT is INTEGER. The index of the first eigenvalue in the cluster. ๐CLENDโCLEND is INTEGER. The index of the last eigenvalue in the cluster. ๐WโW is DOUBLE PRECISION array, dimensionโdimension is >= (CLEND-CLSTRT+1). The eigenvalue APPROXIMATIONS ofL D L^Tin ascending order.W( CLSTRT )throughW( CLEND )form the cluster of relatively close eigenalues. (that typo is theirs, I'm keeping it, no cap) ๐ญWGAPโWGAP is DOUBLE PRECISION array, dimensionโdimension is >= (CLEND-CLSTRT+1). The separation from the right neighbor eigenvalue inW. ๐ฆWERRโWERR is DOUBLE PRECISION array, dimensionโdimension is >= (CLEND-CLSTRT+1).WERRcontain the semiwidth of the uncertainty interval of the corresponding eigenvalue APPROXIMATION inW. so like, how unsure we are, but make it numeric ๐ญSPDIAMโSPDIAM is DOUBLE PRECISION. Estimate of the spectral diameter obtained from the Gerschgorin intervals. ๐CLGAPLโCLGAPL is DOUBLE PRECISION. โจCLGAPRโCLGAPR is DOUBLE PRECISION. Absolute gap on each end of the cluster. Set by the calling routine to protect against shifts too close to eigenvalues outside the cluster. protective queen behavior ๐ก๏ธPIVMINโPIVMIN is DOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence. ๐ซถSIGMAโSIGMA is DOUBLE PRECISION. The shift used to formL(+) D(+) L(+)^T. ๐DPLUSโDPLUS is DOUBLE PRECISION array, dimension (N). The N diagonal elements of the diagonal matrixD(+). โญLPLUSโLPLUS is DOUBLE PRECISION array, dimension (N-1). The first(N-1)elements ofLPLUScontain the subdiagonal elements of the unit bidiagonal matrixL(+). ๐WORKโWORK is DOUBLE PRECISION array, dimension (2*N). Workspace. โจINFOโINFO is INTEGER. Signals processing OK (=0) or failure (=1). binary mood, honestly ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
๐ subroutine dlarrj ๐
subroutine dlarrj (integer N, double precision, dimension( * ) D, double
precision, dimension( * ) E2, integer IFIRST, integer ILAST, double
precision RTOL, integer OFFSET, double precision, dimension( * ) W,
double precision, dimension( * ) WERR, double precision, dimension( * )
WORK, integer, dimension( * ) IWORK, double precision PIVMIN, double
precision SPDIAM, integer INFO)
DLARRJ performs refinement of the initial estimates of the eigenvalues of the matrix T. glow-up arc for your eigenvalues โจ๐
Purpose:
Given the initial eigenvalue approximations of T, DLARRJ does bisection to refine the eigenvalues of T, W( IFIRST-OFFSET ) through W( ILAST-OFFSET ), to more accuracy. Initial guesses for these eigenvalues are input in W, the corresponding estimate of the error in these guesses in WERR. During bisection, intervals [left, right] are maintained by storing their mid-points and semi-widths in the arrays W and WERR respectively. ๐
Parameters
NโN is INTEGER. The order of the matrix. ๐ธDโD is DOUBLE PRECISION array, dimension (N). The N diagonal elements ofT. โจE2โE2 is DOUBLE PRECISION array, dimension (N-1). The Squares of the(N-1)subdiagonal elements ofT. squared, periodt ๐IFIRSTโIFIRST is INTEGER. The index of the first eigenvalue to be computed. ๐ILASTโILAST is INTEGER. The index of the last eigenvalue to be computed. ๐RTOLโRTOL is DOUBLE PRECISION. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged if
RIGHT-LEFT < RTOL*MAX(|LEFT|,|RIGHT|)
that's the vibe check right there, if it passes we're done โ
OFFSETโOFFSET is INTEGER. Offset for the arraysWandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are to be used. ๐ฆWโW is DOUBLE PRECISION array, dimension (N). On input,W( IFIRST-OFFSET )throughW( ILAST-OFFSET )are estimates of the eigenvalues ofL D L^TindexedIFIRSTthroughILAST. On output, these estimates are refined. in: guess. out: slay. ๐WERRโWERR is DOUBLE PRECISION array, dimension (N). On input,WERR( IFIRST-OFFSET )throughWERR( ILAST-OFFSET )are the errors in the estimates of the corresponding elements inW. On output, these errors are refined. ๐WORKโWORK is DOUBLE PRECISION array, dimension (2*N). Workspace. โจIWORKโIWORK is INTEGER array, dimension (2*N). Workspace. โจPIVMINโPIVMIN is DOUBLE PRECISION. The minimum pivot in the Sturm sequence forT. ๐ซถSPDIAMโSPDIAM is DOUBLE PRECISION. The spectral diameter ofT. ๐INFOโINFO is INTEGER. Error flag. short and mysterious, we love her ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
subroutine dlarrk (integer N, integer IW, double precision GL, double precision GU, double precision, dimension( * ) D, double precision, dimension( * ) E2, double precision PIVMIN, double precision RELTOL, double precision W, double precision WERR, integer INFO)
DLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. ๐ฏ
Purpose ๐
ok so bestie, DLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. It's an auxiliary code, and it gets called from DSTEMR. ๐
To avoid overflow, the matrix must be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value โ and for greatest accuracy, it should not be much smaller than that. no cap, scale it right or the vibes are off.
See W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966. ๐
Parameters โจ
Nโ INTEGER. The order of the tridiagonal matrixT.N >= 0.IWโ INTEGER. The index of the eigenvalues to be returned.GLโ DOUBLE PRECISION.GUโ DOUBLE PRECISION.GLandGUare an upper and a lower bound on the eigenvalue.Dโ DOUBLE PRECISION array, dimension(N). Thendiagonal elements of the tridiagonal matrixT. ๐E2โ DOUBLE PRECISION array, dimension(N-1). The(n-1)squared off-diagonal elements of the tridiagonal matrixT.PIVMINโ DOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence forT.RELTOLโ DOUBLE PRECISION. The minimum relative width of an interval. When an interval is narrower thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at leastradix*machine epsilon. ๐ซถWโ DOUBLE PRECISION.WERRโ DOUBLE PRECISION. The error bound on the corresponding eigenvalue approximation inW.INFOโ INTEGER.= 0: Eigenvalue converged โ= -1: Eigenvalue did NOT converge ๐
Internal Parameters ๐
FUDGEโ DOUBLE PRECISION, default= 2. A 'fudge factor' to widen the Gershgorin intervals.
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine dlarrr (integer N, double precision, dimension( * ) D, double precision, dimension( * ) E, integer INFO)
DLARRR performs tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. ๐ง
Purpose ๐
Perform tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. basically it's the vibe check before you spend the big bucks on compute. ๐ธ
Parameters โจ
Nโ INTEGER. The order of the matrix.N > 0.Dโ DOUBLE PRECISION array, dimension(N). TheNdiagonal elements of the tridiagonal matrixT.Eโ DOUBLE PRECISION array, dimension(N). On entry, the first(N-1)entries contain the subdiagonal elements of the tridiagonal matrixT;E(N)is set to ZERO.INFOโ INTEGER.INFO = 0(default): the matrix warrants computations preserving relative accuracy. ๐INFO = 1: the matrix warrants computations guaranteeing only absolute accuracy.
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: ๐ซถ
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
subroutine dlartgp (double precision F, double precision G, double precision CS, double precision SN, double precision R)
DLARTGP generates a plane rotation so that the diagonal is nonnegative. ๐
Purpose ๐
DLARTGP generates a plane rotation so that
[ CS SN ] . [ F ] = [ R ] where CS**2 + SN**2 = 1.
[ -SN CS ] [ G ] [ 0 ]
This is a slower, more accurate version of the Level 1 BLAS routine DROTG, with the following other differences:
FandGare unchanged on return. ๐- If
G=0, thenCS=(+/-)1andSN=0. - If
F=0and(G .ne. 0), thenCS=0andSN=(+/-)1.
The sign is chosen so that R >= 0. โจ
Parameters ๐
Fโ DOUBLE PRECISION. The first component of vector to be rotated.Gโ DOUBLE PRECISION. The second component of vector to be rotated.CSโ DOUBLE PRECISION. The cosine of the rotation.SNโ DOUBLE PRECISION. The sine of the rotation.Rโ DOUBLE PRECISION. The nonzero component of the rotated vector.
This version has a few statements commented out for thread safety (machine parameters are computed on each entry). 10 feb 03, SJH. ๐งต
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine dlaruv (integer, dimension( 4 ) ISEED, integer N, double precision, dimension( n ) X)
DLARUV returns a vector of n random real numbers from a uniform distribution. ๐ฒ
Purpose ๐
DLARUV returns a vector of n random real numbers from a uniform (0,1) distribution (n <= 128).
This is an auxiliary routine called by DLARNV and ZLARNV. ๐ฆ
Parameters โจ
ISEEDโ INTEGER array, dimension(4). On entry, the seed of the random number generator; the array elements must be between0and4095, andISEED(4)must be odd. On exit, the seed is updated. yes bestie, it has to be odd, don't fight it.Nโ INTEGER. The number of random numbers to be generated.N <= 128.Xโ DOUBLE PRECISION array, dimension(N). The generated random numbers. ๐ฅ
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: ๐
This routine uses a multiplicative congruential method with modulus 2**48 and multiplier 33952834046453 (see G.S.Fishman, 'Multiplicative congruential random number generators with modulus 2**b: an exhaustive analysis for b = 32 and a partial analysis for b = 48', Math. Comp. 189, pp 331-344, 1990).
48-bit integers are stored in 4 integer array elements with 12 bits per element. Hence the routine is portable across machines with integers of 32 bits or more. ๐
subroutine dlas2 (double precision F, double precision G, double precision H, double precision SSMIN, double precision SSMAX)
DLAS2 computes singular values of a 2-by-2 triangular matrix. ๐บ
Purpose ๐
DLAS2 computes the singular values of the 2-by-2 matrix
[ F G ]
[ 0 H ].
On return, SSMIN is the smaller singular value and SSMAX is the larger singular value. two little numbers, one big glow-up. โจ
Parameters ๐
Fโ DOUBLE PRECISION. The(1,1)element of the 2-by-2 matrix.Gโ DOUBLE PRECISION. The(1,2)element of the 2-by-2 matrix.Hโ DOUBLE PRECISION. The(2,2)element of the 2-by-2 matrix.SSMINโ DOUBLE PRECISION. The smaller singular value.SSMAXโ DOUBLE PRECISION. The larger singular value.
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: ๐
Barring over/underflow, all output quantities are correct to within a few units in the last place (ulps), even in the absence of a guard digit in addition/subtraction. ๐
In IEEE arithmetic, the code works correctly if one matrix element is infinite. โพ๏ธ
Overflow will not occur unless the largest singular value itself overflows, or is within a few ulps of overflow. (On machines with partial overflow, like the Cray, overflow may occur if the largest singular value is within a factor of 2 of overflow.) ๐
Underflow is harmless if underflow is gradual. Otherwise, results may correspond to a matrix modified by perturbations of size near the underflow threshold.
subroutine dlascl (character TYPE, integer KL, integer KU, double precision CFROM, double precision CTO, integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer INFO)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom. โ๏ธ
Purpose ๐
DLASCL multiplies the M by N real matrix A by the real scalar CTO/CFROM. This is done without over/underflow as long as the final result CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that A may be full, upper triangular, lower triangular, upper Hessenberg, or banded. versatile queen behavior ๐
Parameters โจ
TYPEโ CHARACTER*1.TYPEindices the storage type of the input matrix.= 'G':Ais a full matrix.= 'L':Ais a lower triangular matrix.= 'U':Ais an upper triangular matrix.= 'H':Ais an upper Hessenberg matrix.= 'B':Ais a symmetric band matrix with lower bandwidthKLand upper bandwidthKUand with the only the lower half stored.= 'Q':Ais a symmetric band matrix with lower bandwidthKLand upper bandwidthKUand with the only the upper half stored.= 'Z':Ais a band matrix with lower bandwidthKLand upper bandwidthKU. SeeDGBTRFfor storage details.
KLโKLโ is INTEGER. The lower bandwidth of A. Only gets referenced ifTYPE = 'B','Q'or'Z', bestie. otherwise it's just chilling, unbothered ๐KUโ is INTEGER. The upper bandwidth of A. Also only referenced ifTYPE = 'B','Q'or'Z'. same energy, no notes โจCFROMโ is DOUBLE PRECISION.CTOโ is DOUBLE PRECISION.
The matrix A gets multiplied by CTO/CFROM. A(I,J) is computed without over/underflow if the final result CTO*A(I,J)/CFROM can be represented without over/underflow. CFROM must be nonzero. (like fr fr, if CFROM is zero we're literally dividing by zero and the whole thing is cooked ๐ญ)
Mโ is INTEGER. The number of rows of the matrix A.M >= 0.Nโ is INTEGER. The number of columns of the matrix A.N >= 0.Aโ is DOUBLE PRECISION array, dimension(LDA,N). The matrix to be multiplied byCTO/CFROM. SeeTYPEfor the storage type, iykyk.LDAโ is INTEGER. The leading dimension of the array A.- If
TYPE = 'G','L','U','H',LDA >= max(1,M); TYPE = 'B',LDA >= KL+1;TYPE = 'Q',LDA >= KU+1;TYPE = 'Z',LDA >= 2*KL+KU+1.
- If
INFOโ is INTEGER.0โ successful exit ๐<0โ ifINFO = -i, the i-th argument had an illegal value. (not iconic of you, honestly ๐)
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ subroutine dlasd0 ๐ฆ
subroutine dlasd0 (integer N, integer SQRE, double precision, dimension( * )
D, double precision, dimension( * ) E, double precision, dimension( ldu,
* ) U, integer LDU, double precision, dimension( ldvt, * ) VT, integer
LDVT, integer SMLSIZ, integer, dimension( * ) IWORK, double precision,
dimension( * ) WORK, integer INFO)
DLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e. Used by sbdsdc. (yes she's a supporting character, but she EATS every time ๐)
๐ซ Purpose ๐ซ
Using a divide and conquer approach, DLASD0 computes the singular value decomposition (SVD) of a real upper bidiagonal N-by-M matrix B with diagonal D and offdiagonal E, where M = N + SQRE. The algorithm computes orthogonal matrices U and VT such that B = U * S * VT. The singular values S are overwritten on D.
A related subroutine, DLASDA, computes only the singular values, and optionally, the singular vectors in compact form.
๐ Parameters ๐
Nโ is INTEGER. On entry, the row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal array D.SQREโ is INTEGER. Specifies the column dimension of the bidiagonal matrix.= 0: The bidiagonal matrix has column dimensionM = N;= 1: The bidiagonal matrix has column dimensionM = N+1;
Dโ is DOUBLE PRECISION array, dimension(N). On entry D contains the main diagonal of the bidiagonal matrix. On exit D, ifINFO = 0, contains its singular values. โจglow upโจEโ is DOUBLE PRECISION array, dimension(M-1). Contains the subdiagonal entries of the bidiagonal matrix. On exit, E has been destroyed. (rip E, she didn't make it ๐ญ)Uโ is DOUBLE PRECISION array, dimension(LDU, N). On exit, U contains the left singular vectors. main character behavior tbh ๐LDUโ is INTEGER. On entry, leading dimension of U.VTโ is DOUBLE PRECISION array, dimension(LDVT, M). On exit,VT**Tcontains the right singular vectors.LDVTโ is INTEGER. On entry, leading dimension of VT.SMLSIZโ is INTEGER. On entry, maximum size of the subproblems at the bottom of the computation tree. (the little leaves at the bottom of the recursion tree, so cute ๐ธ)IWORKโ is INTEGER array, dimension(8*N)WORKโ is DOUBLE PRECISION array, dimension(3*M**2+2*M)INFOโ is INTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. (she's being stubborn, we hate to see it ๐)
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors ๐
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine dlasd1 ๐
subroutine dlasd1 (integer NL, integer NR, integer SQRE, double precision,
dimension( * ) D, double precision ALPHA, double precision BETA, double
precision, dimension( ldu, * ) U, integer LDU, double precision,
dimension( ldvt, * ) VT, integer LDVT, integer, dimension( * ) IDXQ,
integer, dimension( * ) IWORK, double precision, dimension( * ) WORK,
integer INFO)
DLASD1 computes the SVD of an upper bidiagonal matrix B of the specified size. Used by sbdsdc. (another baddie on the support squad, we love to see it ๐ซถ)
โญ Purpose โญ
DLASD1 computes the SVD of an upper bidiagonal N-by-M matrix B, where N = NL + NR + 1 and M = N + SQRE. DLASD1 is called from DLASD0.
A related subroutine DLASD7 handles the case in which the singular values (and the singular vectors in factored form) are desired.
DLASD1 computes the SVD as follows:
( D1(in) 0 0 0 )
B = U(in) * ( Z1**T a Z2**T b ) * VT(in)
( 0 0 D2(in) 0 )
= U(out) * ( D(out) 0) * VT(out)
where Z**T = (Z1**T a Z2**T b) = u**T VT**T, and u is a vector of dimension M with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros elsewhere; and the entry b is empty if SQRE = 0.
The left singular vectors of the original matrix are stored in U, and the transpose of the right singular vectors are stored in VT, and the singular values are in D. The algorithm consists of three stages:
- The first stage consists of deflating the size of the problem when there are multiple singular values or when there are zeros in the Z vector. For each such occurrence the dimension of the secular equation problem is reduced by one. This stage is performed by the routine
DLASD2. - The second stage consists of calculating the updated singular values. This is done by finding the square roots of the roots of the secular equation via the routine
DLASD4(as called byDLASD3). This routine also calculates the singular vectors of the current problem. - The final stage consists of computing the updated singular vectors directly using the updated singular values. The singular vectors for the current problem are multiplied with the singular vectors from the overall problem.
๐ Parameters ๐
NLโ is INTEGER. The row dimension of the upper block.NL >= 1.NRโ is INTEGER. The row dimension of the lower block.NR >= 1.SQREโ is INTEGER.= 0: the lower block is an NR-by-NR square matrix.= 1: the lower block is an NR-by-(NR+1) rectangular matrix.
The bidiagonal matrix has row dimension N = NL + NR + 1, and column dimension M = N + SQRE.
Dโ is DOUBLE PRECISION array, dimension(N = NL+NR+1). On entryD(1:NL,1:NL)contains the singular values of the upper block; andD(NL+2:N)contains the singular values of the lower block. On exitD(1:N)contains the singular values of the modified matrix. โจALPHAโ is DOUBLE PRECISION. Contains the diagonal element associated with the added row.BETAโ is DOUBLE PRECISION. Contains the off-diagonal element associated with the added row.Uโ is DOUBLE PRECISION array, dimension(LDU,N). On entryU(1:NL, 1:NL)contains the left singular vectors of the upper block;U(NL+2:N, NL+2:N)contains the left singular vectors of the lower block. On exit U contains the left singular vectors of the bidiagonal matrix.LDUโ is INTEGER. The leading dimension of the array U.LDU >= max( 1, N ).VTโ is DOUBLE PRECISION array, dimension(LDVT,M)whereM = N + SQRE. On entryVT(1:NL+1, 1:NL+1)**Tcontains the right singular vectors of the upper block;VT(NL+2:M, NL+2:M)**Tcontains the right singular vectors of the lower block. On exitVT**Tcontains the right singular vectors of the bidiagonal matrix.LDVTโ is INTEGER. The leading dimension of the array VT.LDVT >= max( 1, M ).IDXQโ is INTEGER array, dimension(N). This contains the permutation which will reintegrate the subproblem just solved back into sorted order, i.e.D( IDXQ( I = 1, N ) )will be in ascending order. (putting the vibes back in order, we love a lil sort moment ๐ฆ)IWORKโ is INTEGER array, dimension( 4 * N )WORKโ is DOUBLE PRECISION array, dimension( 3*M**2 + 2*M )INFOโ is INTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. ๐
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors ๐
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
subroutine dlasd2 โจ
subroutine dlasd2 (integer NL, integer NR, integer SQRE, integer K, double
precision, dimension( * ) D, double precision, dimension( * ) Z, double
precision ALPHA, double precision BETA, double precision, dimension(
ldu, * ) U, integer LDU, double precision, dimension( ldvt, * ) VT,
integer LDVT, double precision, dimension( * ) DSIGMA, double precision,
dimension( ldu2, * ) U2, integer LDU2, double precision, dimension(
ldvt2, * ) VT2, integer LDVT2, integer, dimension( * ) IDXP, integer,
dimension( * ) IDX, integer, dimension( * ) IDXC, integer, dimension( *
) IDXQ, integer, dimension( * ) COLTYP, integer INFO)
okay so bestie, DLASD2 merges the two sets of singular values together into a single sorted set. It's used by sbdsdc. ๐
Purpose ๐ฏ
DLASD2 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one.
DLASD2 is called from DLASD1. ๐
Parameters ๐
NLโNLis INTEGER. The row dimension of the upper block.NL >= 1. ๐NRโNRis INTEGER. The row dimension of the lower block.NR >= 1. ๐SQREโSQREis INTEGER. = 0: the lower block is an NR-by-NR square matrix. = 1: the lower block is an NR-by-(NR+1) rectangular matrix. The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns. โจKโKis INTEGER. Contains the dimension of the non-deflated matrix, This is the order of the related secular equation. 1 <= K <=N. ๐DโDis DOUBLE PRECISION array, dimension(N). On entry D contains the singular values of the two submatrices to be combined. On exit D contains the trailing (N-K) updated singular values (those which were deflated) sorted into increasing order. ๐ฆZโZis DOUBLE PRECISION array, dimension(N). On exit Z contains the updating row vector in the secular equation. ๐ALPHAโALPHAis DOUBLE PRECISION. Contains the diagonal element associated with the added row. ๐ธBETAโBETAis DOUBLE PRECISION. Contains the off-diagonal element associated with the added row. ๐ธUโUis DOUBLE PRECISION array, dimension(LDU,N). On entry U contains the left singular vectors of two submatrices in the two square blocks with corners at (1,1), (NL, NL), and (NL+2, NL+2), (N,N). On exit U contains the trailing (N-K) updated left singular vectors (those which were deflated) in its last N-K columns. ๐LDUโLDUis INTEGER. The leading dimension of the array U.LDU >= N. ๐VTโVTis DOUBLE PRECISION array, dimension(LDVT,M). On entry VTT contains the right singular vectors of two submatrices in the two square blocks with corners at (1,1), (NL+1, NL+1), and (NL+2, NL+2), (M,M). On exit VTT contains the trailing (N-K) updated right singular vectors (those which were deflated) in its last N-K columns. In case SQRE =1, the last row of VT spans the right null space. ๐ฆLDVTโLDVTis INTEGER. The leading dimension of the array VT.LDVT >= M. ๐ฆDSIGMAโDSIGMAis DOUBLE PRECISION array, dimension (N). Contains a copy of the diagonal elements (K-1 singular values and one zero) in the secular equation. ๐ซU2โU2is DOUBLE PRECISION array, dimension(LDU2,N). Contains a copy of the first K-1 left singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new left singular vectors. U2 is arranged into four blocks. The first block contains a column with 1 at NL+1 and zero everywhere else; the second block contains non-zero entries only at and above NL; the third contains non-zero entries only below NL+1; and the fourth is dense. ๐ฅLDU2โLDU2is INTEGER. The leading dimension of the array U2.LDU2 >= N. ๐ฅVT2โVT2is DOUBLE PRECISION array, dimension(LDVT2,N). VT2**T contains a copy of the first K right singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new right singular vectors. VT2 is arranged into three blocks. The first block contains a row that corresponds to the special 0 diagonal element in SIGMA; the second block contains non-zeros only at and before NL +1; the third block contains non-zeros only at and after NL +2. ๐LDVT2โLDVT2is INTEGER. The leading dimension of the array VT2.LDVT2 >= M. ๐IDXPโIDXPis INTEGER array, dimension(N). This will contain the permutation used to place deflated values of D at the end of the array. On output IDXP(2:K) points to the nondeflated D-values and IDXP(K+1:N) points to the deflated singular values. ๐บ๏ธIDXโIDXis INTEGER array, dimension(N). This will contain the permutation used to sort the contents of D into ascending order. ๐บ๏ธIDXCโIDXCis INTEGER array, dimension(N). This will contain the permutation used to arrange the columns of the deflated U matrix into three groups: the first group contains non-zero entries only at and above NL, the second contains non-zero entries only below NL+2, and the third is dense. ๐บ๏ธIDXQโIDXQis INTEGER array, dimension(N). This contains the permutation which separately sorts the two sub-problems in D into ascending order. Note that entries in the first half of this permutation must first be moved one position backward; and entries in the second half must first have NL+1 added to their values. ๐บ๏ธCOLTYPโCOLTYPis INTEGER array, dimension(N). As workspace, this will contain a label which will indicate which of the following types a column in the U2 matrix or a row in the VT2 matrix is: 1 : non-zero in the upper half only; 2 : non-zero in the lower half only; 3 : dense; 4 : deflated. On exit, it is an array of dimension 4, with COLTYP(I) being the dimension of the I-th type columns. ๐จINFOโINFOis INTEGER. = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. ๐จ
Author โ๏ธ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors ๐ซถ
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
subroutine dlasd3 โจ
subroutine dlasd3 (integer NL, integer NR, integer SQRE, integer K, double
precision, dimension( * ) D, double precision, dimension( ldq, * ) Q,
integer LDQ, double precision, dimension( * ) DSIGMA, double precision,
dimension( ldu, * ) U, integer LDU, double precision, dimension( ldu2, *
) U2, integer LDU2, double precision, dimension( ldvt, * ) VT, integer
LDVT, double precision, dimension( ldvt2, * ) VT2, integer LDVT2,
integer, dimension( * ) IDXC, integer, dimension( * ) CTOT, double
precision, dimension( * ) Z, integer INFO)
okay so DLASD3 finds all square roots of the roots of the secular equation, as defined by the values in D and Z, and then updates the singular vectors by matrix multiplication. Used by sbdsdc. ๐
Purpose ๐ฏ
DLASD3 finds all the square roots of the roots of the secular equation, as defined by the values in D and Z. It makes the appropriate calls to DLASD4 and then updates the singular vectors by matrix multiplication.
This code makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray XMP, Cray YMP, Cray C 90, or Cray 2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none. ๐ญ
DLASD3 is called from DLASD1. ๐
Parameters ๐
NLโNLis INTEGER. The row dimension of the upper block.NL >= 1. ๐NRโNRis INTEGER. The row dimension of the lower block.NR >= 1. ๐SQREโSQREis INTEGER. = 0: the lower block is an NR-by-NR square matrix. = 1: the lower block is an NR-by-(NR+1) rectangular matrix. The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns. โจKโKis INTEGER. The size of the secular equation, 1 =< K = < N. ๐DโDis DOUBLE PRECISION array, dimension(K). On exit the square roots of the roots of the secular equation, in ascending order. ๐ฆQโQis DOUBLE PRECISION array, dimension (LDQ,K). ๐ธLDQโLDQis INTEGER. The leading dimension of the array Q.LDQ >= K. ๐ธDSIGMAโDSIGMAis DOUBLE PRECISION array, dimension(K). The first K elements of this array contain the old roots of the deflated updating problem. These are the poles of the secular equation. ๐ซUโUis DOUBLE PRECISION array, dimension (LDU, N). The last N - K columns of this matrix contain the deflated left singular vectors. ๐LDUโLDUis INTEGER. The leading dimension of the array U.LDU >= N. ๐U2โU2is DOUBLE PRECISION array, dimension (LDU2, N). The first K columns of this matrix contain the non-deflated left singular vectors for the split problem. ๐ฅLDU2๐ฅLDU2โ is INTEGER. The leading dimension of the arrayU2.LDU2 >= N. ๐VTโ is DOUBLE PRECISION array, dimension(LDVT, M). The lastM - Kcolumns ofVT**Tcontain the deflated right singular vectors. โจLDVTโ is INTEGER. The leading dimension of the arrayVT.LDVT >= N.VT2โ is DOUBLE PRECISION array, dimension(LDVT2, N). The firstKcolumns ofVT2**Tcontain the non-deflated right singular vectors for the split problem. ๐ฆLDVT2โ is INTEGER. The leading dimension of the arrayVT2.LDVT2 >= N.IDXCโ is INTEGER array, dimension( N ). The permutation used to arrange the columns ofU(and rows ofVT) into three groups: the first group contains non-zero entries only at and above (or before)NL +1; the second contains non-zero entries only at and below (or after)NL+2; and the third is dense. The first column ofUand the row ofVTare treated separately, however. ๐
The rows of the singular vectors found by DLASD4 must be likewise permuted before the matrix multiplies can take place. fr fr.
CTOTโ is INTEGER array, dimension( 4 ). A count of the total number of the various types of columns inU(or rows inVT), as described inIDXC. The fourth column type is any column which has been deflated. ๐Zโ is DOUBLE PRECISION array, dimension(K). The firstKelements of this array contain the components of the deflation-adjusted updating row vector.INFOโ is INTEGER= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge ๐ญ
๐ซถ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ธ Contributors
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐งฎ subroutine dlasd4
subroutine dlasd4 (integer N, integer I, double precision, dimension( * ) D,
double precision, dimension( * ) Z, double precision, dimension( * )
DELTA, double precision RHO, double precision SIGMA, double precision,
dimension( * ) WORK, integer INFO)
DLASD4 computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix. Used by dbdsdc. no cap ๐
Purpose:
This subroutine computes the square root of the I-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix whose entries are given as the squares of the corresponding entries in the array d, and that
0 <= D(i) < D(j) for i < j
and that RHO > 0. This is arranged by the calling routine, and is no loss in generality. The rank-one modified system is thus
diag( D ) * diag( D ) + RHO * Z * Z_transpose.
where we assume the Euclidean norm of Z is 1.
The method consists of approximating the rational functions in the secular equation by simpler interpolating rational functions. it's giving โจmathโจ
Parameters:
Nโ is INTEGER. The length of all arrays.Iโ is INTEGER. The index of the eigenvalue to be computed.1 <= I <= N.Dโ is DOUBLE PRECISION array, dimension( N ). The original eigenvalues. It is assumed that they are in order,0 <= D(I) < D(J)forI < J. ๐Zโ is DOUBLE PRECISION array, dimension( N ). The components of the updating vector.DELTAโ is DOUBLE PRECISION array, dimension( N ). IfN .ne. 1,DELTAcontains(D(j) - sigma_I)in its j-th component. IfN = 1, thenDELTA(1) = 1. The vectorDELTAcontains the information necessary to construct the (singular) eigenvectors.RHOโ is DOUBLE PRECISION. The scalar in the symmetric updating formula.SIGMAโ is DOUBLE PRECISION. The computedsigma_I, the I-th updated eigenvalue.WORKโ is DOUBLE PRECISION array, dimension( N ). IfN .ne. 1,WORKcontains(D(j) + sigma_I)in its j-th component. IfN = 1, thenWORK( 1 ) = 1.INFOโ is INTEGER= 0: successful exit.> 0: ifINFO = 1, the updating process failed. ๐
Internal Parameters:
Logical variable ORGATI (origin-at-i?) is used for distinguishing whether D(i) or D(i+1) is treated as the origin.
ORGATI = .true. origin at i
ORGATI = .false. origin at i+1
Logical variable SWTCH3 (switch-for-3-poles?) is for noting if we are working with THREE poles! ๐
MAXIT is the maximum number of iterations allowed for each eigenvalue.
๐ซถ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ธ Contributors
Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA
๐งฎ subroutine dlasd5
subroutine dlasd5 (integer I, double precision, dimension( 2 ) D, double
precision, dimension( 2 ) Z, double precision, dimension( 2 ) DELTA,
double precision RHO, double precision DSIGMA, double precision,
dimension( 2 ) WORK)
DLASD5 computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix. Used by sbdsdc. tiny problem, big energy ๐
Purpose:
This subroutine computes the square root of the I-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix
diag( D ) * diag( D ) + RHO * Z * transpose(Z) .
The diagonal entries in the array D are assumed to satisfy
0 <= D(i) < D(j) for i < j .
We also assume RHO > 0 and that the Euclidean norm of the vector Z is one. ๐ฆ
Parameters:
Iโ is INTEGER. The index of the eigenvalue to be computed.I = 1orI = 2.Dโ is DOUBLE PRECISION array, dimension( 2 ). The original eigenvalues. We assume0 <= D(1) < D(2).Zโ is DOUBLE PRECISION array, dimension( 2 ). The components of the updating vector.DELTAโ is DOUBLE PRECISION array, dimension( 2 ). Contains(D(j) - sigma_I)in its j-th component. The vectorDELTAcontains the information necessary to construct the eigenvectors.RHOโ is DOUBLE PRECISION. The scalar in the symmetric updating formula.DSIGMAโ is DOUBLE PRECISION. The computedsigma_I, the I-th updated eigenvalue.WORKโ is DOUBLE PRECISION array, dimension( 2 ).WORKcontains(D(j) + sigma_I)in its j-th component.
๐ซถ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ธ Contributors
Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA
๐งฎ subroutine dlasd6
subroutine dlasd6 (integer ICOMPQ, integer NL, integer NR, integer SQRE,
double precision, dimension( * ) D, double precision, dimension( * ) VF,
double precision, dimension( * ) VL, double precision ALPHA, double
precision BETA, integer, dimension( * ) IDXQ, integer, dimension( * )
PERM, integer GIVPTR, integer, dimension( ldgcol, * ) GIVCOL, integer
LDGCOL, double precision, dimension( ldgnum, * ) GIVNUM, integer LDGNUM,
double precision, dimension( ldgnum, * ) POLES, double precision,
dimension( * ) DIFL, double precision, dimension( * ) DIFR, double
precision, dimension( * ) Z, integer K, double precision C, double
precision S, double precision, dimension( * ) WORK, integer, dimension(
* ) IWORK, integer INFO)
DLASD6 computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used by sbdsdc. ๐ฅ
Purpose:
DLASD6 computes the SVD of an updated upper bidiagonal matrix B obtained by merging two smaller ones by appending a row. This routine is used only for the problem which requires all singular values and optionally singular vector matrices in factored form. B is an N-by-M matrix with N = NL + NR + 1 and M = N + SQRE. A related subroutine, DLASD1, handles the case in which all singular values and singular vectors of the bidiagonal matrix are desired.
DLASD6 computes the SVD as follows:
( D1(in) 0 0 0 )
B = U(in) * ( Z1**T a Z2**T b ) * VT(in)
( 0 0 D2(in) 0 )
= U(out) * ( D(out) 0) * VT(out)
where Z**T = (Z1**T a Z2**T b) = u**T VT**T, and u is a vector of dimension M with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros elsewhere; and the entry b is empty if SQRE = 0.
The singular values of B can be computed using D1, D2, the first components of all the right singular vectors of the lower block, and the last components of all the right singular vectors of the upper block. These components are stored and updated in VF and VL, respectively, in DLASD6. Hence U and VT are not explicitly referenced. ๐
The singular values are stored in D. The algorithm consists of two stages:
- The first stage consists of deflating the size of the problem when there are multiple singular values or if there is a zero in the
Zvector. For each such occurrence the dimension of the secular equation problem is reduced by one. This stage is performed by the routineDLASD7. - The second stage consists of calculating the updated singular values. This is done by finding the roots of the secular equation via the routine
DLASD4(as called byDLASD8). This routine also updatesVFandVLand computes the distances between the updated singular values and the old singular values. ๐
DLASD6 is called from DLASDA.
Parameters:
ICOMPQโICOMPQโICOMPQ is INTEGER. It's the vibe check for singular vectors, bestie: are we computing them in factored form or not? ๐= 0: Compute singular values only.= 1: Compute singular vectors in factored form as well.
NLโNL is INTEGER. The row dimension of the upper block.NL >= 1. No cap.NRโNR is INTEGER. The row dimension of the lower block.NR >= 1. Periodt.SQREโSQRE is INTEGER. This one's giving shape energy:= 0: the lower block is an NR-by-NR square matrix.= 1: the lower block is an NR-by-(NR+1) rectangular matrix.
The bidiagonal matrix has row dimension N = NL + NR + 1, and column dimension M = N + SQRE. ๐ฅ
DโD is DOUBLE PRECISION array, dimension ( NL+NR+1 ). On entryD(1:NL,1:NL)contains the singular values of the upper block, andD(NL+2:N)contains the singular values of the lower block. On exitD(1:N)contains the singular values of the modified matrix. She's booked and busy. โจVFโVF is DOUBLE PRECISION array, dimension ( M ). On entry,VF(1:NL+1)contains the first components of all right singular vectors of the upper block; andVF(NL+2:M)contains the first components of all right singular vectors of the lower block. On exit,VFcontains the first components of all right singular vectors of the bidiagonal matrix. ๐VLโVL is DOUBLE PRECISION array, dimension ( M ). On entry,VL(1:NL+1)contains the last components of all right singular vectors of the upper block; andVL(NL+2:M)contains the last components of all right singular vectors of the lower block. On exit,VLcontains the last components of all right singular vectors of the bidiagonal matrix. ๐ฆALPHAโALPHA is DOUBLE PRECISION. Contains the diagonal element associated with the added row. ๐BETAโBETA is DOUBLE PRECISION. Contains the off-diagonal element associated with the added row. ๐IDXQโIDXQ is INTEGER array, dimension ( N ). This contains the permutation which will reintegrate the subproblem just solved back into sorted order, i.e.D( IDXQ( I = 1, N ) )will be in ascending order. It's the glow-up to sorted order. ๐PERMโPERM is INTEGER array, dimension ( N ). The permutations (from deflation and sorting) to be applied to each block. Not referenced ifICOMPQ = 0. ๐ซถGIVPTRโGIVPTR is INTEGER. The number of Givens rotations which took place in this subproblem. Not referenced ifICOMPQ = 0. ๐GIVCOLโGIVCOL is INTEGER array, dimension ( LDGCOL, 2 ). Each pair of numbers indicates a pair of columns to take place in a Givens rotation. Not referenced ifICOMPQ = 0. ๐LDGCOLโLDGCOL is INTEGER. leading dimension ofGIVCOL, must be at leastN. ๐งGIVNUMโGIVNUM is DOUBLE PRECISION array, dimension ( LDGNUM, 2 ). Each number indicates theCorSvalue to be used in the corresponding Givens rotation. Not referenced ifICOMPQ = 0. ๐LDGNUMโLDGNUM is INTEGER. The leading dimension ofGIVNUMandPOLES, must be at leastN. ๐ธPOLESโPOLES is DOUBLE PRECISION array, dimension ( LDGNUM, 2 ). On exit,POLES(1,*)is an array containing the new singular values obtained from solving the secular equation, andPOLES(2,*)is an array containing the poles in the secular equation. Not referenced ifICOMPQ = 0. โญDIFLโDIFL is DOUBLE PRECISION array, dimension ( N ). On exit,DIFL(I)is the distance between I-th updated (undeflated) singular value and the I-th (undeflated) old singular value. ๐DIFRโDIFR is DOUBLE PRECISION array,dimension( LDDIFR, 2 )ifICOMPQ = 1and dimension( K )ifICOMPQ = 0. On exit,DIFR(I,1) = D(I) - DSIGMA(I+1),DIFR(K,1)is not defined and will not be referenced. IfICOMPQ = 1,DIFR(1:K,2)is an array containing the normalizing factors for the right singular vector matrix. SeeDLASD8for details onDIFLandDIFR. ๐ZโZ is DOUBLE PRECISION array, dimension ( M ). The first elements of this array contain the components of the deflation-adjusted updating row vector. ๐KโK is INTEGER. Contains the dimension of the non-deflated matrix, This is the order of the related secular equation.1 <= K <=N. ๐CโC is DOUBLE PRECISION.Ccontains garbage ifSQRE =0and the C-value of a Givens rotation related to the right null space ifSQRE = 1. ๐๏ธSโS is DOUBLE PRECISION.Scontains garbage ifSQRE =0and the S-value of a Givens rotation related to the right null space ifSQRE = 1. ๐๏ธWORKโWORK is DOUBLE PRECISION array, dimension ( 4 * M ). ๐ ๏ธIWORKโIWORK is INTEGER array, dimension ( 3 * N ). ๐ ๏ธINFOโINFO is INTEGER. The receipts:= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. ๐ญ
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
subroutine dlasd7
subroutine dlasd7 (integer ICOMPQ, integer NL, integer NR, integer SQRE,
integer K, double precision, dimension( * ) D, double precision,
dimension( * ) Z, double precision, dimension( * ) ZW, double precision,
dimension( * ) VF, double precision, dimension( * ) VFW, double
precision, dimension( * ) VL, double precision, dimension( * ) VLW,
double precision ALPHA, double precision BETA, double precision,
dimension( * ) DSIGMA, integer, dimension( * ) IDX, integer, dimension(
* ) IDXP, integer, dimension( * ) IDXQ, integer, dimension( * ) PERM,
integer GIVPTR, integer, dimension( ldgcol, * ) GIVCOL, integer LDGCOL,
double precision, dimension( ldgnum, * ) GIVNUM, integer LDGNUM, double
precision C, double precision S, integer INFO)
DLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. Used by sbdsdc. โจ
Purpose
DLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one. ๐
DLASD7 is called from DLASD6. No cap.
Parameters
ICOMPQโICOMPQ is INTEGER. Specifies whether singular vectors are to be computed in compact form, as follows:= 0: Compute singular values only.= 1: Compute singular vectors of upper bidiagonal matrix in compact form.
NLโNL is INTEGER. The row dimension of the upper block.NL >= 1.NRโNR is INTEGER. The row dimension of the lower block.NR >= 1.SQREโSQRE is INTEGER.= 0: the lower block is an NR-by-NR square matrix.= 1: the lower block is an NR-by-(NR+1) rectangular matrix.
The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns.
KโK is INTEGER. Contains the dimension of the non-deflated matrix, this is the order of the related secular equation.1 <= K <=N.DโD is DOUBLE PRECISION array, dimension ( N ). On entryDcontains the singular values of the two submatrices to be combined. On exitDcontains the trailing (N-K) updated singular values (those which were deflated) sorted into increasing order.ZโZ is DOUBLE PRECISION array, dimension ( M ). On exitZcontains the updating row vector in the secular equation.ZWโZW is DOUBLE PRECISION array, dimension ( M ). Workspace forZ.VFโVF is DOUBLE PRECISION array, dimension ( M ). On entry,VF(1:NL+1)contains the first components of all right singular vectors of the upper block; andVF(NL+2:M)contains the first components of all right singular vectors of the lower block. On exit,VFcontains the first components of all right singular vectors of the bidiagonal matrix.VFWโVFW is DOUBLE PRECISION array, dimension ( M ). Workspace forVF.VLโVL is DOUBLE PRECISION array, dimension ( M ). On entry,VL(1:NL+1)contains the last components of all right singular vectors of the upper block; andVL(NL+2:M)contains the last components of all right singular vectors of the lower block. On exit,VLcontains the last components of all right singular vectors of the bidiagonal matrix.VLWโVLW is DOUBLE PRECISION array, dimension ( M ). Workspace forVL.ALPHAโALPHA is DOUBLE PRECISION. Contains the diagonal element associated with the added row.BETAโBETA is DOUBLE PRECISION. Contains the off-diagonal element associated with the added row.DSIGMAโDSIGMA is DOUBLE PRECISION array, dimension ( N ). Contains a copy of the diagonal elements (K-1 singular values and one zero) in the secular equation.IDXโ ...IDXโ it's anINTEGERarray, dimension( N ). This will contain the permutation used to sort the contents ofDinto ascending order. โจIDXPโINTEGERarray, dimension( N ). This will contain the permutation used to place deflated values ofDat the end of the array. On output,IDXP(2:K)points to the nondeflatedD-values andIDXP(K+1:N)points to the deflated singular values. ๐IDXQโINTEGERarray, dimension( N ). This contains the permutation which separately sorts the two sub-problems inDinto ascending order. Ok so listen, important little detail here: entries in the first half of this permutation must first be moved one position backward, and entries in the second half must first haveNL+1added to their values. ๐ซถPERMโINTEGERarray, dimension( N ). The permutations (from deflation and sorting) to be applied to each singular block. Not referenced ifICOMPQ = 0. ๐GIVPTRโINTEGER. The number of Givens rotations which took place in this subproblem. Not referenced ifICOMPQ = 0. ๐ธGIVCOLโINTEGERarray, dimension( LDGCOL, 2 ). Each pair of numbers indicates a pair of columns to take place in a Givens rotation. Not referenced ifICOMPQ = 0.LDGCOLโINTEGER. The leading dimension ofGIVCOL, must be at leastN.GIVNUMโDOUBLE PRECISIONarray, dimension( LDGNUM, 2 ). Each number indicates theCorSvalue to be used in the corresponding Givens rotation. Not referenced ifICOMPQ = 0.LDGNUMโINTEGER. The leading dimension ofGIVNUM, must be at leastN.CโDOUBLE PRECISION.Ccontains garbage ifSQRE = 0and theC-value of a Givens rotation related to the right null space ifSQRE = 1. ๐ bestie do not read that value, it's giving nothing.SโDOUBLE PRECISION.Scontains garbage ifSQRE = 0and theS-value of a Givens rotation related to the right null space ifSQRE = 1.INFOโINTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine dlasd8
subroutine dlasd8 (integer ICOMPQ, integer K, double precision, dimension( *
) D, double precision, dimension( * ) Z, double precision, dimension( *
) VF, double precision, dimension( * ) VL, double precision, dimension(
* ) DIFL, double precision, dimension( lddifr, * ) DIFR, integer LDDIFR,
double precision, dimension( * ) DSIGMA, double precision, dimension( *
) WORK, integer INFO)
DLASD8 finds the square roots of the roots of the secular equation, and stores, for each element in D, the distance to its two nearest poles. Used by sbdsdc. ๐
Purpose
DLASD8 finds the square roots of the roots of the secular equation, as defined by the values in DSIGMA and Z. It makes the appropriate calls to DLASD4, and stores, for each element in D, the distance to its two nearest poles (elements in DSIGMA). It also updates the arrays VF and VL, the first and last components of all the right singular vectors of the original bidiagonal matrix. ๐ฆ
DLASD8 is called from DLASD6.
Parameters
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in factored form in the calling routine:= 0: Compute singular values only.= 1: Compute singular vectors in factored form as well.
KโINTEGER. The number of terms in the rational function to be solved byDLASD4.K >= 1. ๐DโDOUBLE PRECISIONarray, dimension( K ). On output,Dcontains the updated singular values.ZโDOUBLE PRECISIONarray, dimension( K ). On entry, the firstKelements of this array contain the components of the deflation-adjusted updating row vector. On exit,Zis updated. โจVFโDOUBLE PRECISIONarray, dimension( K ). On entry,VFcontains information passed throughDBEDE8. On exit,VFcontains the firstKcomponents of the first components of all right singular vectors of the bidiagonal matrix.VLโDOUBLE PRECISIONarray, dimension( K ). On entry,VLcontains information passed throughDBEDE8. On exit,VLcontains the firstKcomponents of the last components of all right singular vectors of the bidiagonal matrix.DIFLโDOUBLE PRECISIONarray, dimension( K ). On exit,DIFL(I) = D(I) - DSIGMA(I). ๐DIFRโDOUBLE PRECISIONarray, dimension( LDDIFR, 2 )ifICOMPQ = 1and dimension( K )ifICOMPQ = 0. On exit,DIFR(I,1) = D(I) - DSIGMA(I+1),DIFR(K,1)is not defined and will not be referenced. IfICOMPQ = 1,DIFR(1:K,2)is an array containing the normalizing factors for the right singular vector matrix.LDDIFRโINTEGER. The leading dimension ofDIFR, must be at leastK.DSIGMAโDOUBLE PRECISIONarray, dimension( K ). On entry, the firstKelements of this array contain the old roots of the deflated updating problem. These are the poles of the secular equation. On exit, the elements ofDSIGMAmay be very slightly altered in value. ๐WORKโDOUBLE PRECISIONarray, dimension(3*K).INFOโINTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. ๐ญ
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine dlasda
subroutine dlasda (integer ICOMPQ, integer SMLSIZ, integer N, integer SQRE,
double precision, dimension( * ) D, double precision, dimension( * ) E,
double precision, dimension( ldu, * ) U, integer LDU, double precision,
dimension( ldu, * ) VT, integer, dimension( * ) K, double precision,
dimension( ldu, * ) DIFL, double precision, dimension( ldu, * ) DIFR,
double precision, dimension( ldu, * ) Z, double precision, dimension(
ldu, * ) POLES, integer, dimension( * ) GIVPTR, integer, dimension(
ldgcol, * ) GIVCOL, integer LDGCOL, integer, dimension( ldgcol, * )
PERM, double precision, dimension( ldu, * ) GIVNUM, double precision,
dimension( * ) C, double precision, dimension( * ) S, double precision,
dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
DLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonal d and off-diagonal e. Used by sbdsdc. ๐ฅ
Purpose
Using a divide and conquer approach, DLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal N-by-M matrix B with diagonal D and offdiagonal E, where M = N + SQRE. The algorithm computes the singular values in the SVD B = U * S * VT. The orthogonal matrices U and VT are optionally computed in compact form. ๐ฆ
A related subroutine, DLASD0, computes the singular values and the singular vectors in explicit form.
Parameters
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in compact form, as follows= 0: Compute singular values only.= 1: Compute singular vectors of upper bidiagonal matrix in compact form.
SMLSIZโINTEGER. The maximum size of the subproblems at the bottom of the computation tree. ๐ธNโINTEGER. The row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal arrayD.SQREโINTEGER. Specifies the column dimension of the bidiagonal matrix.= 0: The bidiagonal matrix has column dimensionM = N;= 1: The bidiagonal matrix has column dimensionM = N + 1.
DโDOUBLE PRECISIONarray, dimension( N ). On entryDcontains the main diagonal of the bidiagonal matrix. On exitD, ifINFO = 0, contains its singular values. ๐EโDOUBLE PRECISIONarray, dimension( M-1 ). Contains the subdiagonal entries of the bidiagonal matrix. On exit,Ehas been destroyed. ๐ not a drill, bestie, it's gone.UโDOUBLE PRECISIONarray, dimension( LDU, SMLSIZ )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,Ucontains the left singular vector matrices of all subproblems at the bottom level.LDUโINTEGER,LDU = > N. The leading dimension of arraysU,VT,DIFL,DIFR,POLES,GIVNUM, andZ. ๐VTโDOUBLE PRECISIONarray, dimension( LDU, SMLSIZ+1 )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,VT**Tcontains the right singular vector matrices of all subproblems at the bottom level. โจKโINTEGERarray, dimension( N )ifICOMPQ = 1and dimension1ifICOMPQ = 0. IfICOMPQ = 1, on exit,K(I)is the dimension of the I-th secular equation on the computation tree.DIFLโDOUBLE PRECISIONarray, dimension( LDU, NLVL ), whereNLVL = floor(log_2 (N/SMLSIZ))). ๐งDIFRโDIFRโ aDOUBLE PRECISIONarray, bestie, and its dimension is( LDU, 2 * NLVL )whenICOMPQ = 1, or( N )whenICOMPQ = 0. IfICOMPQ = 1, then on exitDIFL(1:N, I)andDIFR(1:N, 2 * I - 1)record the distances between the singular values on the I-th level and the singular values on the (I -1)-th level, andDIFR(1:N, 2 * I )holds the normalizing factors for the right singular vector matrix. PeepDLASD8for the full tea. ๐ZโDOUBLE PRECISIONarray, dimension( LDU, NLVL )ifICOMPQ = 1, and dimension( N )ifICOMPQ = 0. The firstKelements ofZ(1, I)contain the components of the deflation-adjusted updating row vector for subproblems on the I-th level. ๐ฆPOLESโDOUBLE PRECISIONarray, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and literally not referenced at all ifICOMPQ = 0. WhenICOMPQ = 1, on exitPOLES(1, 2*I - 1)andPOLES(1, 2*I)contain the new and old singular values involved in the secular equations on the I-th level. โจGIVPTRโINTEGERarray, dimension( N )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exitGIVPTR( I )records the number of Givens rotations performed on the I-th problem on the computation tree. ๐GIVCOLโINTEGERarray, dimension( LDGCOL, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for each I,GIVCOL(1, 2 *I - 1)andGIVCOL(1, 2 *I)record the locations of the Givens rotations performed on the I-th level on the computation tree. ๐ธLDGCOLโINTEGER,LDGCOL = > N. It's the leading dimension of the arraysGIVCOLandPERM. ๐ซถPERMโINTEGERarray, dimension( LDGCOL, NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exitPERM(1, I)records the permutations done on the I-th level of the computation tree. ๐GIVNUMโDOUBLE PRECISIONarray, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for each I,GIVNUM(1, 2 *I - 1)andGIVNUM(1, 2 *I)record the C- and S-values of the Givens rotations performed on the I-th level on the computation tree. โญCโDOUBLE PRECISIONarray, dimension( N )ifICOMPQ = 1, and dimension 1 ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, then on exitC( I )contains the C-value of a Givens rotation related to the right null space of the I-th subproblem. ๐SโDOUBLE PRECISIONarray, dimension( N )ifICOMPQ = 1, and dimension 1 ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, then on exitS( I )contains the S-value of a Givens rotation related to the right null space of the I-th subproblem. ๐งWORKโDOUBLE PRECISIONarray, dimension(6 * N + (SMLSIZ + 1)*(SMLSIZ + 1)). ๐IWORKโINTEGERarray, dimension(7*N). ๐INFOโINTEGER= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge ๐ญ
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors: ๐
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ฆ subroutine dlasdq ๐ฆ
subroutine dlasdq (character UPLO, integer SQRE, integer N, integer NCVT,
integer NRU, integer NCC, double precision, dimension( * ) D, double
precision, dimension( * ) E, double precision, dimension( ldvt, * ) VT,
integer LDVT, double precision, dimension( ldu, * ) U, integer LDU,
double precision, dimension( ldc, * ) C, integer LDC, double precision,
dimension( * ) WORK, integer INFO)
DLASDQ computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e. Used by sbdsdc. slay ๐
โจ Purpose: โจ
DLASDQ computes the singular value decomposition (SVD) of a real (upper or lower) bidiagonal matrix with diagonal D and offdiagonal E, accumulating the transformations if desired. Letting B denote the input bidiagonal matrix, the algorithm computes orthogonal matrices Q and P such that B = Q * S * P**T (P**T denotes the transpose of P). The singular values S are overwritten on D.
The input matrix U is changed to U * Q if desired. The input matrix VT is changed to P**T * VT if desired. The input matrix C is changed to Q**T * C if desired.
See 'Computing Small Singular Values of Bidiagonal Matrices With Guaranteed High Relative Accuracy,' by J. Demmel and W. Kahan, LAPACK Working Note #3, for a detailed description of the algorithm. ๐ฅ
๐ Parameters ๐
UPLOโUPLOisCHARACTER*1. On entry,UPLOspecifies whether the input bidiagonal matrix is upper or lower bidiagonal, and whether it is square are not.UPLO = 'U'or'u'โ B is upper bidiagonal.UPLO = 'L'or'l'โ B is lower bidiagonal.
SQREโSQREisINTEGER= 0: then the input matrix isN-by-N.= 1: then the input matrix isN-by-(N+1)ifUPLU = 'U'and(N+1)-by-NifUPLU = 'L'.
The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns.
NโNisINTEGER. On entry,Nspecifies the number of rows and columns in the matrix.Nmust be at least 0. ๐ธNCVTโNCVTisINTEGER. On entry,NCVTspecifies the number of columns of the matrixVT.NCVTmust be at least 0. ๐ฆNRUโNRUisINTEGER. On entry,NRUspecifies the number of rows of the matrixU.NRUmust be at least 0. โญNCCโNCCisINTEGER. On entry,NCCspecifies the number of columns of the matrixC.NCCmust be at least 0. ๐DโDisDOUBLE PRECISIONarray, dimension(N). On entry,Dcontains the diagonal entries of the bidiagonal matrix whose SVD is desired. On normal exit,Dcontains the singular values in ascending order. ๐EโEisDOUBLE PRECISIONarray. Its dimension is(N-1)ifSQRE = 0andNifSQRE = 1. On entry, the entries ofEcontain the offdiagonal entries of the bidiagonal matrix whose SVD is desired. On normal exit,Ewill contain0. If the algorithm does not converge,DandEwill contain the diagonal and superdiagonal entries of a bidiagonal matrix orthogonally equivalent to the one given as input. ๐ญVTโVTisDOUBLE PRECISIONarray, dimension(LDVT, NCVT). On entry, contains a matrix which on exit has been premultiplied byP**T, dimensionN-by-NCVTifSQRE = 0and(N+1)-by-NCVTifSQRE = 1(not referenced ifNCVT=0). ๐ซLDVTโLDVTisINTEGER. On entry,LDVTspecifies the leading dimension ofVTas declared in the calling (sub) program.LDVTmust be at least 1. IfNCVTis nonzeroLDVTmust also be at leastN. ๐UโUisDOUBLE PRECISIONarray, dimension(LDU, N). On entry, contains a matrix which on exit has been postmultiplied byQ, dimensionNRU-by-NifSQRE = 0andNRU-by-(N+1)ifSQRE = 1(not referenced ifNRU=0). ๐ซถLDUโLDUisINTEGER. On entry,LDUspecifies the leading dimension ofUas declared in the calling (sub) program.LDUmust be at leastmax( 1, NRU ). ๐CโCisDOUBLE PRECISIONarray, dimension(LDC, NCC). On entry, contains anN-by-NCCmatrix which on exit has been premultiplied byQ**TdimensionN-by-NCCifSQRE = 0and(N+1)-by-NCCifSQRE = 1(not referenced ifNCC=0). โจLDCโLDCisINTEGER. On entry,LDCspecifies the leading dimension ofCas declared in the calling (sub) program.LDCmust be at least 1. IfNCCis nonzero,LDCmust also be at leastN. ๐งWORKโWORKisDOUBLE PRECISIONarray, dimension(4*N). Workspace. Only referenced if one ofNCVT,NRU, orNCCis nonzero, and ifNis at least 2. ๐INFOโINFOisINTEGER. On exit, a value of0indicates a successful exit. IfINFO < 0, argument number-INFOis illegal. IfINFO > 0, the algorithm did not converge, andINFOspecifies how many superdiagonals did not converge. ๐
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors: ๐
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine dlasdt ๐
subroutine dlasdt (integer N, integer LVL, integer ND, integer, dimension( * )
INODE, integer, dimension( * ) NDIML, integer, dimension( * ) NDIMR,
integer MSUB)
DLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used by sbdsdc. the way it just builds a whole tree?? iconic ๐ณ
โจ Purpose: โจ
DLASDT creates a tree of subproblems for bidiagonal divide and conquer. ๐ฅ
๐ Parameters ๐
NโNisINTEGER. On entry, the number of diagonal elements of the bidiagonal matrix. ๐ฆLVLโLVLisINTEGER. On exit, the number of levels on the computation tree. โญNDโNDisINTEGER. On exit, the number of nodes on the tree. ๐ธINODEโINODEisINTEGERarray, dimension( N ). On exit, centers of subproblems. ๐NDIMLโNDIMLisINTEGERarray, dimension( N ). On exit, row dimensions of left children. ๐NDIMRNDIMRโINTEGERarray, dimension (N). On exit, it's holding the row dimensions of the right children. That's it, that's the whole job ๐ซถMSUBโINTEGER. On entry, this is the maximum row dimension that any subproblem sitting at the bottom of the tree is allowed to have. Like the size cap for the lil leaf-level problems ๐ฑ
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ Contributors ๐ธ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine dlaset ๐
subroutine dlaset (character UPLO, integer M, integer N, double precision
ALPHA, double precision BETA, double precision, dimension( lda, * ) A,
integer LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values. No cap, it literally just paints values onto a matrix ๐
๐ Purpose ๐
DLASET initializes an m-by-n matrix A to BETA on the diagonal and
ALPHA on the offdiagonals.
โจ Parameters โจ
UPLOโUPLOisCHARACTER*1. It says which part of the matrixAis getting set, bestie:
= 'U': Upper triangular part is set; the strictly lower
triangular part of A is not changed.
= 'L': Lower triangular part is set; the strictly upper
triangular part of A is not changed.
Otherwise: All of the matrix A is set.
So like, 'U' and 'L' are picky and leave half your matrix alone, and literally anything else means go off, set the whole thing ๐
MโMisINTEGER. The number of rows of the matrixA. AndM >= 0, no negativity allowed ๐ โโ๏ธNโNisINTEGER. The number of columns of the matrixA. AlsoN >= 0โจALPHAโALPHAisDOUBLE PRECISION. The constant that the offdiagonal elements get set to. The side-piece values ๐BETAโBETAisDOUBLE PRECISION. The constant that the diagonal elements get set to. The main-character values ๐AโAisDOUBLE PRECISIONarray, dimension (LDA,N). On exit, the leading m-by-n submatrix ofAis set as follows:
if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n,
if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n,
otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j,
and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).
Note that the diagonal is always BETA no matter which UPLO you picked โ the diagonal is not like the other girls ๐
LDAโLDAisINTEGER. The leading dimension of the arrayA. AndLDA >= max(1,M)โ respect the constraint, fr fr ๐ซถ
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ subroutine dlasr ๐ฆ
subroutine dlasr (character SIDE, character PIVOT, character DIRECT, integer
M, integer N, double precision, dimension( * ) C, double precision,
dimension( * ) S, double precision, dimension( lda, * ) A, integer LDA)
DLASR applies a sequence of plane rotations to a general rectangular matrix. It's giving โจrotationsโจ, and honestly it's kind of a lot, so buckle up.
๐ Purpose ๐
DLASR applies a sequence of plane rotations to a real matrix A, from either the left or the right.
When SIDE = 'L', the transformation takes the form
A := P*A
and when SIDE = 'R', the transformation takes the form
A := A*P**T
where P is an orthogonal matrix consisting of a sequence of z plane rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R', and P**T is the transpose of P.
When DIRECT = 'F' (Forward sequence), then
P = P(z-1) * ... * P(2) * P(1)
and when DIRECT = 'B' (Backward sequence), then
P = P(1) * P(2) * ... * P(z-1)
where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
R(k) = ( c(k) s(k) )
= ( -s(k) c(k) ).
When PIVOT = 'V' (Variable pivot), the rotation is performed for the plane (k,k+1), i.e., P(k) has the form
P(k) = ( 1 )
( ... )
( 1 )
( c(k) s(k) )
( -s(k) c(k) )
( 1 )
( ... )
( 1 )
where R(k) appears as a rank-2 modification to the identity matrix in rows and columns k and k+1. Sneaky lil edit, lowkey iconic ๐
When PIVOT = 'T' (Top pivot), the rotation is performed for the plane (1,k+1), so P(k) has the form
P(k) = ( c(k) s(k) )
( 1 )
( ... )
( 1 )
( -s(k) c(k) )
( 1 )
( ... )
( 1 )
where R(k) appears in rows and columns 1 and k+1. Top of the world energy ๐
Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is performed for the plane (k,z), giving P(k) the form
P(k) = ( 1 )
( ... )
( 1 )
( c(k) s(k) )
( 1 )
( ... )
( 1 )
( -s(k) c(k) )
where R(k) appears in rows and columns k and z. The rotations are performed without ever forming P(k) explicitly. Not me building the whole thing in my head instead of writing it down ๐ญ so efficient, so slay.
โจ Parameters โจ
SIDEโSIDEisCHARACTER*1. It says whether the plane rotation matrixPgets applied toAon the left or on the right.
= 'L': Left, compute A := P*A
= 'R': Right, compute A:= A*P**T
PIVOTโPIVOTisCHARACTER*1. It picks which planeP(k)is a plane rotation matrix for.
= 'V': Variable pivot, the plane (k,k+1)
= 'T': Top pivot, the plane (1,k+1)
= 'B': Bottom pivot, the plane (k,z)
DIRECTโDIRECTisCHARACTER*1. Forward or backward sequence of plane rotations, bestie โ pick a lane ๐
= 'F': Forward, P = P(z-1)*...*P(2)*P(1)
= 'B': Backward, P = P(1)*P(2)*...*P(z-1)
MโMisINTEGER. The number of rows of the matrixA. And heads up: ifm <= 1, an immediate return is effected. Like, it just leaves. No notes, no goodbye ๐NโNisINTEGER. The number of columns of the matrixA. Same deal: ifn <= 1, an immediate return is effected. Byeee ๐ฆCโCisDOUBLE PRECISIONarray, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
It holds the cosines c(k) of the plane rotations. โจ
SโSisDOUBLE PRECISIONarray, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
It holds the sines s(k) of the plane rotations. And the 2-by-2 plane rotation part of the matrix P(k), R(k), has the form
R(k) = ( c(k) s(k) )
( -s(k) c(k) ).
AโAisDOUBLE PRECISIONarray, dimension (LDA,N). The M-by-N matrixA. On exit,Ais overwritten byP*AifSIDE = 'L'or byA*P**TifSIDE = 'R'. Your originalA? Gone. Transformed. Main character now ๐LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M)โ always, no exceptions, periodt ๐ซถ
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ง subroutine dlasv2 ๐ง
subroutine dlasv2 (double precision F, double precision G, double precision
H, double precision SSMIN, double precision SSMAX, double precision SNR,
double precision CSR, double precision SNL, double precision CSL)
DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix. Small matrix, huge plot twist, we love to see it ๐ธ
๐ Purpose ๐
DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix
[ F G ]
[ 0 H ].
On return, abs(SSMAX) is the larger singular value, abs(SSMIN) is the smaller singular value, and (CSL,SNL) and (CSR,SNR) are the left and right singular vectors for abs(SSMAX), giving the decomposition
[ CSL SNL ] [ F G ] [ CSR -SNR ] = [ SSMAX 0 ]
[-SNL CSL ] [ 0 H ] [ SNR CSR ] [ 0 SSMIN ].
It's giving factorization but make it a glow-up โจ
โจ Parameters โจ
FโFisDOUBLE PRECISION. The(1,1)element of the 2-by-2 matrix.GโGisDOUBLE PRECISION. The(1,2)element of the 2-by-2 matrix.HโHisDOUBLE PRECISION. The(2,2)element of the 2-by-2 matrix.SSMINโSSMINisDOUBLE PRECISION.abs(SSMIN)is the smaller singular value. The supporting role, but she eats ๐SSMAXโSSMAXisDOUBLE PRECISION.abs(SSMAX)is the larger singular value. The main character, obviously ๐SNLโSNLisDOUBLE PRECISION.CSLโCSLisDOUBLE PRECISION. The vector(CSL, SNL)is a unit left singular vector for the singular valueabs(SSMAX).SNRโSNRisDOUBLE PRECISION.CSRโCSRisDOUBLE PRECISION. The vector(CSR, SNR)is a unit right singular vector for the singular valueabs(SSMAX).
Not me noticingSNLandSNRgot left with no description of their own ๐ their whole personality lives inside theCSLandCSRbullets above, iykyk.
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details ๐
- Any input parameter may be aliased with any output parameter. So go ahead and reuse the same variable, it's fine, it's chill ๐
- Barring over/underflow and assuming a guard digit in subtraction, all output quantities are correct to within a few units in the last place (ulps). Basically: accurate, no cap โจ
- In IEEE arithmetic, the code works correctly if one matrix element is infinite. โพ๏ธ iconic behaviour honestly
- Overflow will not occur unless the largest singular value itself overflows or is within a few ulps of overflow. (On machines with partial overflow, like the Cray, overflow may occur if the largest singular value is within a factor of 2 of overflow.) So like, watch out on those machines, bestie โ ๏ธ
- Underflow is harmless if underflow is gradual. Otherwise, results may correspond to a matrix modified by perturbations of size near the underflow threshold. Gradual underflow = fine, sudden underflow = the results are kinda not your matrix anymore, it's giving vibes-based linear algebra ๐ญ
๐ซ ieeeck โ integer function ieeeck (integer ISPEC, real ZERO, real ONE)
integer function ieeeck (integer ISPEC, real ZERO, real ONE)
Purpose: IEEECK gets called from ILAENV to verify that Infinity โ and maybe NaN โ arithmetic is safe, meaning it will not trap. Basically it's the vibe check for your floating point. โจ
Parameters ๐
ISPECโISPECis INTEGER. It says whether we're testing just infinity arithmetic, or infinity and NaN arithmetic.= 0: Verify infinity arithmetic only.= 1: Verify infinity and NaN arithmetic.
ZEROโZEROis REAL. It must contain the value0.0. It gets passed in to stop the compiler from optimizing this code away. Sneaky compiler behavior, honestly. ๐ONEโONEis REAL. It must contain the value1.0. Same deal โ passed in so the compiler can't optimize this code away.
RETURN VALUE: INTEGER ๐
= 0: Arithmetic failed to produce the correct answers= 1: Arithmetic produced the correct answers
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ iladlc โ integer function iladlc (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
integer function iladlc (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
ILADLC scans a matrix for its last non-zero column. That's it, that's the whole job. It's giving detective energy. ๐
Purpose: ILADLC scans A for its last non-zero column.
Parameters ๐
MโMis INTEGER. The number of rows of the matrixA.NโNis INTEGER. The number of columns of the matrixA.AโAis DOUBLE PRECISION array, dimension(LDA,N). The m by n matrixA.LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ iladlr โ integer function iladlr (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
integer function iladlr (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
ILADLR scans a matrix for its last non-zero row. Yes bestie, it's the row version. They're sisters. ๐
Purpose: ILADLR scans A for its last non-zero row.
Parameters ๐
MโMis INTEGER. The number of rows of the matrixA.NโNis INTEGER. The number of columns of the matrixA.AโAis DOUBLE PRECISION array, dimension(LDA,N). The m by n matrixA.LDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ ilaenv โ integer function ilaenv (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
integer function ilaenv (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
ILAENV โ the moment we've all been waiting for, the main character of tuning parameters. ๐
Purpose: ILAENV gets called from the LAPACK routines to choose problem-dependent parameters for the local environment. Peep ISPEC for the rundown on those parameters.
ILAENV returns an INTEGER:
- if
ILAENV >= 0:ILAENVreturns the value of the parameter specified byISPEC - if
ILAENV < 0: ifILAENV = -k, the k-th argument had an illegal value.
This version provides a set of parameters which should give good, but not optimal, performance on many of the currently available computers. Users are encouraged to modify this subroutine to set the tuning parameters for their particular machine using the option and problem size information in the arguments. iykyk โ it's a starting point, not a final answer. โจ
โ ๏ธ This routine will not function correctly if it is converted to all lower case. Converting it to all upper case is allowed. Weird little quirk but okay, we respect it. ๐
Parameters ๐
ISPECโISPECis INTEGER. Specifies the parameter to be returned as the value ofILAENV.= 1: the optimal blocksize; if this value is 1, an unblocked algorithm will give the best performance.= 2: the minimum block size for which the block routine should be used; if the usable block size is less than this value, an unblocked routine should be used.= 3: the crossover point (in a block routine, forNless than this value, an unblocked routine should be used)= 4: the number of shifts, used in the nonsymmetric eigenvalue routines (DEPRECATED)= 5: the minimum column dimension for blocking to be used; rectangular blocks must have dimension at least k by m, where k is given byILAENV(2,...)and m byILAENV(5,...)= 6: the crossover point for the SVD (when reducing an m by n matrix to bidiagonal form, ifmax(m,n)/min(m,n)exceeds this value, a QR factorization is used first to reduce the matrix to a triangular form.)= 7: the number of processors= 8: the crossover point for the multishift QR method for nonsymmetric eigenvalue problems (DEPRECATED)= 9: maximum size of the subproblems at the bottom of the computation tree in the divide-and-conquer algorithm (used byxGELSDandxGESDD)=10: ieee infinity and NaN arithmetic can be trusted not to trap=11: infinity arithmetic can be trusted not to trap12 <= ISPEC <= 17:xHSEQRor related subroutines, seeIPARMQfor detailed explanation
NAMEโNAMEis CHARACTER*(*). The name of the calling subroutine, in either upper case or lower case.OPTSโOPTSis CHARACTER*(*). The character options to the subroutineNAME, concatenated into a single character string. For example,UPLO = 'U',TRANS = 'T', andDIAG = 'N'for a triangular routine would be specified asOPTS = 'UTN'.N1โN1is INTEGERN2โN2is INTEGERN3โN3is INTEGERN4โN4is INTEGER. Problem dimensions for the subroutineNAME; these may not all be required.
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โจ Further Details โจ
The following conventions have been used when calling ILAENV from the LAPACK routines:
OPTSis a concatenation of all of the character options to subroutineNAME, in the same order that they appear in the argument list forNAME, even if they are not used in determining the value of the parameter specified byISPEC.- The problem dimensions
N1,N2,N3,N4are specified in the order that they appear in the argument list forNAME.N1is used first,N2second, and so on, and unused problem dimensions are passed a value of-1. - The parameter value returned by
ILAENVis checked for validity in the calling subroutine. For example,ILAENVis used to retrieve the optimal blocksize forSTRTRIas follows:
NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
IF( NB.LE.1 ) NB = MAX( 1, N )
๐ ilaenv2stage โ integer function ilaenv2stage (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
integer function ilaenv2stage (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
ILAENV2STAGE โ the sequel, and honestly the sequel ate. ๐ฅ
Purpose: ILAENV2STAGE gets called from the LAPACK routines to choose problem-dependent parameters for the local environment. Peep ISPEC for a description of the parameters. It sets problem and machine dependent parameters useful for *_2STAGE and related subroutines.
ILAENV2STAGE returns an INTEGER:
- if
ILAENV2STAGE >= 0:ILAENV2STAGEreturns the value of the parameter specified byISPEC - if
ILAENV2STAGE < 0: ifILAENV2STAGE = -k, the k-th argument had an illegal value.
This version provides a set of parameters which should give good, but not optimal, performance on many of the currently available computers for the 2-stage solvers. Users are encouraged to modify this subroutine to set the tuning parameters for their particular machine using the option and problem size information in the arguments.
โ ๏ธ This routine will not function correctly if it is converted to all lower case. Converting it to all upper case is allowed. Same quirk, different function. ๐
Parameters ๐
ISPECโISPECis INTEGER. Specifies the parameter to be returned as the value ofILAENV2STAGE.= 1: the optimal blocksize nb for the reduction to BAND= 2: the optimal blocksize ib for the eigenvectors singular vectors update routine= 3: The length of the array that store the Housholder representation for the second stage Band to Tridiagonal or Bidiagonal= 4: The workspace needed for the routine in input.= 5: For future release.
NAMEโNAMEis CHARACTER*(*). The name of the calling subroutine, in either upper case or lower case.OPTSโOPTSis CHARACTER*(*). The character options to the subroutineNAME, concatenated into a single character string. For example,UPLO = 'U',TRANS = 'T', andDIAG = 'N'for a triangular routine would be specified asOPTS = 'UTN'.N1โN1is INTEGERN2โN2is INTEGERN3โN3is INTEGERN4โN4is INTEGER. Problem dimensions for the subroutineNAME; these may not all be required.
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
- Nick R. Papior
โจ Further Details โจ
...so here are the conventions she follows when you call ILAENV2STAGE from the LAPACK routines, bestie, write these down ๐:
OPTSis a concatenation of all of the character options to subroutineNAME, in the same order that they appear in the argument list forNAMEโ even if they're not used in determining the value of the parameter specified byISPEC. Like, yes, even the ones that don't matter here. She wants the full set. ๐- The problem dimensions
N1,N2,N3,N4are specified in the order that they appear in the argument list forNAME.N1is used first,N2second, and so on, and unused problem dimensions are passed a value of-1. - The parameter value returned by
ILAENV2STAGEis checked for validity in the calling subroutine. No cap, she double-checks. ๐
integer function iparmq (integer ISPEC, character, dimension( * ) NAME, character, dimension( * ) OPTS, integer N, integer ILO, integer IHI, integer LWORK)
integer function iparmq (integer ISPEC, character, dimension( * ) NAME,
character, dimension( * ) OPTS, integer N, integer ILO, integer IHI,
integer LWORK)
IPARMQ โจ
Purpose:
This program sets problem and machine dependent parameters that are useful for xHSEQR and related subroutines for eigenvalue problems. It gets called whenever IPARMQ is called with 12 <= ISPEC <= 16. ๐
Parameters
ISPECโISPECisINTEGER.
ISPEC specifies which tunable parameter IPARMQ should return. Here's the menu, pick your fighter:
ISPEC=12: (INMIN) Matrices of ordernminor less are sent directly toxLAHQR, the implicit double shift QR algorithm.NMINmust be at least11. ๐จISPEC=13: (INWIN) Size of the deflation window. This is best set greater than or equal to the number of simultaneous shiftsNS. Larger matrices benefit from larger deflation windows. It's giving "bigger canvas, bigger glow-up" ๐ฆISPEC=14: (INIBL) Determines when to stop nibbling and invest in an (expensive) multi-shift QR sweep. If the aggressive early deflation subroutine findsLDconverged eigenvalues from an orderNWdeflation window andLD > (NW*NIBBLE)/100, then the next QR sweep is skipped and early deflation is applied immediately to the remaining active diagonal block. SettingIPARMQ(ISPEC=14) = 0causesTTQREto skip a multi-shift QR sweep whenever early deflation finds a converged eigenvalue. SettingIPARMQ(ISPEC=14)greater than or equal to100preventsTTQREfrom skipping a multi-shift QR sweep. ๐คISPEC=15: (NSHFTS) The number of simultaneous shifts in a multi-shift QR iteration.ISPEC=16: (IACC22)IPARMQis set to0,1or2with the following meanings:0: During the multi-shift QR/QZ sweep, blocked eigenvalue reordering, blocked Hessenberg-triangular reduction, reflections and/or rotations are not accumulated when updating the far-from-diagonal matrix entries.1: During the multi-shift QR/QZ sweep, blocked eigenvalue reordering, blocked Hessenberg-triangular reduction, reflections and/or rotations are accumulated, and matrix-matrix multiplication is used to update the far-from-diagonal matrix entries.2: During the multi-shift QR/QZ sweep, blocked eigenvalue reordering, blocked Hessenberg-triangular reduction, reflections and/or rotations are accumulated, and 2-by-2 block structure is exploited during matrix-matrix multiplies.- (If
xTRMMis slower thanxGEMM, thenIPARMQ(ISPEC=16)=1may be more efficient thanIPARMQ(ISPEC=16)=2despite the greater level of arithmetic work implied by the latter choice.) ๐งฎ
ISPEC=17: (ICOST) An estimate of the relative cost of flops within the near-the-diagonal shift chase compared to flops within the BLAS calls of a QZ sweep.
NAMEโNAMEisCHARACTER string.
Name of the calling subroutine. ๐ท๏ธ
OPTSโOPTSisCHARACTER string.
This is a concatenation of the string arguments to TTQRE.
NโNisINTEGER.
N is the order of the Hessenberg matrix H.
ILOโILOisINTEGER.IHIโIHIisINTEGER.
It is assumed that H is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N.
LWORKโLWORKisINTEGER.
The amount of workspace available. ๐๏ธ
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
Little is known about how best to choose these parameters. It is possible to use different values of the parameters for each of CHSEQR, DHSEQR, SHSEQR and ZHSEQR.
It is probably best to choose different parameters for different matrices and different parameters at different times during the iteration, but this has not been implemented --- yet. (the "yet" is doing so much work here, iconic honestly ๐ญ)
The best choices of most of the parameters depend in an ill-understood way on the relative execution rate of xLAQR3 and xLAQR5 and on the nature of each particular eigenvalue problem. Experiment may be the only practical way to determine which choices are most effective. ๐ฌ
Following is a list of default values supplied by IPARMQ. These defaults may be adjusted in order to attain better performance in any particular computational environment.
IPARMQ(ISPEC=12)ThexLAHQRvsxLAQR0crossover point. Default:75. (Must be at least11.)IPARMQ(ISPEC=13)Recommended deflation window size. This depends onILO,IHIandNS, the number of simultaneous shifts returned byIPARMQ(ISPEC=15). The default for(IHI-ILO+1) <= 500isNS. The default for(IHI-ILO+1) > 500is3*NS/2.IPARMQ(ISPEC=14)Nibble crossover point. Default:14.IPARMQ(ISPEC=15)Number of simultaneous shifts,NS, in a multi-shift QR iteration.
If IHI-ILO+1 is...
greater than ...but less ... the
or equal to ... than default is
0 30 NS = 2+
30 60 NS = 4+
60 150 NS = 10
150 590 NS = **
590 3000 NS = 64
3000 6000 NS = 128
6000 infinity NS = 256
(+)By default matrices of this order are passed to the implicit double shift routinexLAHQR. SeeIPARMQ(ISPEC=12)above. These values ofNSare used only in case of a rarexLAHQRfailure.(**)The asterisks (**) indicate an ad-hoc function increasing from10to64.
IPARMQ(ISPEC=16)Select structured matrix multiply. (SeeISPEC=16above for details.) Default:3.IPARMQ(ISPEC=17)Relative cost heuristic for blocksize selection. Expressed as a percentage. Default:10.
logical function lsamen (integer N, character*( * ) CA, character*( * ) CB)
logical function lsamen (integer N, character*( * ) CA, character*( * ) CB)
LSAMEN ๐ธ
Purpose:
LSAMEN tests if the first N letters of CA are the same as the first N letters of CB, regardless of case. LSAMEN returns .TRUE. if CA and CB are equivalent except for case and .FALSE. otherwise. LSAMEN also returns .FALSE. if LEN( CA ) or LEN( CB ) is less than N. So basically she's comparing the first N characters, case-blind, and if either string is too short she's like "nope, .FALSE." ๐
Parameters
NโNisINTEGER.
The number of characters in CA and CB to be compared.
CAโCAisCHARACTER*(*).CBโCBisCHARACTER*(*).
CA and CB specify two character strings of length at least N. Only the first N characters of each string will be accessed. ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
logical function sisnan (real, intent(in) SIN)
logical function sisnan (real, intent(in) SIN)
SISNAN tests input for NaN. ๐
Purpose:
SISNAN returns .TRUE. if its argument is NaN, and .FALSE. otherwise. To be replaced by the Fortran 2003 intrinsic in the future. (she's on her way out, but she still slays for now ๐)
Parameters
SINโSINisREAL.
Input to test for NaN.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine slabad (real SMALL, real LARGE)
subroutine slabad (real SMALL, real LARGE)
SLABAD โจ
Purpose:
...and that's exactly where this part cuts off, bestie โ the SLABAD tea keeps pouring into the next chunk ๐ซ
okay so SLABAD takes the values that SLAMCH computed for underflow and overflow, and if the log of LARGE is sufficiently large, it returns the square root of each of these values. ๐
This subroutine is here to identify machines with a huge exponent range โ think Crays โ and redefine the underflow and overflow limits to be the square roots of the values computed by SLAMCH. Why tho? Because SLAMCH does not compensate for poor arithmetic in the upper half of the exponent range, which is exactly the Cray vibe. No cap. ๐ซถ
โจ Parameters โจ
SMALLโSMALLisREAL. On entry, the underflow threshold as computed bySLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, the square root ofSMALL; otherwise unchanged. ๐ธLARGEโLARGEisREAL. On entry, the overflow threshold as computed bySLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, the square root ofLARGE; otherwise unchanged. ๐
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine slacpy (character UPLO, integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldb, * ) B, integer LDB)
SLACPY copies all or part of one two-dimensional array to another. It's giving copy-paste but for matrices. ๐ฆ
โจ Purpose โจ
SLACPY copies all or part of a two-dimensional matrix A to another matrix B. Literally that's the whole job. ๐
โจ Parameters โจ
UPLOโUPLOisCHARACTER*1. Specifies the part of the matrix A to be copied to B.= 'U': Upper triangular part= 'L': Lower triangular part- Otherwise: All of the matrix A
MโMisINTEGER. The number of rows of the matrix A.M >= 0.NโNisINTEGER. The number of columns of the matrix A.N >= 0.AโAisREAL array, dimension (LDA,N). The m by n matrix A. IfUPLO = 'U', only the upper triangle or trapezoid is accessed; ifUPLO = 'L', only the lower triangle or trapezoid is accessed.LDAโLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).BโBisREAL array, dimension (LDB,N). On exit,B = Ain the locations specified byUPLO.LDBโLDBisINTEGER. The leading dimension of the array B.LDB >= max(1,M).
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine slae2 (real A, real B, real C, real RT1, real RT2)
SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. Serving eigenvalues, no biggie. ๐
โจ Purpose โจ
SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix:
[ A B ]
[ B C ].
On return, RT1 is the eigenvalue of larger absolute value, and RT2 is the eigenvalue of smaller absolute value. Periodt. ๐
โจ Parameters โจ
AโAisREAL. The (1,1) element of the 2-by-2 matrix.BโBisREAL. The (1,2) and (2,1) elements of the 2-by-2 matrix.CโCisREAL. The (2,2) element of the 2-by-2 matrix.RT1โRT1isREAL. The eigenvalue of larger absolute value.RT2โRT2isREAL. The eigenvalue of smaller absolute value.
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โจ Further Details: โจ
RT1is accurate to a few ulps barring over/underflow.RT2may be inaccurate if there is massive cancellation in the determinantA*C-B*B; higher precision or correctly rounded or correctly truncated arithmetic would be needed to computeRT2accurately in all cases.- Overflow is possible only if
RT1is within a factor of 5 of overflow. Underflow is harmless if the input data is 0 or exceedsunderflow_threshold / macheps.
subroutine slaebz (integer IJOB, integer NITMAX, integer N, integer MMAX, integer MINP, integer NBMIN, real ABSTOL, real RELTOL, real PIVMIN, real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) E2, integer, dimension( * ) NVAL, real, dimension( mmax, * ) AB, real, dimension( * ) C, integer MOUT, integer, dimension( mmax, * ) NAB, real, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SLAEBZ computes the number of eigenvalues of a real symmetric tridiagonal matrix which are less than or equal to a given value, and performs other tasks required by the routine sstebz. It's giving busy bestie energy. ๐ซถ
โจ Purpose โจ
SLAEBZ contains the iteration loops which compute and use the function N(w), which is the count of eigenvalues of a symmetric tridiagonal matrix T less than or equal to its argument w. It performs a choice of two types of loops:
IJOB=1, followed byIJOB=2: It takes as input a list of intervals and returns a list of sufficiently small intervals whose union contains the same eigenvalues as the union of the original intervals. The input intervals are(AB(j,1),AB(j,2)],j=1,...,MINP. The output interval(AB(j,1),AB(j,2)]will contain eigenvaluesNAB(j,1)+1,...,NAB(j,2), where1 <= j <= MOUT.IJOB=3: It performs a binary search in each input interval(AB(j,1),AB(j,2)]for a pointw(j)such thatN(w(j))=NVAL(j), and usesC(j)as the starting point of the search. If such aw(j)is found, then on outputAB(j,1)=AB(j,2)=w. If no suchw(j)is found, then on output(AB(j,1),AB(j,2)]will be a small interval containing the point whereN(w)jumps throughNVAL(j), unless that point lies outside the initial interval.
Note that the intervals are in all cases half-open intervals, i.e., of the form (a,b], which includes b but not a. ๐ง
To avoid underflow, the matrix should be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value. To assure the most accurate computation of small eigenvalues, the matrix should be scaled to be not much smaller than that, either.
See W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966.
Note: the arguments are, in general, not checked for unreasonable values. So bestie, be careful. ๐
โจ Parameters โจ
IJOBโIJOBisINTEGER. Specifies what is to be done:= 1: ComputeNABfor the initial intervals.= 2: Perform bisection iteration to find eigenvalues of T.= 3: Perform bisection iteration to invertN(w), i.e., to find a point which has a specified number of eigenvalues of T to its left.- Other values will cause
SLAEBZto return withINFO=-1.
NITMAXโNITMAXisINTEGER. The maximum number of 'levels' of bisection to be performed, i.e., an interval of width W will not be made smaller than2^(-NITMAX) * W. If not all intervals have converged afterNITMAXiterations, thenINFOis set to the number of non-converged intervals.NโNisINTEGER. The dimension n of the tridiagonal matrix T. It must be at least 1.MMAXโMMAXisINTEGER. The maximum number of intervals. If more thanMMAXintervals are generated, thenSLAEBZwill quit withINFO=MMAX+1.MINPโMINPisINTEGER. The initial number of intervals. It may not be greater thanMMAX.NBMINโNBMINisINTEGER. The smallest number of intervals that should be processed using a vector loop. If zero, then only the scalar loop will be used.ABSTOLโABSTOLisREAL. The minimum (absolute) width of an interval. When an interval is narrower thanABSTOL, or thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. This must be at least zero.RELTOLโRELTOLisREAL. The minimum relative width of an interval. When an interval is narrower thanABSTOL, or thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at leastradix*machine epsilon.PIVMINโPIVMINisREAL. The minimum absolute value of a 'pivot' in the Sturm sequence loop. This must be at leastmax |e(j)**2|*safe_minand at leastsafe_min, wheresafe_minis at least the smallest number that can divide one without overflow.DโDisREAL array, dimension (N). The diagonal elements of the tridiagonal matrix T.EโEisREAL array, dimension (N). The offdiagonal elements of the tridiagonal matrix T in positions 1 through N-1.E(N)is arbitrary.E2โE2isREAL array, dimension (N). The squares of the offdiagonal elements of the tridiagonal matrix T.E2(N)is ignored.NVALโNVALisINTEGER array, dimension (MINP). IfIJOB=1or2, not referenced. IfIJOB=3, the desired values ofN(w). The elements ofNVALwill be reordered to correspond with the intervals inAB. Thus,NVAL(j)on output will not, in general be the same asNVAL(j)on input, but it will correspond with the interval(AB(j,1),AB(j,2)]on output.ABโABisREAL array, dimension (MMAX,2). The endpoints of the intervals.AB(j,1)isa(j), the left endpoint of the j-th interval, andAB(j,2)isb(j), the right endpoint of the j-th interval. The input intervals will, in general, be modified, split, and reordered by the calculation.
C
Cis a REAL array, dimension(MMAX)โ okay so depending on yourIJOBthis girl does completely different jobs, no cap:- If
IJOB=1, she's ignored ๐ - If
IJOB=2, she's workspace - If
IJOB=3, then on inputC(j)should be initialized to the first search point in the binary search โจ
- If
MOUT
MOUTis INTEGER โ here's the vibe check:- If
IJOB=1, it's the number of eigenvalues in the intervals - If
IJOB=2or3, it's the number of intervals output - If
IJOB=3,MOUTwill equalMINP(periodt, it's just equal)
- If
NAB
NABis INTEGER array, dimension(MMAX,2)โ bestie this one's got layers, stay with me:- If
IJOB=1, then on outputNAB(i,j)will be set toN(AB(i,j)) - If
IJOB=2, then on input,NAB(i,j)should be set. It must satisfy the condition:
- If
N(AB(i,1)) <= NAB(i,1) <= NAB(i,2) <= N(AB(i,2)),
which means that in interval i only eigenvalues NAB(i,1)+1,...,NAB(i,2) will be considered. Usually, NAB(i,j)=N(AB(i,j)), from a previous call to SLAEBZ with IJOB=1. ๐ซถ
On output, NAB(i,j) will contain
max(na(k),min(nb(k),N(AB(i,j)))),
where k is the index of the input interval that the output interval (AB(j,1),AB(j,2)] came from, and na(k) and nb(k) are the input values of NAB(k,1) and NAB(k,2).
- If
IJOB=3, then on output,NAB(i,j)containsN(AB(i,j)), unlessN(w) > NVAL(i)for all search pointsw, in which caseNAB(i,1)will not be modified โ i.e., the output value will be the same as the input value (modulo reorderings, seeNVALandAB) โ or unlessN(w) < NVAL(i)for all search pointsw, in which caseNAB(i,2)will not be modified. Normally,NABshould be set to some distinctive value(s) beforeSLAEBZis called. ๐
WORK
WORKis REAL array, dimension(MMAX)โ it's just workspace, bestie, it's doing its little job ๐ธ
IWORK
IWORKis INTEGER array, dimension(MMAX)โ also workspace, also slaying in the background ๐
INFO
INFOis INTEGER โ the receipts:= 0:All intervals converged. โจ iconic, we love to see it= 1--MMAX:The lastINFOintervals did not converge ๐ญ= MMAX+1:More thanMMAXintervals were generated. ๐จ
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
This routine is intended to be called only by other LAPACK routines, so like, the interface is less user-friendly. It's intended for two purposes: ๐
(a) finding eigenvalues. In this case, SLAEBZ should have one or more initial intervals set up in AB, and SLAEBZ should be called with IJOB=1. This sets up NAB, and also counts the eigenvalues. Intervals with no eigenvalues would usually be thrown out at this point (bye girl ๐). Also, if not all the eigenvalues in an interval i are desired, NAB(i,1) can be increased or NAB(i,2) decreased. For example, set NAB(i,1)=NAB(i,2)-1 to get the largest eigenvalue. SLAEBZ is then called with IJOB=2 and MMAX no smaller than the value of MOUT returned by the call with IJOB=1. After this (IJOB=2) call, eigenvalues NAB(i,1)+1 through NAB(i,2) are approximately AB(i,1) (or AB(i,2)) to the tolerance specified by ABSTOL and RELTOL. ๐
(b) finding an interval (a',b'] containing eigenvalues w(f),...,w(l). In this case, start with a Gershgorin interval (a,b). Set up AB to contain 2 search intervals, both initially (a,b). One NVAL element should contain f-1 and the other should contain l, while C should contain a and b, resp. NAB(i,1) should be -1 and NAB(i,2) should be N+1, to flag an error if the desired interval does not lie in (a,b). SLAEBZ is then called with IJOB=3. On exit, if w(f-1) < w(f), then one of the intervals โ j โ will have AB(j,1)=AB(j,2) and NAB(j,1)=NAB(j,2)=f-1, while if, to the specified tolerance, w(f-k)=...=w(f+r), k > 0 and r >= 0, then the interval will have N(AB(j,1))=NAB(j,1)=f-k and N(AB(j,2))=NAB(j,2)=f+r. The cases w(l) < w(l+1) and w(l-r)=...=w(l+k) are handled similarly. ๐ง
subroutine slaev2 (real A, real B, real C, real RT1, real RT2, real CS1, real SN1)
SLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. โจ
Purpose:
SLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix
[ A B ]
[ B C ].
On return, RT1 is the eigenvalue of larger absolute value, RT2 is the eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right eigenvector for RT1, giving the decomposition
[ CS1 SN1 ] [ A B ] [ CS1 -SN1 ] = [ RT1 0 ]
[-SN1 CS1 ] [ B C ] [ SN1 CS1 ] [ 0 RT2 ].
Parameters
AโAis REAL. The(1,1)element of the 2-by-2 matrix.BโBis REAL. The(1,2)element and the conjugate of the(2,1)element of the 2-by-2 matrix.CโCis REAL. The(2,2)element of the 2-by-2 matrix.RT1โRT1is REAL. The eigenvalue of larger absolute value. ๐RT2โRT2is REAL. The eigenvalue of smaller absolute value.CS1โCS1is REAL.SN1โSN1is REAL. The vector(CS1, SN1)is a unit right eigenvector forRT1. ๐ฆ
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
RT1is accurate to a few ulps barring over/underflow. ๐RT2may be inaccurate if there is massive cancellation in the determinantA*C-B*B; higher precision or correctly rounded or correctly truncated arithmetic would be needed to computeRT2accurately in all cases. ๐ญCS1andSN1are accurate to a few ulps barring over/underflow.- Overflow is possible only if
RT1is within a factor of 5 of overflow. - Underflow is harmless if the input data is 0 or exceeds
underflow_threshold / macheps.
subroutine slag2d (integer M, integer N, real, dimension( ldsa, * ) SA, integer LDSA, double precision, dimension( lda, * ) A, integer LDA, integer INFO)
SLAG2D converts a single precision matrix to a double precision matrix. glow-up arc ๐
Purpose:
SLAG2D converts a SINGLE PRECISION matrix, SA, to a DOUBLE PRECISION matrix, A.
Note that while it is possible to overflow while converting from double to single, it is not possible to overflow when converting from single to double. ๐ซถ
This is an auxiliary routine so there is no argument checking. ๐
Parameters
MโMis INTEGER. The number of lines of the matrixA.M >= 0.NโNis INTEGER. The number of columns of the matrixA.N >= 0.SAโSAis REAL array, dimension(LDSA,N). On entry, theM-by-Ncoefficient matrixSA.LDSAโLDSAis INTEGER. The leading dimension of the arraySA.LDSA >= max(1,M).AโAis DOUBLE PRECISION array, dimension(LDA,N). On exit, theM-by-Ncoefficient matrixA. โจLDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).INFOโINFOis INTEGER.= 0:successful exit ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine slagts (integer JOB, integer N, real, dimension( * ) A, real, dimension( * ) B, real, dimension( * ) C, real, dimension( * ) D, integer, dimension( * ) IN, real, dimension( * ) Y, real TOL, integer INFO)
SLAGTS solves the system of equations (T-ฮปI)x = y or (T-ฮปI)Tx = y, where T is a general tridiagonal matrix and ฮป a scalar, using the LU factorization computed by slagtf. ๐
Purpose:
SLAGTS may be used to solve one of the systems of equations
(T - lambda*I)*x = y or (T - lambda*I)**T*x = y,
where T is an n by n tridiagonal matrix, for x, following the factorization of (T - lambda*I) as
(T - lambda*I) = P*L*U ,
by routine SLAGTF. The choice of equation to be solved is controlled by the argument JOB, and in each case there is an option to perturb zero or very small diagonal elements of U โ this option being intended for use in applications such as inverse iteration. ๐
Parameters
JOBโJOBis INTEGER. Specifies the job to be performed bySLAGTSas follows:= 1:The equations(T - lambda*I)x = yare to be solved, but diagonal elements ofUare not to be perturbed.= -1:The equations(T - lambda*I)x = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.= 2:The equations(T - lambda*I)**Tx = yare to be solved, but diagonal elements ofUare not to be perturbed.= -2:The equations(T - lambda*I)**Tx = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.
NโNis INTEGER. The order of the matrixT.AโAis REAL array, dimension(N). On entry,Amust contain the diagonal elements ofUas returned fromSLAGTF.BโBis REAL array, dimension(N-1). On entry,Bmust contain the first super-diagonal elements ofUas returned fromSLAGTF.CโCis REAL array, dimension(N-1). On entry,Cmust contain the sub-diagonal elements ofLas returned fromSLAGTF.DโDis REAL array, dimension(N-2). On entry,Dmust contain the second super-diagonal elements ofUas returned fromSLAGTF.ININโ INTEGER array, dimension (N). On entry,INhas to be holding all the deets of the matrix P, exactly the waySLAGTFhanded them over. ๐ซถYโ REAL array, dimension (N). On entry this is your right-hand side vector y, bestie. On exit,Ygets fully overwritten by the solution vector x. she's a whole new woman ๐TOLโ REAL. On entry, whenJOB < 0,TOLshould be the smallest perturbation you wanna make to those teeny tiny diagonal elements of U. Normally you'd pickTOLas roughlyeps*norm(U), where eps is the relative machine precision. But if you passTOLin as non-positive, it gets reset toeps*max( abs( u(i,j) ) )instead. And ifJOB > 0, thenTOLisn't even looked at, not once. ๐
On exit, TOL gets changed as described above โ but only if it was non-positive on entry. Otherwise TOL stays exactly as it was. no notes.
INFOโ INTEGER.= 0: successful exit, we ate and left no crumbs โจ< 0: ifINFO = -i, then the i-th argument had an illegal value ๐ญ> 0: overflow would occur when computing theINFO(th) element of the solution vector x. This can only happen whenJOBwas supplied as positive, and it means either that a diagonal element of U is very small, or that the elements of the right-hand side vector y are very large. either way, it's giving chaos.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ logical function slaisnan (real, intent(in) SIN1, real, intent(in) SIN2)
SLAISNAN tests input for NaN by comparing two arguments for inequality. yes, that's the whole bit. ๐
Purpose:
This routine is not for general use. Like, at all. It exists solely to avoid over-optimization in SISNAN. that's its entire job bestie.
SLAISNAN checks for NaNs by comparing its two arguments for inequality. NaN is the one and only floating-point value where NaN != NaN returns .TRUE. โ iconic behavior honestly. So to check for NaNs, you pass the same variable as both arguments. ๐
A compiler must assume that the two arguments are not the same variable, and the test will not be optimized away. But heads up: interprocedural or whole-program optimization may delete this test. ๐ญ The ISNAN functions will be replaced by the correct Fortran 03 intrinsic once the intrinsic is widely available. until then, we vibe with the workaround.
Parameters
SIN1โSIN1is REAL.SIN2โSIN2is REAL. Two numbers to compare for inequality.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฅ integer function slaneg (integer N, real, dimension( * ) D, real, dimension( * ) LLD, real SIGMA, real PIVMIN, integer R)
SLANEG computes the Sturm count. she's counting, and she's right. ๐
Purpose:
SLANEG computes the Sturm count โ that's the number of negative pivots you bump into while factoring tridiagonal T - sigma I = L D L^T. This implementation works directly on the factors without ever forming the tridiagonal matrix T. No cap. The Sturm count is also the number of eigenvalues of T less than sigma. periodt.
This routine is called from SLARRB.
The current routine does not use the PIVMIN parameter but rather requires IEEE-754 propagation of Infinities and NaNs. This routine also has no input range restrictions but does require default exception handling such that x/0 produces Inf when x is non-zero, and Inf/Inf produces NaN. For more information, see:
Marques, Riedy, and Voemel, 'Benefits of IEEE-754 Features in
Modern Symmetric Tridiagonal Eigensolvers,' SIAM Journal on
Scientific Computing, v28, n5, 2006. DOI 10.1137/050641624
(Tech report version in LAWN 172 with the same title.)
Parameters
NโNis INTEGER. The order of the matrix.DโDis REAL array, dimension (N). The N diagonal elements of the diagonal matrix D.LLDโLLDis REAL array, dimension (N-1). The (N-1) elementsL(i)*L(i)*D(i).SIGMAโSIGMAis REAL. Shift amount inT - sigma I = L D L^T.PIVMINโPIVMINis REAL. The minimum pivot in the Sturm sequence. May be used when zero pivots are encountered on non-IEEE-754 architectures.RโRis INTEGER. The twist index for the twisted factorization that is used for the negcount.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
- Jason Riedy, University of California, Berkeley, USA
โญ real function slanst (character NORM, integer N, real, dimension( * ) D, real, dimension( * ) E)
SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix. pick your fighter, she does all four. ๐
Purpose:
SLANST returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix A.
Returns
SLANST
SLANST = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 denotes the one norm of a matrix (maximum column sum), normI denotes the infinity norm of a matrix (maximum row sum) and normF denotes the Frobenius norm of a matrix (square root of sum of squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. iykyk.
Parameters
NORMโNORMis CHARACTER*1. Specifies the value to be returned in SLANST as described above.NโNis INTEGER. The order of the matrix A.N >= 0. WhenN = 0, SLANST is set to zero.DโDis REAL array, dimension (N). The diagonal elements of A.EโEis REAL array, dimension (N-1). The (n-1) sub-diagonal or super-diagonal elements of A.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ real function slapy2 (real X, real Y)
SLAPY2 returns sqrt(x2+y2). tiny function, huge responsibility. ๐
Purpose:
SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary overflow and unnecessary underflow. she's careful like that.
Parameters
XโXis REAL.YโYis REAL. X and Y specify the values x and y.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ real function slapy3 (real X, real Y, real Z)
SLAPY3 returns sqrt(x2+y2+z2). yes bestie, they made a three-argument version, and yes it slays. โจ
Purpose:
SLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause unnecessary overflow and unnecessary underflow.
Parameters
XโXis REAL.YโYis REAL.ZโZis REAL. X, Y and Z specify the values x, y and z.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ธ real function slarmm (real ANORM, real BNORM, real CNORM)
SLARMM. that's it, that's the name. ๐
Purpose:
SLARMM returns a factor s in (0, 1] such that the linear updates
(s * C) - A * (s * B) and (s * C) - (s * A) * B
cannot overflow, where A, B, and C are matrices of conforming dimensions.
This is an auxiliary routine so there is no argument checking. you're on your own, bestie, and that's on periodt.
Parameters
ANORMโANORMis REAL. The infinity norm of A.ANORM >= 0. The number of rows of the matrix A.M >= 0. (yeah, that last line really is sitting underANORMin the original, we do not make the rules ๐ญ)BNORMโBNORMis REAL. The infinity norm of B.BNORM >= 0.CNORMโCNORMis REAL. The infinity norm of C.CNORM >= 0.
References: C. C. Kjelgaard Mikkelsen and L. Karlsson, Blocked Algorithms for Robust Solution of Triangular Linear Systems. In: International Conference on Parallel Processing and Applied Mathematics, pages 68--78. Springer, 2017.
๐ฅ subroutine slarnv (integer IDIST, integer, dimension( 4 ) ISEED, integer N, real, dimension( * ) X)
SLARNV returns a vector of random numbers from a uniform or normal distribution. rng but make it Fortran. ๐ฒ
Purpose:
SLARNV returns a vector of n random real numbers from a uniform or normal distribution.
Parameters
IDISTโIDISTis INTEGER. Specifies the distribution of the random numbers:= 1: uniform (0,1)= 2: uniform (-1,1)= 3: normal (0,1)
ISEEDโISEEDis INTEGER array, dimension (4). On entry, the seed of the random number generator; the array elements must be between0and4095, andISEED(4)must be odd. ๐ On exit, the seed is updated.NโNis INTEGER. The number of random numbers to be generated.XโXis REAL array, dimension (N). The generated random numbers.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
This routine calls the auxiliary routine SLARUV to generate random real numbers from a uniform (0,1) distribution, in batches of up to 128 using vectorisable code. The Box-Muller method is used to transform numbers from a uniform to a normal distribution. math girlies stay winning ๐
๐ง subroutine slarra (integer N, real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) E2, real SPLTOL, real TNRM, integer NSPLIT, integer, dimension( * ) ISPLIT, integer INFO)
SLARRA computes the splitting points with the specified threshold. she decides what counts as "small" around here. ๐
Purpose:
Compute the splitting points with threshold SPLTOL. SLARRA sets any 'small' off-diagonal elements to zero.
Parameters
NโNis INTEGER. The order of the matrix.N > 0.DโDโDis aREALarray, dimension(N). On entry, it's carrying theNdiagonal elements of the tridiagonal matrixT. ๐ซถEโEis aREALarray, dimension(N). On entry, the first(N-1)entries are the subdiagonal elements of the tridiagonal matrixT;E(N)doesn't even need to be set, so don't stress about it bestie. On exit, the entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, get set to zero, while all the other entries ofEare left completely untouched. โจE2โE2is aREALarray, dimension(N). On entry, the first(N-1)entries contain the SQUARES of the subdiagonal elements of the tridiagonal matrixT;E2(N)need not be set. On exit, the entriesE2( ISPLIT( I ) ),1 <= I <= NSPLIT, have been set to zero. ๐SPLTOLโSPLTOLisREAL. It's the threshold for splitting, and there are literally two criteria you can pick from:SPLTOL<0: criterion based on absolute off-diagonal valueSPLTOL>0: criterion that preserves relative accuracy
TNRMโTNRMisREAL. The norm of the matrix.NSPLITโNSPLITisINTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITโISPLITisINTEGERarray, dimension(N). These are the splitting points, at whichTbreaks up into blocks. The first block is rows/columns1toISPLIT(1), the second is rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th one is rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N. ๐ธINFOโINFOisINTEGER.= 0: successful exit ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Beresford Parlett, University of California, Berkeley, USA Jim Demmel, University of California, Berkeley, USA Inderjit Dhillon, University of Texas, Austin, USA Osni Marques, LBNL/NERSC, USA Christof Voemel, University of California, Berkeley, USA
subroutine slarrb โ limited bisection that locates eigenvalues, but โจcuterโจ
subroutine slarrb (integer N, real, dimension( * ) D, real, dimension( * )
LLD, integer IFIRST, integer ILAST, real RTOL1, real RTOL2, integer
OFFSET, real, dimension( * ) W, real, dimension( * ) WGAP, real,
dimension( * ) WERR, real, dimension( * ) WORK, integer, dimension( * )
IWORK, real PIVMIN, real SPDIAM, integer TWIST, integer INFO)
SLARRB provides limited bisection to locate eigenvalues for more accuracy.
Purpose
Okay so picture this: you've got the relatively robust representation (RRR) L D L^T, right? SLARRB does 'limited' bisection to refine the eigenvalues of L D L^T โ specifically W( IFIRST-OFFSET ) through W( ILAST-OFFSET ) โ and it pushes them to more accuracy. ๐ฅ
Your initial guesses for these eigenvalues come in through W. The corresponding estimate of the error in those guesses comes in through WERR, and their gaps come in through WGAP. And the whole time, the intervals [left, right] are being maintained by storing their mid-points and semi-widths in the arrays W and WERR respectively. It's giving organized. ๐
Parameters
NโNisINTEGER. The order of the matrix.DโDisREALarray, dimension(N). TheNdiagonal elements of the diagonal matrixD.LLDโLLDisREALarray, dimension(N-1). The(N-1)elementsL(i)*L(i)*D(i).IFIRSTโIFIRSTisINTEGER. The index of the first eigenvalue to be computed.ILASTโILASTisINTEGER. The index of the last eigenvalue to be computed.RTOL1โRTOL1isREAL.RTOL2โRTOL2isREAL. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ), whereGAPis the (estimated) distance to the nearest eigenvalue. ๐ฏOFFSETโOFFSETisINTEGER. Offset for the arraysW,WGAPandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are the ones getting used.WโWisREALarray, dimension(N). On input,W( IFIRST-OFFSET )throughW( ILAST-OFFSET )are estimates of the eigenvalues ofL D L^TindexedIFIRSTthroughILAST. On output, these estimates are refined. ๐WGAPโWGAPisREALarray, dimension(N-1). On input, the (estimated) gaps between consecutive eigenvalues ofL D L^T, i.e.,WGAP(I-OFFSET)is the gap between eigenvaluesIandI+1. Note that ifIFIRST = ILASTthenWGAP(IFIRST-OFFSET)must be set toZERO. On output, these gaps are refined.WERRโWERRisREALarray, dimension(N). On input,WERR( IFIRST-OFFSET )throughWERR( ILAST-OFFSET )are the errors in the estimates of the corresponding elements inW. On output, these errors are refined. ๐ฆWORKโWORKisREALarray, dimension(2*N). Workspace.IWORKโIWORKisINTEGERarray, dimension(2*N). Workspace.PIVMINโPIVMINisREAL. The minimum pivot in the Sturm sequence.SPDIAMโSPDIAMisREAL. The spectral diameter of the matrix.TWISTโTWISTisINTEGER. The twist index for the twisted factorization that is used for the negcount. ๐TWIST = N: Compute negcount fromL D L^T - LAMBDA I = L+ D+ L+^TTWIST = 1: Compute negcount fromL D L^T - LAMBDA I = U- D- U-^TTWIST = R: Compute negcount fromL D L^T - LAMBDA I = N(r) D(r) N(r)
INFOโINFOisINTEGER. Error flag.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Beresford Parlett, University of California, Berkeley, USA Jim Demmel, University of California, Berkeley, USA Inderjit Dhillon, University of Texas, Austin, USA Osni Marques, LBNL/NERSC, USA Christof Voemel, University of California, Berkeley, USA
subroutine slarrc โ counting eigenvalues, no cap ๐งฎ
subroutine slarrc (character JOBT, integer N, real VL, real VU, real,
dimension( * ) D, real, dimension( * ) E, real PIVMIN, integer EIGCNT,
integer LCNT, integer RCNT, integer INFO)
SLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix.
Purpose
Find the number of eigenvalues of the symmetric tridiagonal matrix T that are in the interval (VL,VU] if JOBT = 'T', and of L D L^T if JOBT = 'L'. That's it, that's the whole vibe. ๐
Parameters
JOBTโJOBTisCHARACTER*1.= 'T': Compute Sturm count for matrixT.= 'L': Compute Sturm count for matrixL D L^T.
NโNisINTEGER. The order of the matrix.N > 0.VLโVLisREAL. The lower bound for the eigenvalues.VUโVUisREAL. The upper bound for the eigenvalues.DโDisREALarray, dimension(N).JOBT = 'T': TheNdiagonal elements of the tridiagonal matrixT.JOBT = 'L': TheNdiagonal elements of the diagonal matrixD.
EโEisREALarray, dimension(N).JOBT = 'T': TheN-1offdiagonal elements of the matrixT.JOBT = 'L': TheN-1offdiagonal elements of the matrixL.
PIVMINโPIVMINisREAL. The minimum pivot in the Sturm sequence forT.EIGCNTโEIGCNTisINTEGER. The number of eigenvalues of the symmetric tridiagonal matrixTthat are in the interval(VL,VU]. ๐LCNTโLCNTisINTEGER.RCNTโRCNTisINTEGER. The left and right negcounts of the interval.INFOโINFOisINTEGER.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Beresford Parlett, University of California, Berkeley, USA Jim Demmel, University of California, Berkeley, USA Inderjit Dhillon, University of Texas, Austin, USA Osni Marques, LBNL/NERSC, USA Christof Voemel, University of California, Berkeley, USA
subroutine slarrd โ eigenvalues, but make them accurate ๐
subroutine slarrd (character RANGE, character ORDER, integer N, real VL,
real VU, integer IL, integer IU, real, dimension( * ) GERS, real RELTOL,
real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) E2,
real PIVMIN, integer NSPLIT, integer, dimension( * ) ISPLIT, integer M,
real, dimension( * ) W, real, dimension( * ) WERR, real WL, real WU,
integer, dimension( * ) IBLOCK, integer, dimension( * ) INDEXW, real,
dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.
Purpose
SLARRD computes the eigenvalues of a symmetric tridiagonal matrix T to suitable accuracy. It's an auxiliary code, so it's meant to be called from SSTEMR โ it's not out here doing solo main character work, it's the support role that carries the whole plot. ๐ซถ
You can ask it for all the eigenvalues, all the eigenvalues in the half-open interval (VL, VU], or the IL-th through IU-th eigenvalues. Your call, bestie.
โ ๏ธ To avoid overflow, the matrix must be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value, and for greatest accuracy, it should not be much smaller than that. So likeโฆ don't skip the scaling step. Not me warning you twice. ๐
Also, see W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966. ๐
Parameters
RANGEโRANGEisCHARACTER*1.= 'A': ('All') all eigenvalues will be found.= 'V': ('Value') all eigenvalues in the half-open interval(VL, VU]will be found.= 'I': ('Index') theIL-th throughIU-th eigenvalues (of the entire matrix) will be found.
ORDERORDERโORDERisCHARACTER*1, and honestly it's the vibe-setter for how your eigenvalues get lined up ๐= 'B'โ ('By Block' core ๐ ) the eigenvalues get grouped by split-off block (go look atIBLOCK,ISPLIT) and ordered smallest โ largest within the block.= 'E'โ ('Entire matrix' era ๐) the eigenvalues for the entire matrix get ordered smallest โ largest, no blocks, no drama.
NโNisINTEGER. It's the order of the tridiagonal matrixT, andN >= 0bestie, we do not go negative here ๐ซVLโVLisREAL. IfRANGE='V', this is the lower bound of the interval we're hunting eigenvalues in. Anything less than or equal toVL, or greater thanVU, does not get returned. AlsoVL < VU. Not referenced at all ifRANGE = 'A'or'I'โ she's off duty those days ๐ดVUโVUisREAL. IfRANGE='V', this is the upper bound of the interval being searched. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. Not referenced ifRANGE = 'A'or'I'.ILโILisINTEGER. IfRANGE='I', it's the index of the smallest eigenvalue to be returned. Constraint check:1 <= IL <= IU <= NifN > 0; andIL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.IUโIUisINTEGER. IfRANGE='I', it's the index of the largest eigenvalue to be returned. Same rules:1 <= IL <= IU <= NifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.GERSโGERSis aREALarray, dimension(2*N). It's holding theNGerschgorin intervals, where the i-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i)). Math girlies stay winning ๐RELTOLโRELTOLisREAL. This is the minimum relative width of an interval. When an interval is narrower thanRELTOLtimes the larger (in magnitude) endpoint, it's considered sufficiently small, i.e. converged โจ Note: this should always be at leastradix*machine epsilon.DโDis aREALarray, dimension(N). Thendiagonal elements of the tridiagonal matrixT.EโEis aREALarray, dimension(N-1). The(n-1)off-diagonal elements of the tridiagonal matrixT.E2โE2is aREALarray, dimension(N-1). The(n-1)squared off-diagonal elements ofTโ yes queen, pre-squared, we don't do that math twice ๐ฅPIVMINโPIVMINisREAL. The minimum pivot allowed in the Sturm sequence forT.NSPLITโNSPLITisINTEGER. The number of diagonal blocks in the matrixT. And1 <= NSPLIT <= N, no cap.ISPLITโISPLITis anINTEGERarray, dimension(N). These are the splitting points whereTbreaks up into submatrices. The first submatrix is rows/columns1toISPLIT(1), the second is rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th is rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N.
Heads up: only the firstNSPLITelements actually get used, but since you can't know a priori what valueNSPLITwill have,Nwords must be reserved forISPLIT. Budget accordingly bestie ๐
MโMisINTEGER. The actual number of eigenvalues found, with0 <= M <= N. (Also go read the description ofINFO=2,3โ it's relevant, iykyk ๐)WโWis aREALarray, dimension(N). On exit, the firstMelements ofWhold the eigenvalue approximations.SLARRDcomputes an intervalI_j = (a_j, b_j]that includes eigenvaluej. The eigenvalue approximation is given as the interval midpointW(j)= ( a_j + b_j)/2, and the corresponding error is bounded byWERR(j) = abs( a_j - b_j)/2. Midpoint math, so iconic ๐โจWERRโWERRis aREALarray, dimension(N). The error bound on the corresponding eigenvalue approximation inW.WLโWLisREAL.WUโWUisREAL. The interval(WL, WU]contains all the wanted eigenvalues.- If
RANGE='V', thenWL=VLandWU=VU. - If
RANGE='A', thenWLandWUare the global Gerschgorin bounds on the spectrum. - If
RANGE='I', thenWLandWUare computed bySLAEBZfrom the index range specified.
- If
IBLOCKโIBLOCKis anINTEGERarray, dimension(N). At each row/columnjwhereE(j)is zero or small, the matrixTis considered to split into a block diagonal matrix. On exit, ifINFO = 0,IBLOCK(i)specifies which block (from1to the number of blocks) the eigenvalueW(i)belongs to. (SLARRDmay use the remainingN-Melements as workspace โ she's resourceful like that ๐ )INDEXWโINDEXWis anINTEGERarray, dimension(N). The indices of the eigenvalues within each block (submatrix); for example,INDEXW(i)= jandIBLOCK(i)=kimply that the i-th eigenvalueW(i)is the j-th eigenvalue in blockk.WORKโWORKis aREALarray, dimension(4*N).IWORKโIWORKis anINTEGERarray, dimension(3*N).INFOโINFOisINTEGER, the little status report at the end ๐ซถ= 0: successful exit, we ate ๐< 0: ifINFO = -i, the i-th argument had an illegal value. Rude.> 0: some or all of the eigenvalues failed to converge or were not computed:=1 or 3: Bisection failed to converge for some eigenvalues; these eigenvalues are flagged by a negative block number. The effect is that the eigenvalues may not be as accurate as the absolute and relative tolerances. This is generally caused by unexpectedly inaccurate arithmetic. ๐=2 or 3:RANGE='I'only: Not all of the eigenvaluesIL:IUwere found.- Effect:
M < IU+1-IL - Cause: non-monotonic arithmetic, causing the Sturm sequence to be non-monotonic.
- Cure: recalculate, using
RANGE='A', and pick out eigenvaluesIL:IU. In some cases, increasing thePARAMETER 'FUDGE'may make things work.
- Effect:
= 4:RANGE='I', and the Gershgorin interval initially used was too small. No eigenvalues were computed.- Probable cause: your machine has sloppy floating-point arithmetic. ๐ญ
- Cure: Increase the
PARAMETER 'FUDGE', recompile, and try again.
๐ง Internal Parameters ๐ง
FUDGE โ REAL, default = 2
A 'fudge factor' to widen the Gerschgorin intervals. Ideally, a value of 1 should work, but on machines with sloppy arithmetic, this needs to be larger. The default for publicly released versions should be large enough to handle the worst machine around. Note that this has no effect on accuracy of the solution โ she's just here to widen the net, not to change the answer ๐
๐ธ Contributors ๐ธ
- W. Kahan, University of California, Berkeley, USA
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
โจ Author โจ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ subroutine slarre ๐
subroutine slarre (character RANGE, integer N, real VL, real VU, integer IL,
integer IU, real, dimension( * ) D, real, dimension( * ) E, real,
dimension( * ) E2, real RTOL1, real RTOL2, real SPLTOL, integer NSPLIT,
integer, dimension( * ) ISPLIT, integer M, real, dimension( * ) W, real,
dimension( * ) WERR, real, dimension( * ) WGAP, integer, dimension( * )
IBLOCK, integer, dimension( * ) INDEXW, real, dimension( * ) GERS, real
PIVMIN, real, dimension( * ) WORK, integer, dimension( * ) IWORK,
integer INFO)
SLARRE given the tridiagonal matrix T, sets small off-diagonal elements to zero and for each unreduced block Ti, finds base representations and eigenvalues. She's thorough, okay? ๐
Purpose
To find the desired eigenvalues of a given real symmetric tridiagonal matrix T, SLARRE sets any 'small' off-diagonal elements to zero, and for each unreduced block T_i, it finds:
- a suitable shift at one end of the block's spectrum,
- the base representation,
T_i - sigma_i I = L_i D_i L_i^T, and - eigenvalues of each
L_i D_i L_i^T.
The representations and eigenvalues found are then used by SSTEMR to compute the eigenvectors of T.
The accuracy varies depending on whether bisection is used to find a few eigenvalues, or the dqds algorithm (subroutine SLASQ2) to compute all of them and then discard any unwanted one. Different tools, different accuracy vibes ๐ฅ
As an added benefit, SLARRE also outputs the n Gerschgorin intervals for the matrices L_i D_i L_i^T. Free bonus content, we love to see it โจ
Parameters
RANGEโRANGEisCHARACTER*1= 'A': ('All') all eigenvalues will be found.= 'V': ('Value') all eigenvalues in the half-open interval(VL, VU]will be found.= 'I': ('Index') theIL-th throughIU-th eigenvalues (of the entire matrix) will be found.
NโNisINTEGER. The order of the matrix.N > 0.VLโVLisREAL. IfRANGE='V', the lower bound for the eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. IfRANGE='I'or='A',SLARREcomputes bounds on the desired part of the spectrum.VUโVUisREAL
okay so continuing the parameter tea โ...
VUis aREAL. IfRANGE='V', it's the upper bound for the eigenvalues. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. IfRANGE='I'or='A',SLARREcomputes bounds on the desired part of the spectrum.ILis anINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N.IUis anINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N.Dis aREALarray, dimension(N). On entry, theNdiagonal elements of the tridiagonal matrixT. On exit, theNdiagonal elements of the diagonal matricesD_i.Eis aREALarray, dimension(N). On entry, the first(N-1)entries contain the subdiagonal elements of the tridiagonal matrixT;E(N)need not be set. On exit,Econtains the subdiagonal elements of the unit bidiagonal matricesL_i. The entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, contain the base pointssigma_ion output.E2is aREALarray, dimension(N). On entry, the first(N-1)entries contain the SQUARES of the subdiagonal elements of the tridiagonal matrixT;E2(N)need not be set. On exit, the entriesE2( ISPLIT( I ) ),1 <= I <= NSPLIT, have been set to zeroRTOL1is aREAL.RTOL2is aREAL. Parameters for bisection. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )SPLTOLis aREAL. The threshold for splitting.NSPLITis anINTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITis anINTEGERarray, dimension(N). The splitting points, at whichTbreaks up into blocks. The first block consists of rows/columns1toISPLIT(1), the second of rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and theNSPLIT-th consists of rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N.Mis anINTEGER. The total number of eigenvalues (of allL_i D_i L_i^T) found.Wis aREALarray, dimension(N). The firstMelements contain the eigenvalues. The eigenvalues of each of the blocks,L_i D_i L_i^T, are sorted in ascending order (SLARREmay use the remainingN-Melements as workspace).WERRis aREALarray, dimension(N). The error bound on the corresponding eigenvalue inW.WGAPis aREALarray, dimension(N). The separation from the right neighbor eigenvalue inW. The gap is only with respect to the eigenvalues of the same block as each block has its own representation tree. Exception: at the right end of a block we store the left gapIBLOCKis anINTEGERarray, dimension(N). The indices of the blocks (submatrices) associated with the corresponding eigenvalues inW;IBLOCK(i)=1if eigenvalueW(i)belongs to the first block from the top,=2ifW(i)belongs to the second block, etc.INDEXWis anINTEGERarray, dimension(N). The indices of the eigenvalues within each block (submatrix); for example,INDEXW(i)= 10andIBLOCK(i)=2imply that thei-th eigenvalueW(i)is the 10-th eigenvalue in block 2GERSis aREALarray, dimension(2*N). TheNGerschgorin intervals (thei-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i)).PIVMINis aREAL. The minimum pivot in the Sturm sequence forT.WORKis aREALarray, dimension(6*N). Workspace.IWORKis anINTEGERarray, dimension(5*N). Workspace.INFOis anINTEGER.= 0: successful exit.> 0: A problem occurred inSLARRE.< 0: One of the called subroutines signaled an internal problem. Needs inspection of the corresponding parameterIINFOfor further information.=-1: Problem inSLARRD.= 2: No base representation could be found inMAXTRYiterations. IncreasingMAXTRYand recompilation might be a remedy.=-3: Problem inSLARRBwhen computing the refined root representation forSLASQ2.=-4: Problem inSLARRBwhen preforming bisection on the desired part of the spectrum.=-5: Problem inSLASQ2.=-6: Problem inSLASQ2.
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details ๐
The base representations are required to suffer very little element growth and consequently define all their eigenvalues to high relative accuracy.
๐ Contributors ๐
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
๐ฆ subroutine slarrf ๐ฆ
subroutine slarrf (integer N, real, dimension( * ) D, real, dimension( * )
L, real, dimension( * ) LD, integer CLSTRT, integer CLEND, real,
dimension( * ) W, real, dimension( * ) WGAP, real, dimension( * ) WERR,
real SPDIAM, real CLGAPL, real CLGAPR, real PIVMIN, real SIGMA, real,
dimension( * ) DPLUS, real, dimension( * ) LPLUS, real, dimension( * )
WORK, integer INFO)
SLARRF finds a new relatively robust representation such that at least one of the eigenvalues is relatively isolated.
โจ Purpose โจ
Given the initial representation L D L^T and its cluster of close eigenvalues (in a relative measure), W( CLSTRT ), W( CLSTRT+1 ), ... W( CLEND ), SLARRF finds a new relatively robust representation L D L^T - SIGMA I = L(+) D(+) L(+)^T such that at least one of the eigenvalues of L(+) D(+) L(+)^T is relatively isolated.
๐ Parameters ๐
Nis anINTEGER. The order of the matrix (subblock, if the matrix split).Dis aREALarray, dimension(N). TheNdiagonal elements of the diagonal matrixD.Lis aREALarray, dimension(N-1). The(N-1)subdiagonal elements of the unit bidiagonal matrixL.LDis aREALarray, dimension(N-1). The(N-1)elementsL(i)*D(i).CLSTRTis anINTEGER. The index of the first eigenvalue in the cluster.CLENDis anINTEGER. The index of the last eigenvalue in the cluster.Wis aREALarray, dimension dimension is>= (CLEND-CLSTRT+1). The eigenvalue APPROXIMATIONS ofL D L^Tin ascending order.W( CLSTRT )throughW( CLEND )form the cluster of relatively close eigenalues.WGAPis aREALarray, dimension dimension is>= (CLEND-CLSTRT+1). The separation from the right neighbor eigenvalue inW.WERRis aREALarray, dimension dimension is>= (CLEND-CLSTRT+1).WERRcontain the semiwidth of the uncertainty interval of the corresponding eigenvalue APPROXIMATION inWSPDIAMis aREAL. estimate of the spectral diameter obtained from the Gerschgorin intervalsCLGAPLis aREAL.CLGAPRis aREAL. absolute gap on each end of the cluster. Set by the calling routine to protect against shifts too close to eigenvalues outside the cluster.PIVMINis aREAL. The minimum pivot allowed in the Sturm sequence.SIGMAis aREAL. The shift used to formL(+) D(+) L(+)^T.DPLUSis aREALarray, dimension(N). TheNdiagonal elements of the diagonal matrixD(+).LPLUSis aREALarray, dimension(N-1). The first(N-1)elements ofLPLUScontain the subdiagonal elements of the unit bidiagonal matrixL(+).WORKis aREALarray, dimension(2*N). Workspace.INFOis anINTEGER. Signals processing OK (=0) or failure (=1)
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors ๐
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
๐ฆ subroutine slarrj ๐ฆ
subroutine slarrj (integer N, real, dimension( * ) D, real, dimension( * )
E2, integer IFIRST, integer ILAST, real RTOL, integer OFFSET, real,
dimension( * ) W, real, dimension( * ) WERR, real, dimension( * ) WORK,
integer, dimension( * ) IWORK, real PIVMIN, real SPDIAM, integer INFO)
SLARRJ performs refinement of the initial estimates of the eigenvalues of the matrix T.
โจ Purpose โจ
okay so bestie, here's the tea: SLARRJ takes your initial eigenvalue guesses for T and does bisection to refine the eigenvalues W( IFIRST-OFFSET ) through W( ILAST-OFFSET ) so they're more accurate. You feed in the initial guesses in W, and the error estimates for those guesses in WERR. While it's bisecting, it keeps track of intervals [left, right] by stashing their mid-points and semi-widths in the arrays W and WERR respectively. periodt. ๐
Parameters โจ
NโNis INTEGER. The order of the matrix. ๐DโDis REAL array, dimension(N). The N diagonal elements of T. ๐E2โE2is REAL array, dimension(N-1). The Squares of the(N-1)subdiagonal elements of T. ๐ฆIFIRSTโIFIRSTis INTEGER. The index of the first eigenvalue to be computed. ๐ธILASTโILASTis INTEGER. The index of the last eigenvalue to be computed. ๐RTOLโRTOLis REAL. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < RTOL*MAX(|LEFT|,|RIGHT|). ๐OFFSETโOFFSETis INTEGER. Offset for the arraysWandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are to be used. โจWโWis REAL array, dimension(N). On input,W( IFIRST-OFFSET )throughW( ILAST-OFFSET )are estimates of the eigenvalues ofL D L^TindexedIFIRSTthroughILAST. On output, these estimates are refined. ๐WERRโWERRis REAL array, dimension(N). On input,WERR( IFIRST-OFFSET )throughWERR( ILAST-OFFSET )are the errors in the estimates of the corresponding elements inW. On output, these errors are refined. ๐WORKโWORKis REAL array, dimension(2*N). Workspace. ๐ ๏ธIWORKโIWORKis INTEGER array, dimension(2*N). Workspace. ๐ ๏ธPIVMINโPIVMINis REAL. The minimum pivot in the Sturm sequence for T. ๐ฅSPDIAMโSPDIAMis REAL. The spectral diameter of T. ๐INFOโINFOis INTEGER. Error flag. ๐ฉ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors ๐ซถ
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
subroutine slarrk (integer N, integer IW, real GL, real GU, real, dimension(
* ) D, real, dimension( * ) E2, real PIVMIN, real RELTOL, real W, real
WERR, integer INFO)
SLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. ๐
Purpose
SLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. This is an auxiliary code to be called from SSTEMR. ๐
To avoid overflow, the matrix must be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value, and for greatest accuracy, it should not be much smaller than that. โ ๏ธ
See W. Kahan 'Accurate Eigenvalues of a Symmetric Tridiagonal Matrix', Report CS41, Computer Science Dept., Stanford University, July 21, 1966. ๐
Parameters
NโNis INTEGER. The order of the tridiagonal matrix T.N >= 0. ๐IWโIWis INTEGER. The index of the eigenvalues to be returned. ๐ขGLโGLis REAL. ๐ธGUโGUis REAL. An upper and a lower bound on the eigenvalue. ๐๐DโDis REAL array, dimension(N). The n diagonal elements of the tridiagonal matrix T. ๐E2โE2is REAL array, dimension(N-1). The(n-1)squared off-diagonal elements of the tridiagonal matrix T. ๐ฆPIVMINโPIVMINis REAL. The minimum pivot allowed in the Sturm sequence for T. ๐ฅRELTOLโRELTOLis REAL. The minimum relative width of an interval. When an interval is narrower thanRELTOLtimes the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at leastradix*machine epsilon. โจWโWis REAL. ๐WERRโWERRis REAL. The error bound on the corresponding eigenvalue approximation inW. ๐INFOโINFOis INTEGER.= 0: Eigenvalue converged โ= -1: Eigenvalue did NOT converge โ
Internal Parameters
FUDGEโFUDGEis REAL, default= 2. A 'fudge factor' to widen the Gershgorin intervals. ๐ฌ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine slarrr (integer N, real, dimension( * ) D, real, dimension( * )
E, integer INFO)
SLARRR performs tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. ๐ธ
Purpose
Perform tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. ๐ง
Parameters
NโNis INTEGER. The order of the matrix.N > 0. ๐DโDis REAL array, dimension(N). The N diagonal elements of the tridiagonal matrix T. ๐EโEis REAL array, dimension(N). On entry, the first(N-1)entries contain the subdiagonal elements of the tridiagonal matrix T;E(N)is set to ZERO. ๐ฆINFOโINFOis INTEGER.INFO = 0(default): the matrix warrants computations preserving relative accuracy. โINFO = 1: the matrix warrants computations guaranteeing only absolute accuracy. โ ๏ธ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors ๐ซถ
- Beresford Parlett, University of California, Berkeley, USA
- Jim Demmel, University of California, Berkeley, USA
- Inderjit Dhillon, University of Texas, Austin, USA
- Osni Marques, LBNL/NERSC, USA
- Christof Voemel, University of California, Berkeley, USA
subroutine slartgp (real F, real G, real CS, real SN, real R)
SLARTGP generates a plane rotation so that the diagonal is nonnegative. โจ
Purpose
SLARTGP generates a plane rotation so that
[ CS SN ] . [ F ] = [ R ] where CS**2 + SN**2 = 1.
[ -SN CS ] [ G ] [ 0 ]
This is a slower, more accurate version of the Level 1 BLAS routine SROTG, with the following other differences:
FandGare unchanged on return.- If
G=0, thenCS=(+/-)1andSN=0. - If
F=0and(G .ne. 0), thenCS=0andSN=(+/-)1.
The sign is chosen so that R >= 0. ๐
Parameters
FโFis REAL. The first component of vector to be rotated. ๐ฏGโGis REAL. The second component of vector to be rotated. ๐ฏCSโCSis REAL. The cosine of the rotation. ๐SNโSNis REAL. The sine of the rotation. ๐RโRis REAL. The nonzero component of the rotated vector. ๐ฏ
This version has a few statements commented out for thread safety (machine parameters are computed on each entry). 10 feb 03, SJH. ๐งต
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine slaruv (integer, dimension( 4 ) ISEED, integer N, real,
dimension( n ) X)
SLARUV returns a vector of n random real numbers from a uniform distribution. ๐ฒ
Purpose
SLARUV returns a vector of n random real numbers from a uniform (0,1) distribution (n <= 128). ๐ข
This is an auxiliary routine called by SLARNV and CLARNV. ๐
Parameters
ISEEDโISEEDis INTEGER array, dimension(4). On entry, the seed of the random number generator; the array elements must be between 0 and 4095, andISEED(4)must be odd. On exit, the seed is updated. ๐ฑNโNis INTEGER. The number of random numbers to be generated.N <= 128. ๐ขXโXis REAL array, dimension(N). The generated random numbers. ๐ฒ
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
This routine uses a multiplicative congruential method with modulus 2**48 and multiplier 33952834046453 (see G.S.Fishman, 'Multiplicative congruential random number generators with modulus 2**b: an exhaustive analysis for b = 32 and a partial analysis for b = 48', Math. Comp. 189, pp 331-344, 1990). ๐
48-bit integers are stored in 4 integer array elements with 12 bits per element. Hence the routine is portable across machines with integers of 32 bits or more. ๐ป
subroutine slas2 (real F, real G, real H, real SSMIN, real SSMAX)
SLAS2 computes singular values of a 2-by-2 triangular matrix. ๐
Purpose
SLAS2 computes the singular values of the 2-by-2 matrix
[ F G ]
[ 0 H ].
On return, SSMIN is the smaller singular value and SSMAX is the larger singular value. ๐ข
Parameters
FโFis REAL. The (1,1) element of the 2-by-2 matrix. ๐GโGis REAL. The (1,2) element of the 2-by-2 matrix. ๐HโHis REAL. The (2,2) element of the 2-by-2 matrix. ๐SSMINโSSMINโSSMINisREALand it's the smaller singular value. the lil one ๐ฅบSSMAXโSSMAXisREALand it's the larger singular value. the big one, the main character of the pair ๐
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: โจ
Barring over/underflow, all output quantities are correct to within a few units in the last place (ulps), even in the absence of a guard digit in addition/subtraction. like, so accurate bestie ๐
In IEEE arithmetic, the code works correctly if one matrix element is infinite. iconic behaviour honestly โจ
Overflow will not occur unless the largest singular value itself overflows, or is within a few ulps of overflow. (On machines with partial overflow, like the Cray, overflow may occur if the largest singular value is within a factor of 2 of overflow.)
Underflow is harmless if underflow is gradual. Otherwise, results may correspond to a matrix modified by perturbations of size near the underflow threshold. so if your underflow is abrupt, the answers are giving "vaguely related to your matrix" energy ๐ญ
subroutine slascl ๐
subroutine slascl (character TYPE, integer KL, integer KU, real CFROM, real
CTO, integer M, integer N, real, dimension( lda, * ) A, integer LDA,
integer INFO)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom. math but make it safe โจ
Purpose:
SLASCL multiplies the M by N real matrix A by the real scalar CTO/CFROM. This is done without over/underflow as long as the final result CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that A may be full, upper triangular, lower triangular, upper Hessenberg, or banded. it's giving "glow up your matrix, no casualties" ๐
Parameters
TYPEโTYPEisCHARACTER*1.TYPEindices the storage type of the input matrix.= 'G': A is a full matrix.= 'L': A is a lower triangular matrix.= 'U': A is an upper triangular matrix.= 'H': A is an upper Hessenberg matrix.= 'B': A is a symmetric band matrix with lower bandwidthKLand upper bandwidthKUand with the only the lower half stored.= 'Q': A is a symmetric band matrix with lower bandwidthKLand upper bandwidthKUand with the only the upper half stored.= 'Z': A is a band matrix with lower bandwidthKLand upper bandwidthKU. SeeSGBTRFfor storage details.
KLโKLisINTEGER. The lower bandwidth of A. Referenced only ifTYPE = 'B','Q'or'Z'.KUโKUisINTEGER. The upper bandwidth of A. Referenced only ifTYPE = 'B','Q'or'Z'.CFROMโCFROMisREAL.CTOโCTOisREAL.
The matrix A is multiplied by CTO/CFROM. A(I,J) is computed without over/underflow if the final result CTO*A(I,J)/CFROM can be represented without over/underflow. CFROM must be nonzero. like do NOT hand it a zero bestie, that's a one-way ticket to chaos ๐
MโMisINTEGER. The number of rows of the matrix A.M >= 0.NโNisINTEGER. The number of columns of the matrix A.N >= 0.AโAisREALarray, dimension(LDA,N). The matrix to be multiplied byCTO/CFROM. SeeTYPEfor the storage type.LDAโLDAisINTEGER. The leading dimension of the array A.- If
TYPE = 'G', 'L', 'U', 'H',LDA >= max(1,M); TYPE = 'B',LDA >= KL+1;TYPE = 'Q',LDA >= KU+1;TYPE = 'Z',LDA >= 2*KL+KU+1.
- If
INFOโINFOisINTEGER0- successful exit โจ<0- ifINFO = -i, the i-th argument had an illegal value. rude, honestly ๐ญ
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine slasd0 ๐ฆ
subroutine slasd0 (integer N, integer SQRE, real, dimension( * ) D, real,
dimension( * ) E, real, dimension( ldu, * ) U, integer LDU, real,
dimension( ldvt, * ) VT, integer LDVT, integer SMLSIZ, integer,
dimension( * ) IWORK, real, dimension( * ) WORK, integer INFO)
SLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e. Used by sbdsdc. divide and conquer era ๐
Purpose:
Using a divide and conquer approach, SLASD0 computes the singular value decomposition (SVD) of a real upper bidiagonal N-by-M matrix B with diagonal D and offdiagonal E, where M = N + SQRE. The algorithm computes orthogonal matrices U and VT such that B = U * S * VT. The singular values S are overwritten on D.
A related subroutine, SLASDA, computes only the singular values, and optionally, the singular vectors in compact form.
Parameters
NโNisINTEGER. On entry, the row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal array D.SQREโSQREisINTEGER. Specifies the column dimension of the bidiagonal matrix.= 0: The bidiagonal matrix has column dimensionM = N;= 1: The bidiagonal matrix has column dimensionM = N+1;
DโDisREALarray, dimension(N). On entry D contains the main diagonal of the bidiagonal matrix. On exit D, ifINFO = 0, contains its singular values. glow up complete bestie ๐EโEisREALarray, dimension(M-1). Contains the subdiagonal entries of the bidiagonal matrix. On exit, E has been destroyed. gone. reduced to atoms. ๐UโUisREALarray, dimension(LDU, N). On exit, U contains the left singular vectors.LDUโLDUisINTEGER. On entry, leading dimension of U.VTโVTisREALarray, dimension(LDVT, M). On exit,VT**Tcontains the right singular vectors.LDVTโLDVTisINTEGER. On entry, leading dimension of VT.SMLSIZโSMLSIZisINTEGER. On entry, maximum size of the subproblems at the bottom of the computation tree.IWORKโIWORKisINTEGERarray, dimension(8*N).WORKโWORKisREALarray, dimension(3*M**2+2*M).INFOโINFOisINTEGER= 0: successful exit. โจ< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. she's not converging, she's just not ๐ญ
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
subroutine slasd1 ๐ธ
subroutine slasd1 (integer NL, integer NR, integer SQRE, real, dimension( *
) D, real ALPHA, real BETA, real, dimension( ldu, * ) U, integer LDU,
real, dimension( ldvt, * ) VT, integer LDVT, integer, dimension( * )
IDXQ, integer, dimension( * ) IWORK, real, dimension( * ) WORK, integer
INFO)
SLASD1 computes the SVD of an upper bidiagonal matrix B of the specified size. Used by sbdsdc. the sequel to SLASD0, no skips ๐
Purpose:
SLASD1 computes the SVD of an upper bidiagonal N-by-M matrix B, where N = NL + NR + 1 and M = N + SQRE. SLASD1 is called from SLASD0.
A related subroutine SLASD7 handles the case in which the singular values (and the singular vectors in factored form) are desired.
SLASD1 computes the SVD as follows:
( D1(in) 0 0 0 )
B = U(in) * ( Z1**T a Z2**T b ) * VT(in)
( 0 0 D2(in) 0 )
= U(out) * ( D(out) 0) * VT(out)
where Z**T = (Z1**T a Z2**T b) = u**T VT**T, and u is a vector of dimension M with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros elsewhere; and the entry b is empty if SQRE = 0.
The left singular vectors of the original matrix are stored in U, and the transpose of the right singular vectors are stored in VT, and the singular values are in D. The algorithm consists of three stages:
- The first stage consists of deflating the size of the problem when there are multiple singular values or when there are zeros in the Z vector. For each such occurrence the dimension of the secular equation problem is reduced by one. This stage is performed by the routine
SLASD2. - The second stage consists of calculating the updated singular values. This is done by finding the square roots of the roots of the secular equation via the routine
SLASD4(as called bySLASD3). This routine also calculates the singular vectors of the current problem. secular equation girlies rise up โจ - The final stage consists of computing the updated singular vectors directly using the updated singular values. The singular vectors for the current problem are multiplied with the singular vectors from the overall problem.
Parameters
NLโNLisINTEGER. The row dimension of the upper block.NL >= 1.NRโNRisINTEGER. The row dimension of the lower block.NR >= 1.SQREโSQREisINTEGER= 0: the lower block is an NR-by-NR square matrix.= 1: the lower block is an NR-by-(NR+1) rectangular matrix.
The bidiagonal matrix has row dimension N = NL + NR + 1, and column dimension M = N + SQRE.
DโDisREALarray, dimension(NL+NR+1).N = NL+NR+1. On entryD(1:NL,1:NL)contains the singular values of the upper block; andD(NL+2:N)contains the singular values of the lower block. On exitD(1:N)contains the singular values of the modified matrix.ALPHAโALPHAisREAL. Contains the diagonal element associated with the added row.BETAโBETAisREAL. Contains the off-diagonal element associated with the added row.UโUisREALarray, dimension(LDU,N). On entryU(1:NL, 1:NL)contains the left singular vectors of the upper block;U(NL+2:N, NL+2:N)contains the left singular vectors of the lower block. On exit U contains the left singular vectors of the bidiagonal matrix.LDULDUโ INTEGER. Bestie, this is just the leading dimension of the arrayU. And the vibe check is:LDU >= max( 1, N ). ๐VTโ REAL array, dimension(LDVT,M)whereM = N + SQRE. On entry,VT(1:NL+1, 1:NL+1)**Tis holding the right singular vectors of the upper block, andVT(NL+2:M, NL+2:M)**Thas the right singular vectors of the lower block. On exit?VT**Tcontains the right singular vectors of the bidiagonal matrix. She's giving transformation. ๐ฆLDVTโ INTEGER. The leading dimension of the arrayVT. Requirement, no cap:LDVT >= max( 1, M ).IDXQโ INTEGER array, dimension(N). This one carries the permutation that will reintegrate the subproblem we just solved back into sorted order, i.e.D( IDXQ( I = 1, N ) )will be in ascending order. So satisfying honestly. โจIWORKโ INTEGER array, dimension(4*N). Just workspace, she's chilling. ๐WORKโ REAL array, dimension(3*M**2+2*M). Also just workspace. Look at that dimension though, it's eating. ๐ฅINFOโ INTEGER. The whole mood report:= 0: successful exit. We love a clean run. ๐< 0: ifINFO = -i, the i-th argument had an illegal value. Not her fault, it's the input's fault.> 0: ifINFO = 1, a singular value did not converge. ๐ญ
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors:
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasd2
subroutine slasd2 (integer NL, integer NR, integer SQRE, integer K, real,
dimension( * ) D, real, dimension( * ) Z, real ALPHA, real BETA, real,
dimension( ldu, * ) U, integer LDU, real, dimension( ldvt, * ) VT,
integer LDVT, real, dimension( * ) DSIGMA, real, dimension( ldu2, * )
U2, integer LDU2, real, dimension( ldvt2, * ) VT2, integer LDVT2,
integer, dimension( * ) IDXP, integer, dimension( * ) IDX, integer,
dimension( * ) IDXC, integer, dimension( * ) IDXQ, integer, dimension( *
) COLTYP, integer INFO)
SLASD2 merges the two sets of singular values together into a single sorted set. Used by sbdsdc. ๐ซ
โจ Purpose:
SLASD2 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together, or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one. Lowkey a glow-down for the problem size, and we're obsessed. ๐
SLASD2 is called from SLASD1. ๐
โจ Parameters
NLโ INTEGER. The row dimension of the upper block.NL >= 1.NRโ INTEGER. The row dimension of the lower block.NR >= 1.SQREโ INTEGER. Pick your fighter:= 0: the lower block is anNR-by-NRsquare matrix.= 1: the lower block is anNR-by-(NR+1)rectangular matrix.
The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns. Math is mathing. ๐ธ
Kโ INTEGER. Contains the dimension of the non-deflated matrix. This is the order of the related secular equation.1 <= K <=N.Dโ REAL array, dimension(N). On entry,Dcontains the singular values of the two submatrices to be combined. On exit,Dcontains the trailing(N-K)updated singular values (those which were deflated) sorted into increasing order. Sorted and thriving. โจZโ REAL array, dimension(N). On exit,Zcontains the updating row vector in the secular equation.ALPHAโ REAL. Contains the diagonal element associated with the added row.BETAโ REAL. Contains the off-diagonal element associated with the added row.Uโ REAL array, dimension(LDU,N). On entry,Ucontains the left singular vectors of two submatrices in the two square blocks with corners at(1,1),(NL, NL), and(NL+2, NL+2),(N,N). On exit,Ucontains the trailing(N-K)updated left singular vectors (those which were deflated) in its lastN-Kcolumns. She moved out, she's in her new columns now. ๐ฆLDUโ INTEGER. The leading dimension of the arrayU.LDU >= N.VTโ REAL array, dimension(LDVT,M). On entry,VT**Tcontains the right singular vectors of two submatrices in the two square blocks with corners at(1,1),(NL+1, NL+1), and(NL+2, NL+2),(M,M). On exit,VT**Tcontains the trailing(N-K)updated right singular vectors (those which were deflated) in its lastN-Kcolumns. In caseSQRE =1, the last row ofVTspans the right null space. Ngl, that null space row is doing main character energy. ๐LDVTโ INTEGER. The leading dimension of the arrayVT.LDVT >= M.DSIGMAโ REAL array, dimension(N). Contains a copy of the diagonal elements (K-1singular values and one zero) in the secular equation. Yes bestie, one of them is literally zero. It's fine. ๐U2โ REAL array, dimension(LDU2,N). Contains a copy of the firstK-1left singular vectors which will be used bySLASD3in a matrix multiply (SGEMM) to solve for the new left singular vectors.U2is arranged into four blocks:- the first block contains a column with
1atNL+1and zero everywhere else; - the second block contains non-zero entries only at and above
NL; - the third contains non-zero entries only below
NL+1; - and the fourth is dense. ๐
- the first block contains a column with
LDU2โ INTEGER. The leading dimension of the arrayU2.LDU2 >= N.VT2โ REAL array, dimension(LDVT2,N).VT2**Tcontains a copy of the firstKright singular vectors which will be used bySLASD3in a matrix multiply (SGEMM) to solve for the new right singular vectors.VT2is arranged into three blocks:- the first block contains a row that corresponds to the special
0diagonal element inSIGMA; - the second block contains non-zeros only at and before
NL +1; - the third block contains non-zeros only at and after
NL +2.
- the first block contains a row that corresponds to the special
Three blocks, four blocks, we're just built different. ๐
LDVT2โ INTEGER. The leading dimension of the arrayVT2.LDVT2 >= M.IDXPโ INTEGER array, dimension(N). This will contain the permutation used to place deflated values ofDat the end of the array. On outputIDXP(2:K)points to the nondeflatedD-values andIDXP(K+1:N)points to the deflated singular values. Deflated ones get sent to the back, respectfully. ๐IDXโ INTEGER array, dimension(N). This will contain the permutation used to sort the contents ofDinto ascending order.IDXCโ INTEGER array, dimension(N). This will contain the permutation used to arrange the columns of the deflatedUmatrix into three groups:- the first group contains non-zero entries only at and above
NL; - the second contains non-zero entries only below
NL+2; - and the third is dense.
- the first group contains non-zero entries only at and above
IDXQโ INTEGER array, dimension(N). This contains the permutation which separately sorts the two sub-problems inDinto ascending order. Note that entries in the first half of this permutation must first be moved one position backward, and entries in the second half must first haveNL+1added to their values. Little index choreography, iykyk. ๐งCOLTYPโ INTEGER array, dimension(N). As workspace, this will contain a label which will indicate which of the following types a column in theU2matrix or a row in theVT2matrix is:- non-zero in the upper half only
- non-zero in the lower half only
- dense
- deflated
On exit, it is an array of dimension 4, with COLTYP(I) being the dimension of the I-th type columns. She's a whole census now. ๐
INFOโ INTEGER:= 0: successful exit. โจ< 0: ifINFO = -i, the i-th argument had an illegal value.
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors:
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasd3
subroutine slasd3 (integer NL, integer NR, integer SQRE, integer K, real,
dimension( * ) D, real, dimension( ldq, * ) Q, integer LDQ, real,
dimension( * ) DSIGMA, real, dimension( ldu, * ) U, integer LDU, real,
dimension( ldu2, * ) U2, integer LDU2, real, dimension( ldvt, * ) VT,
integer LDVT, real, dimension( ldvt2, * ) VT2, integer LDVT2, integer,
dimension( * ) IDXC, integer, dimension( * ) CTOT, real, dimension( * )
Z, integer INFO)
SLASD3 finds all square roots of the roots of the secular equation, as defined by the values in D and Z, and then updates the singular vectors by matrix multiplication. Used by sbdsdc. ๐ซ
โจ Purpose:
SLASD3 finds all the square roots of the roots of the secular equation, as defined by the values in D and Z. It makes the appropriate calls to SLASD4 and then updates the singular vectors by matrix multiplication.
This code makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray XMP, Cray YMP, Cray C 90, or Cray 2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none. Okay so this is the "we're pretty sure it's fine" clause and I respect the honesty fr fr. ๐ญ
SLASD3 is called from SLASD1.
โจ Parameters
NLโ INTEGER. The row dimension of the upper block.NL >= 1.NRโ INTEGER. The row dimension of the lower block.NR >= 1.SQREโ INTEGER. Choose your fighter, again:= 0: the lower block is anNR-by-NRsquare matrix.= 1: the lower block is anNR-by-(NR+1)rectangular matrix.
The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns. Same lore as before, no notes. ๐ธ
KKโ INTEGER. The size of the secular equation, and it's gotta stay in its lane:1 =< K = < N. ๐Dโ REAL array, dimension(K). On exit this is holding the square roots of the roots of the secular equation, all lined up pretty in ascending order. โจQโ REAL array, dimension(LDQ,K). She's just sitting here being an array, bestie, no extra lore.LDQโ INTEGER. The leading dimension of the arrayQ. Rule of the land:LDQ >= K.DSIGMAโ REAL array, dimension(K). The firstKelements of this array contain the old roots of the deflated updating problem. These are literally the poles of the secular equation. ๐ฏUโ REAL array, dimension(LDU, N). The lastN - Kcolumns of this matrix contain the deflated left singular vectors.LDUโ INTEGER. The leading dimension of the arrayU.LDU >= N, no negotiating. ๐ โโ๏ธU2โ REAL array, dimension(LDU2, N). The firstKcolumns of this matrix contain the non-deflated left singular vectors for the split problem.LDU2โ INTEGER. The leading dimension of the arrayU2.LDU2 >= N.VTโ REAL array, dimension(LDVT, M). The lastM - Kcolumns ofVT**Tcontain the deflated right singular vectors. Note the transpose, she's doing a little flip. ๐LDVTโ INTEGER. The leading dimension of the arrayVT.LDVT >= N.VT2โ REAL array, dimension(LDVT2, N). The firstKcolumns ofVT2**Tcontain the non-deflated right singular vectors for the split problem.LDVT2โ INTEGER. The leading dimension of the arrayVT2.LDVT2 >= N.IDXCโ INTEGER array, dimension(N). This is the permutation used to arrange the columns ofU(and rows ofVT) into three whole groups: the first group contains non-zero entries only at and above (or before)NL +1; the second contains non-zero entries only at and below (or after)NL+2; and the third one is just dense. The first column ofUand the row ofVTare treated separately though โ they're the special main characters here. ๐
The rows of the singular vectors found by SLASD4 must be likewise permuted before the matrix multiplies can take place. Don't skip that step, fr fr.
CTOTโ INTEGER array, dimension(4). A count of the total number of the various types of columns inU(or rows inVT), as described inIDXC. The fourth column type is any column which has been deflated.Zโ REAL array, dimension(K). The firstKelements of this array contain the components of the deflation-adjusted updating row vector. She's adjusted, she's deflated, she's thriving. ๐INFOโ INTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. ๐ญ
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
subroutine slasd4 ๐ฆ
subroutine slasd4 (integer N, integer I, real, dimension( * ) D, real,
dimension( * ) Z, real, dimension( * ) DELTA, real RHO, real SIGMA,
real, dimension( * ) WORK, integer INFO)
SLASD4 computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix. Used by sbdsdc. Slay.
Purpose: โจ
This subroutine computes the square root of the I-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix whose entries are given as the squares of the corresponding entries in the array d, and that
0 <= D(i) < D(j) for i < j
and that RHO > 0. This is arranged by the calling routine, and is no loss in generality โ we're just keeping things tidy, bestie. The rank-one modified system is thus
diag( D ) * diag( D ) + RHO * Z * Z_transpose.
where we assume the Euclidean norm of Z is 1.
The method consists of approximating the rational functions in the secular equation by simpler interpolating rational functions. Iconic behaviour, honestly.
Parameters ๐
Nโ INTEGER. The length of all arrays.Iโ INTEGER. The index of the eigenvalue to be computed.1 <= I <= N.Dโ REAL array, dimension( N ). The original eigenvalues. It is assumed that they are in order,0 <= D(I) < D(J)forI < J.Zโ REAL array, dimension( N ). The components of the updating vector.DELTAโ REAL array, dimension( N ). IfN .ne. 1,DELTAcontains(D(j) - sigma_I)in its j-th component. IfN = 1, thenDELTA(1) = 1. The vectorDELTAcontains the information necessary to construct the (singular) eigenvectors.RHOโ REAL. The scalar in the symmetric updating formula.SIGMAโ REAL. The computedsigma_I, the I-th updated eigenvalue.WORKโ REAL array, dimension( N ). IfN .ne. 1,WORKcontains(D(j) + sigma_I)in its j-th component. IfN = 1, thenWORK( 1 ) = 1.INFOโ INTEGER.= 0: successful exit> 0: ifINFO = 1, the updating process failed. ๐
Internal Parameters: ๐ฅ
Logical variable ORGATI (origin-at-i?) is used for distinguishing whether D(i) or D(i+1) is treated as the origin.
ORGATI = .true. origin at i
ORGATI = .false. origin at i+1
Logical variable SWTCH3 (switch-for-3-poles?) is for noting if we are working with THREE poles!
MAXIT is the maximum number of iterations allowed for each eigenvalue.
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: ๐ซถ
Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA
subroutine slasd5 ๐
subroutine slasd5 (integer I, real, dimension( 2 ) D, real, dimension( 2 )
Z, real, dimension( 2 ) DELTA, real RHO, real DSIGMA, real, dimension( 2
) WORK)
SLASD5 computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix. Used by sbdsdc. Tiny matrix, big energy. โจ
Purpose: ๐
This subroutine computes the square root of the I-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix
diag( D ) * diag( D ) + RHO * Z * transpose(Z) .
The diagonal entries in the array D are assumed to satisfy
0 <= D(i) < D(j) for i < j .
We also assume RHO > 0 and that the Euclidean norm of the vector Z is one.
Parameters ๐
Iโ INTEGER. The index of the eigenvalue to be computed.I = 1orI = 2.Dโ REAL array, dimension(2). The original eigenvalues. We assume0 <= D(1) < D(2).Zโ REAL array, dimension(2). The components of the updating vector.DELTAโ REAL array, dimension(2). Contains(D(j) - sigma_I)in its j-th component. The vectorDELTAcontains the information necessary to construct the eigenvectors.RHOโ REAL. The scalar in the symmetric updating formula.DSIGMAโ REAL. The computedsigma_I, the I-th updated eigenvalue.WORKโ REAL array, dimension(2).WORKcontains(D(j) + sigma_I)in its j-th component.
Author ๐ธ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: ๐ซถ
Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA
subroutine slasd6 ๐
subroutine slasd6 (integer ICOMPQ, integer NL, integer NR, integer SQRE,
real, dimension( * ) D, real, dimension( * ) VF, real, dimension( * )
VL, real ALPHA, real BETA, integer, dimension( * ) IDXQ, integer,
dimension( * ) PERM, integer GIVPTR, integer, dimension( ldgcol, * )
GIVCOL, integer LDGCOL, real, dimension( ldgnum, * ) GIVNUM, integer
LDGNUM, real, dimension( ldgnum, * ) POLES, real, dimension( * ) DIFL,
real, dimension( * ) DIFR, real, dimension( * ) Z, integer K, real C,
real S, real, dimension( * ) WORK, integer, dimension( * ) IWORK,
integer INFO)
SLASD6 computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used by sbdsdc. Okay this one is lowkey the whole friend group merging. ๐ซ
Purpose: โจ
SLASD6 computes the SVD of an updated upper bidiagonal matrix B obtained by merging two smaller ones by appending a row. This routine is used only for the problem which requires all singular values and optionally singular vector matrices in factored form. B is an N-by-M matrix with N = NL + NR + 1 and M = N + SQRE. A related subroutine, SLASD1, handles the case in which all singular values and singular vectors of the bidiagonal matrix are desired.
SLASD6 computes the SVD as follows:
( D1(in) 0 0 0 )
B = U(in) * ( Z1**T a Z2**T b ) * VT(in)
( 0 0 D2(in) 0 )
= U(out) * ( D(out) 0) * VT(out)
where Z**T = (Z1**T a Z2**T b) = u**T VT**T, and u is a vector of dimension M with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros elsewhere; and the entry b is empty if SQRE = 0.
The singular values of B can be computed using D1, D2, the first components of all the right singular vectors of the lower block, and the last components of all the right singular vectors of the upper block. These components are stored and updated in VF and VL, respectively, in SLASD6. Hence U and VT are not explicitly referenced.
The singular values are stored in D. The algorithm consists of two stages:
Okay so stage one is all about deflating the size of the problem when there are multiple singular values or when there's a zero in the Z vector. Every time that happens, the dimension of the secular equation problem gets reduced by one. This stage is handled by the routine SLASD7. ๐
Stage two is where we calculate the updated singular values. We do that by finding the roots of the secular equation via the routine SLASD4 (as called by SLASD8). That routine also updates VF and VL, and it computes the distances between the updated singular values and the old singular values. โจ
SLASD6 is called from SLASDA. ๐ฆ
โจ Parameters โจ
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in factored form:= 0: compute singular values only.= 1: compute singular vectors in factored form as well. ๐NLโINTEGER. The row dimension of the upper block.NL >= 1.NRโINTEGER. The row dimension of the lower block.NR >= 1.SQREโINTEGER.= 0: the lower block is anNR-by-NRsquare matrix.= 1: the lower block is anNR-by-(NR+1) rectangular matrix. The bidiagonal matrix has row dimensionN = NL + NR + 1, and column dimensionM = N + SQRE.DโREALarray, dimension(NL+NR+1). On entryD(1:NL,1:NL)contains the singular values of the upper block, andD(NL+2:N)contains the singular values of the lower block. On exitD(1:N)contains the singular values of the modified matrix.VFโREALarray, dimension(M). On entry,VF(1:NL+1)contains the first components of all right singular vectors of the upper block; andVF(NL+2:M)contains the first components of all right singular vectors of the lower block. On exit,VFcontains the first components of all right singular vectors of the bidiagonal matrix.VLโREALarray, dimension(M). On entry,VL(1:NL+1)contains the last components of all right singular vectors of the upper block; andVL(NL+2:M)contains the last components of all right singular vectors of the lower block. On exit,VLcontains the last components of all right singular vectors of the bidiagonal matrix.ALPHAโREAL. Contains the diagonal element associated with the added row.BETAโREAL. Contains the off-diagonal element associated with the added row.IDXQโINTEGERarray, dimension(N). This contains the permutation which will reintegrate the subproblem just solved back into sorted order, i.e.D( IDXQ( I = 1, N ) )will be in ascending order.PERMโINTEGERarray, dimension( N ). The permutations (from deflation and sorting) to be applied to each block. Not referenced ifICOMPQ = 0.GIVPTRโINTEGER. The number of Givens rotations which took place in this subproblem. Not referenced ifICOMPQ = 0.GIVCOLโINTEGERarray, dimension( LDGCOL, 2 ). Each pair of numbers indicates a pair of columns to take place in a Givens rotation. Not referenced ifICOMPQ = 0.LDGCOLโINTEGER. leading dimension ofGIVCOL, must be at leastN.GIVNUMโREALarray, dimension( LDGNUM, 2 ). Each number indicates theCorSvalue to be used in the corresponding Givens rotation. Not referenced ifICOMPQ = 0.LDGNUMโINTEGER. The leading dimension ofGIVNUMandPOLES, must be at leastN.POLESโREALarray, dimension( LDGNUM, 2 ). On exit,POLES(1,*)is an array containing the new singular values obtained from solving the secular equation, andPOLES(2,*)is an array containing the poles in the secular equation. Not referenced ifICOMPQ = 0.DIFLโREALarray, dimension( N ). On exit,DIFL(I)is the distance betweenI-th updated (undeflated) singular value and theI-th (undeflated) old singular value.DIFRโREALarray, dimension( LDDIFR, 2 )ifICOMPQ = 1and dimension( K )ifICOMPQ = 0. On exit,DIFR(I,1) = D(I) - DSIGMA(I+1),DIFR(K,1)is not defined and will not be referenced. IfICOMPQ = 1,DIFR(1:K,2)is an array containing the normalizing factors for the right singular vector matrix. SeeSLASD8for details onDIFLandDIFR.ZโREALarray, dimension( M ). The first elements of this array contain the components of the deflation-adjusted updating row vector.KโINTEGER. Contains the dimension of the non-deflated matrix, This is the order of the related secular equation.1 <= K <=N.CโREAL.Ccontains garbage ifSQRE =0and theC-value of a Givens rotation related to the right null space ifSQRE = 1.SโREAL.Scontains garbage ifSQRE =0and theS-value of a Givens rotation related to the right null space ifSQRE = 1.WORKโREALarray, dimension( 4 * M ).IWORKโINTEGERarray, dimension( 3 * N ).INFOโINTEGER.= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge.
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasd7 ๐
subroutine slasd7 (integer ICOMPQ, integer NL, integer NR, integer SQRE,
integer K, real, dimension( * ) D, real, dimension( * ) Z, real,
dimension( * ) ZW, real, dimension( * ) VF, real, dimension( * ) VFW,
real, dimension( * ) VL, real, dimension( * ) VLW, real ALPHA, real
BETA, real, dimension( * ) DSIGMA, integer, dimension( * ) IDX, integer,
dimension( * ) IDXP, integer, dimension( * ) IDXQ, integer, dimension( *
) PERM, integer GIVPTR, integer, dimension( ldgcol, * ) GIVCOL, integer
LDGCOL, real, dimension( ldgnum, * ) GIVNUM, integer LDGNUM, real C,
real S, integer INFO)
SLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. Used by sbdsdc. ๐
Purpose ๐ฏ
SLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one.
SLASD7 is called from SLASD6.
โจ Parameters โจ
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in compact form, as follows:= 0: compute singular values only.= 1: compute singular vectors of upper bidiagonal matrix in compact form.NLโINTEGER. The row dimension of the upper block.NL >= 1.NRโINTEGER. The row dimension of the lower block.NR >= 1.SQREโINTEGER.= 0: the lower block is anNR-by-NRsquare matrix.= 1: the lower block is anNR-by-(NR+1) rectangular matrix. The bidiagonal matrix hasN = NL + NR + 1rows andM = N + SQRE >= Ncolumns.KโINTEGER. Contains the dimension of the non-deflated matrix, this is the order of the related secular equation.1 <= K <=N.DโREALarray, dimension( N ). On entryDcontains the singular values of the two submatrices to be combined. On exitDcontains the trailing(N-K)updated singular values (those which were deflated) sorted into increasing order.ZโREALarray, dimension( M ). On exitZcontains the updating row vector in the secular equation.ZWโREALarray, dimension( M ). Workspace forZ.VFโREALarray, dimension( M ). On entry,VF(1:NL+1)contains the first components of all right singular vectors of the upper block; andVF(NL+2:M)contains the first components of all right singular vectors of the lower block. On exit,VFcontains the first components of all right singular vectors of the bidiagonal matrix.VFWโREALarray, dimension( M ). Workspace forVF.VLโREALarray, dimension( M ). On entry,VL(1:NL+1)contains the last components of all right singular vectors of the upper block; andVL(NL+2:M)contains the last components of all right singular vectors of the lower block. On exit,VLcontains the last components of all right singular vectors of the bidiagonal matrix.VLWโREALarray, dimension( M ). Workspace forVL.ALPHAโREAL. Contains the diagonal element associated with the added row.BETABETAโ it'sREAL, and it holds the off-diagonal element that comes with the added row. that's it, that's the whole job ๐DSIGMAโREALarray, dimension( N ). It's holding a copy of the diagonal elements (that'sK-1singular values plus one lil zero) inside the secular equation. so basically the receipts โจIDXโINTEGERarray, dimension( N ). This one's gonna hold the permutation that sorts the contents ofDinto ascending order. putting D in its sorted era frIDXPโINTEGERarray, dimension( N ). Holds the permutation that places the deflated values ofDat the end of the array. On output,IDXP(2:K)points to the nondeflated D-values, andIDXP(K+1:N)points to the deflated singular values. deflated girlies to the back, periodt ๐IDXQโINTEGERarray, dimension( N ). Contains the permutation which separately sorts the two sub-problems inDinto ascending order. Heads up tho: entries in the first half of this permutation must first be moved one position backward, and entries in the second half must first haveNL+1added to their values. yes it's giving "read the instructions twice" energy ๐ญPERMโINTEGERarray, dimension( N ). The permutations (from deflation and sorting) to be applied to each singular block. Not referenced ifICOMPQ = 0. ๐ฆGIVPTRโINTEGER. The number of Givens rotations which took place in this subproblem. Not referenced ifICOMPQ = 0.GIVCOLโINTEGERarray, dimension( LDGCOL, 2 ). Each pair of numbers indicates a pair of columns to take place in a Givens rotation. Not referenced ifICOMPQ = 0.LDGCOLโINTEGER. The leading dimension ofGIVCOL, and it must be at leastN. no skipping on this one bestie.GIVNUMโREALarray, dimension( LDGNUM, 2 ). Each number indicates theCorSvalue to be used in the corresponding Givens rotation. Not referenced ifICOMPQ = 0.LDGNUMโINTEGER. The leading dimension ofGIVNUM, must be at leastN.CโREAL.Ccontains garbage ifSQRE = 0, and the C-value of a Givens rotation related to the right null space ifSQRE = 1. literally garbage, she said what she said ๐SโREAL.Scontains garbage ifSQRE = 0, and the S-value of a Givens rotation related to the right null space ifSQRE = 1. same vibe, same warning ๐INFOโINTEGER.= 0: successful exit. we love a win ๐< 0: ifINFO = -i, the i-th argument had an illegal value. one of the arguments did something illegal, we're not gonna talk about it ๐ญ
๐ Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasd8 ๐
subroutine slasd8 (integer ICOMPQ, integer K, real, dimension( * ) D, real,
dimension( * ) Z, real, dimension( * ) VF, real, dimension( * ) VL,
real, dimension( * ) DIFL, real, dimension( lddifr, * ) DIFR, integer
LDDIFR, real, dimension( * ) DSIGMA, real, dimension( * ) WORK, integer
INFO)
SLASD8 finds the square roots of the roots of the secular equation, and stores, for each element in D, the distance to its two nearest poles. Used by sbdsdc. ๐
โจ Purpose โจ
SLASD8 finds the square roots of the roots of the secular equation, as defined by the values in DSIGMA and Z. It makes the appropriate calls to SLASD4, and stores, for each element in D, the distance to its two nearest poles (elements in DSIGMA). It also updates the arrays VF and VL, the first and last components of all the right singular vectors of the original bidiagonal matrix.
SLASD8 is called from SLASD6. the pipeline is piping ๐ซถ
๐ธ Parameters ๐ธ
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in factored form in the calling routine:= 0: Compute singular values only.= 1: Compute singular vectors in factored form as well.
KโINTEGER. The number of terms in the rational function to be solved bySLASD4.K >= 1. so, at least one term, bestie, we don't do zero ๐DโREALarray, dimension( K ). On output,Dcontains the updated singular values. glow-up complete โจZโREALarray, dimension( K ). On entry, the firstKelements of this array contain the components of the deflation-adjusted updating row vector. On exit,Zis updated.VFโREALarray, dimension( K ). On entry,VFcontains information passed throughDBEDE8. On exit,VFcontains the firstKcomponents of the first components of all right singular vectors of the bidiagonal matrix.VLโREALarray, dimension( K ). On entry,VLcontains information passed throughDBEDE8. On exit,VLcontains the firstKcomponents of the last components of all right singular vectors of the bidiagonal matrix.DIFLโREALarray, dimension( K ). On exit,DIFL(I) = D(I) - DSIGMA(I). simple math, iconic behavior ๐DIFRโREALarray, with dimension( LDDIFR, 2 )ifICOMPQ = 1and dimension( K )ifICOMPQ = 0. On exit,DIFR(I,1) = D(I) - DSIGMA(I+1), andDIFR(K,1)is not defined and will not be referenced. Also, ifICOMPQ = 1,DIFR(1:K,2)is an array containing the normalizing factors for the right singular vector matrix. don't touchDIFR(K,1), she's not defined, she's not available, leave her be ๐LDDIFRโINTEGER. The leading dimension ofDIFR, must be at leastK.DSIGMAโREALarray, dimension( K ). On entry, the firstKelements of this array contain the old roots of the deflated updating problem โ these are the poles of the secular equation. On exit, the elements ofDSIGMAmay be very slightly altered in value. tiny lil changes, no biggie.WORKโREALarray, dimension(3*K).INFOโINTEGER.= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. ๐ญ
๐ Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซถ Contributors ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ฆ subroutine slasda ๐ฆ
subroutine slasda (integer ICOMPQ, integer SMLSIZ, integer N, integer SQRE,
real, dimension( * ) D, real, dimension( * ) E, real, dimension( ldu, *
) U, integer LDU, real, dimension( ldu, * ) VT, integer, dimension( * )
K, real, dimension( ldu, * ) DIFL, real, dimension( ldu, * ) DIFR, real,
dimension( ldu, * ) Z, real, dimension( ldu, * ) POLES, integer,
dimension( * ) GIVPTR, integer, dimension( ldgcol, * ) GIVCOL, integer
LDGCOL, integer, dimension( ldgcol, * ) PERM, real, dimension( ldu, * )
GIVNUM, real, dimension( * ) C, real, dimension( * ) S, real, dimension(
* ) WORK, integer, dimension( * ) IWORK, integer INFO)
SLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonal d and off-diagonal e. Used by sbdsdc. she's doing the whole SVD, main character energy fr ๐
โจ Purpose โจ
Using a divide and conquer approach, SLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal N-by-M matrix B with diagonal D and offdiagonal E, where M = N + SQRE. The algorithm computes the singular values in the SVD B = U * S * VT. The orthogonal matrices U and VT are optionally computed in compact form.
A related subroutine, SLASD0, computes the singular values and the singular vectors in explicit form. iykyk ๐
๐ธ Parameters ๐ธ
ICOMPQโINTEGER. Specifies whether singular vectors are to be computed in compact form, as follows:= 0: Compute singular values only.= 1: Compute singular vectors of upper bidiagonal matrix in compact form.
SMLSIZโINTEGER. The maximum size of the subproblems at the bottom of the computation tree. bottom of the tree = the little guys ๐งNโINTEGER. The row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal arrayD.SQREโINTEGER. Specifies the column dimension of the bidiagonal matrix.= 0: The bidiagonal matrix has column dimensionM = N;= 1: The bidiagonal matrix has column dimensionM = N + 1.
DโREALarray, dimension( N ). On entry,Dcontains the main diagonal of the bidiagonal matrix. On exit,D, ifINFO = 0, contains its singular values. she got a whole new identity โจEโREALarray, dimension( M-1 ). Contains the subdiagonal entries of the bidiagonal matrix. On exit,Ehas been destroyed. rip to E, gone but not forgotten ๐UโREALarray, dimension( LDU, SMLSIZ )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,Ucontains the left singular vector matrices of all subproblems at the bottom level.LDUโINTEGER,LDU = > N. The leading dimension of arraysU,VT,DIFL,DIFR,POLES,GIVNUM, andZ. she's the leading dimension for the whole friend group ๐ซถVTโREALarray, dimension( LDU, SMLSIZ+1 )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,VT**Tcontains the right singular vector matrices of all subproblems at the bottom level.KโINTEGERarray, dimension( N )ifICOMPQ = 1and dimension1ifICOMPQ = 0. IfICOMPQ = 1, on exit,K(I)is the dimension of the I-th secular equation on the computation tree.DIFLโREALarray, dimension( LDU, NLVL ), whereNLVL = floor(log_2 (N/SMLSIZ))). yes that's the real formula, count the parentheses, I dare you ๐ญDIFRDIFRโ okay soDIFRis a REAL array, and its dimension is ( LDU, 2 * NLVL ) when ICOMPQ = 1, and ( N ) when ICOMPQ = 0. If ICOMPQ = 1, then on exitDIFL(1:N, I)andDIFR(1:N, 2 * I - 1)record the distances between singular values on the I-th level and singular values on the (I -1)-th level, andDIFR(1:N, 2 * I )contains the normalizing factors for the right singular vector matrix. Need the lore? SeeSLASD8for details. ๐ZโZis a REAL array, dimension ( LDU, NLVL ) if ICOMPQ = 1 and dimension ( N ) if ICOMPQ = 0. The first K elements ofZ(1, I)contain the components of the deflation-adjusted updating row vector for subproblems on the I-th level. โจPOLESโPOLESis a REAL array, dimension ( LDU, 2 * NLVL ) if ICOMPQ = 1, and it is not referenced if ICOMPQ = 0. If ICOMPQ = 1, then on exit,POLES(1, 2*I - 1)andPOLES(1, 2*I)contain the new and old singular values involved in the secular equations on the I-th level.GIVPTRโGIVPTRis an INTEGER array, dimension ( N ) if ICOMPQ = 1, and not referenced if ICOMPQ = 0. If ICOMPQ = 1, then on exit,GIVPTR( I )records the number of Givens rotations performed on the I-th problem on the computation tree. ๐GIVCOLโGIVCOLis an INTEGER array, dimension ( LDGCOL, 2 * NLVL ) if ICOMPQ = 1, and not referenced if ICOMPQ = 0. If ICOMPQ = 1, then on exit, for each I,GIVCOL(1, 2 *I - 1)andGIVCOL(1, 2 *I)record the locations of Givens rotations performed on the I-th level on the computation tree.LDGCOLโLDGCOLis INTEGER, andLDGCOL = > N. It's the leading dimension of the arraysGIVCOLandPERM.PERMโPERMis an INTEGER array, dimension ( LDGCOL, NLVL ) if ICOMPQ = 1, and not referenced if ICOMPQ = 0. If ICOMPQ = 1, then on exit,PERM(1, I)records permutations done on the I-th level of the computation tree. ๐ธGIVNUMโGIVNUMis a REAL array, dimension ( LDU, 2 * NLVL ) if ICOMPQ = 1, and not referenced if ICOMPQ = 0. If ICOMPQ = 1, then on exit, for each I,GIVNUM(1, 2 *I - 1)andGIVNUM(1, 2 *I)record the C- and S-values of Givens rotations performed on the I-th level on the computation tree.CโCis a REAL array, dimension ( N ) if ICOMPQ = 1, and dimension 1 if ICOMPQ = 0. If ICOMPQ = 1 and the I-th subproblem is not square, then on exit,C( I )contains the C-value of a Givens rotation related to the right null space of the I-th subproblem.SโSis a REAL array, dimension ( N ) if ICOMPQ = 1, and dimension 1 if ICOMPQ = 0. If ICOMPQ = 1 and the I-th subproblem is not square, then on exit,S( I )contains the S-value of a Givens rotation related to the right null space of the I-th subproblem.WORKโWORKis a REAL array, dimension (6 * N + (SMLSIZ + 1)*(SMLSIZ + 1)). That's a whole lotta workspace, bestie. ๐ซถIWORKโIWORKis an INTEGER array, dimension (7*N).INFOโINFOis INTEGER, and here's the tea:= 0: successful exit. slay.< 0: ifINFO = -i, the i-th argument had an illegal value. ๐ญ> 0: ifINFO = 1, a singular value did not converge.
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ซถ Contributors: ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasdq ๐
subroutine slasdq (character UPLO, integer SQRE, integer N, integer NCVT,
integer NRU, integer NCC, real, dimension( * ) D, real, dimension( * )
E, real, dimension( ldvt, * ) VT, integer LDVT, real, dimension( ldu, *
) U, integer LDU, real, dimension( ldc, * ) C, integer LDC, real,
dimension( * ) WORK, integer INFO)
SLASDQ computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e. Used by sbdsdc.
โจ Purpose โจ
SLASDQ computes the singular value decomposition (SVD) of a real (upper or lower) bidiagonal matrix with diagonal D and offdiagonal E, accumulating the transformations if desired. Letting B denote the input bidiagonal matrix, the algorithm computes orthogonal matrices Q and P such that B = Q * S * P**T (P**T denotes the transpose of P). The singular values S are overwritten on D. no cap.
The input matrix U is changed to U * Q if desired. The input matrix VT is changed to P**T * VT if desired. The input matrix C is changed to Q**T * C if desired.
See 'Computing Small Singular Values of Bidiagonal Matrices With Guaranteed High Relative Accuracy,' by J. Demmel and W. Kahan, LAPACK Working Note #3, for a detailed description of the algorithm. ๐
โจ Parameters โจ
UPLOโUPLOis CHARACTER*1. On entry,UPLOspecifies whether the input bidiagonal matrix is upper or lower bidiagonal, and whether it is square are not.UPLO = 'U'or'u'โBis upper bidiagonal.UPLO = 'L'or'l'โBis lower bidiagonal.
SQREโSQREis INTEGER.= 0: then the input matrix is N-by-N.= 1: then the input matrix is N-by-(N+1) ifUPLU = 'U'and (N+1)-by-N ifUPLU = 'L'.
The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns.
NโNis INTEGER. On entry,Nspecifies the number of rows and columns in the matrix.Nmust be at least 0.NCVTโNCVTis INTEGER. On entry,NCVTspecifies the number of columns of the matrixVT.NCVTmust be at least 0.NRUโNRUis INTEGER. On entry,NRUspecifies the number of rows of the matrixU.NRUmust be at least 0.NCCโNCCis INTEGER. On entry,NCCspecifies the number of columns of the matrixC.NCCmust be at least 0.DโDis a REAL array, dimension (N). On entry,Dcontains the diagonal entries of the bidiagonal matrix whose SVD is desired. On normal exit,Dcontains the singular values in ascending order. ๐EโEis a REAL array. Its dimension is (N-1) ifSQRE = 0and N ifSQRE = 1. On entry, the entries ofEcontain the offdiagonal entries of the bidiagonal matrix whose SVD is desired. On normal exit,Ewill contain 0. If the algorithm does not converge,DandEwill contain the diagonal and superdiagonal entries of a bidiagonal matrix orthogonally equivalent to the one given as input. ๐VTโVTis a REAL array, dimension (LDVT, NCVT). On entry, it contains a matrix which on exit has been premultiplied byP**T, dimension N-by-NCVT ifSQRE = 0and (N+1)-by-NCVT ifSQRE = 1(not referenced ifNCVT=0).LDVTโLDVTis INTEGER. On entry,LDVTspecifies the leading dimension ofVTas declared in the calling (sub) program.LDVTmust be at least 1. IfNCVTis nonzero,LDVTmust also be at leastN.UโUis a REAL array, dimension (LDU, N). On entry, it contains a matrix which on exit has been postmultiplied byQ, dimension NRU-by-N ifSQRE = 0and NRU-by-(N+1) ifSQRE = 1(not referenced ifNRU=0).LDUโLDUis INTEGER. On entry,LDUspecifies the leading dimension ofUas declared in the calling (sub) program.LDUmust be at leastmax( 1, NRU ).CโCis a REAL array, dimension (LDC, NCC). On entry, it contains an N-by-NCC matrix which on exit has been premultiplied byQ**T, dimension N-by-NCC ifSQRE = 0and (N+1)-by-NCC ifSQRE = 1(not referenced ifNCC=0).LDCโLDCis INTEGER. On entry,LDCspecifies the leading dimension ofCas declared in the calling (sub) program.LDCmust be at least 1. IfNCCis nonzero,LDCmust also be at leastN.WORKโWORKis a REAL array, dimension (4*N). Workspace. Only referenced if one ofNCVT,NRU, orNCCis nonzero, and ifNis at least 2.INFOโINFOis INTEGER. On exit, a value of 0 indicates a successful exit. IfINFO < 0, argument number-INFOis illegal. IfINFO > 0, the algorithm did not converge, andINFOspecifies how many superdiagonals did not converge. ๐
๐ Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ซถ Contributors: ๐ซถ
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slasdt ๐
subroutine slasdt (integer N, integer LVL, integer ND, integer, dimension( *
) INODE, integer, dimension( * ) NDIML, integer, dimension( * ) NDIMR,
integer MSUB)
SLASDT</purk> creates a tree of subproblems for bidiagonal divide and conquer. Used by sbdsdc. ๐ณ
โจ Purpose โจ
SLASDT creates a tree of subproblems for bidiagonal divide and conquer. That's it, that's the whole job, and it ate. ๐
โจ Parameters โจ
NโNis INTEGER. On entry, the number of diagonal elements of the bidiagonal matrix.LVLโLVLis INTEGER. On exit, the number of levels on the computation tree.NDโNDis INTEGER. On exit, the number of nodes on the tree.INODEโINODEis an INTEGER array, dimension ( N ). On exit, centers of subproblems. ๐ฏNDIMLโNDIMLis an INTEGER array, dimension ( N ). On exit, row dimensions of left children.NDIMRโNDIMRis an INTEGER array, dimension ( N ). On exit, row dimensions of right children.MSUBโMSUBโ isINTEGER. On entry, this is the maximum row dimension that each subproblem at the bottom of the tree can be of. ๐ณ bottom-of-the-tree subproblems stay smol, that is the entire point of a tree
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ซ Contributors
- Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA
๐ subroutine slaset (character UPLO, integer M, integer N, real ALPHA, real BETA, real, dimension( lda, * ) A, integer LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values. it's giving "paint by numbers, but make it linear algebra" ๐จ
๐ Purpose
Bestie, this one is literally what it says on the tin: SLASET takes an m-by-n matrix A and fills it all in โ BETA down the diagonal, ALPHA everywhere off the diagonal. Simple. Iconic. Done. โจ
๐งพ Parameters
UPLOโCHARACTER*1. TellsSLASETwhich chunk ofAit is allowed to touch:= 'U': the upper triangular part gets set; the strictly lower triangular part ofAis not changed.= 'L': the lower triangular part gets set; the strictly upper triangular part ofAis not changed.- Otherwise: all of the matrix
Ais set, no survivors ๐
MโINTEGER. The number of rows of the matrixA. Constraint:M >= 0.NโINTEGER. The number of columns of the matrixA. Constraint:N >= 0.ALPHAโREAL. The constant that the offdiagonal elements are to be set to.BETAโREAL. The constant that the diagonal elements are to be set to.AโREALarray, dimension(LDA,N). On exit, the leading m-by-n submatrix ofAis set as follows:
if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n,
if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n,
otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j,
and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).
LDAโINTEGER. The leading dimension of the arrayA. Constraint:LDA >= max(1,M).
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ subroutine slasr (character SIDE, character PIVOT, character DIRECT, integer M, integer N, real, dimension( * ) C, real, dimension( * ) S, real, dimension( lda, * ) A, integer LDA)
SLASR applies a sequence of plane rotations to a general rectangular matrix. rotations? in MY matrix? it is more likely than you think ๐
๐ Purpose
SLASR applies a sequence of plane rotations to a real matrix A, from either the left or the right. ๐ซถ
When SIDE = 'L', the transformation takes the form
A := P*A
and when SIDE = 'R', the transformation takes the form
A := A*P**T
where P is an orthogonal matrix consisting of a sequence of z plane rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R', and P**T is the transpose of P.
When DIRECT = 'F' (Forward sequence), then
P = P(z-1) * ... * P(2) * P(1)
and when DIRECT = 'B' (Backward sequence), then
P = P(1) * P(2) * ... * P(z-1)
where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
R(k) = ( c(k) s(k) )
= ( -s(k) c(k) ).
When PIVOT = 'V' (Variable pivot), the rotation is performed for the plane (k,k+1), i.e., P(k) has the form
P(k) = ( 1 )
( ... )
( 1 )
( c(k) s(k) )
( -s(k) c(k) )
( 1 )
( ... )
( 1 )
where R(k) appears as a rank-2 modification to the identity matrix in rows and columns k and k+1.
When PIVOT = 'T' (Top pivot), the rotation is performed for the plane (1,k+1), so P(k) has the form
P(k) = ( c(k) s(k) )
( 1 )
( ... )
( 1 )
( -s(k) c(k) )
( 1 )
( ... )
( 1 )
where R(k) appears in rows and columns 1 and k+1.
Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is performed for the plane (k,z), giving P(k) the form
P(k) = ( 1 )
( ... )
( 1 )
( c(k) s(k) )
( 1 )
( ... )
( 1 )
( -s(k) c(k) )
where R(k) appears in rows and columns k and z. And the best part? The rotations are performed without ever forming P(k) explicitly. we love an implicit flex, no cap ๐
๐งพ Parameters
SIDEโCHARACTER*1. Specifies whether the plane rotation matrixPis applied toAon the left or the right.= 'L': Left, computeA := P*A= 'R': Right, computeA:= A*P**T
PIVOTโCHARACTER*1. Specifies the plane for whichP(k)is a plane rotation matrix.= 'V': Variable pivot, the plane(k,k+1)= 'T': Top pivot, the plane(1,k+1)= 'B': Bottom pivot, the plane(k,z)
DIRECTโCHARACTER*1. Specifies whetherPis a forward or backward sequence of plane rotations.MโINTEGER. The number of rows of the matrixA. Ifm <= 1, an immediate return is effected. blink and it is over bestieNโINTEGER. The number of columns of the matrixA. Ifn <= 1, an immediate return is effected.CโREALarray, dimension(M-1)ifSIDE = 'L',(N-1)ifSIDE = 'R'. The cosinesc(k)of the plane rotations.SโREALarray, dimension(M-1)ifSIDE = 'L',(N-1)ifSIDE = 'R'. The siness(k)of the plane rotations. The 2-by-2 plane rotation part of the matrixP(k),R(k), has the form
R(k) = ( c(k) s(k) )
( -s(k) c(k) ).
AโREALarray, dimension(LDA,N). The M-by-N matrixA. On exit,Ais overwritten byP*AifSIDE = 'R'or byA*P**TifSIDE = 'L'.LDAโINTEGER. The leading dimension of the arrayA. Constraint:LDA >= max(1,M).
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ subroutine slasv2 (real F, real G, real H, real SSMIN, real SSMAX, real SNR, real CSR, real SNL, real CSL)
SLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix. tiny matrix, absolutely massive glow-up โจ
๐ Purpose
SLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix
[ F G ]
[ 0 H ].
On return, abs(SSMAX) is the larger singular value, abs(SSMIN) is the smaller singular value, and (CSL,SNL) and (CSR,SNR) are the left and right singular vectors for abs(SSMAX), giving the decomposition
[ CSL SNL ] [ F G ] [ CSR -SNR ] = [ SSMAX 0 ]
[-SNL CSL ] [ 0 H ] [ SNR CSR ] [ 0 SSMIN ].
๐งพ Parameters
FโREAL. The(1,1)element of the 2-by-2 matrix.GโREAL. The(1,2)element of the 2-by-2 matrix.HโREAL. The(2,2)element of the 2-by-2 matrix.SSMINโREAL.abs(SSMIN)is the smaller singular value.SSMAXโREAL.abs(SSMAX)is the larger singular value.SNLโREAL. that is it. that is the whole description. living its best undocumented life ๐CSLโREAL. The vector(CSL, SNL)is a unit left singular vector for the singular valueabs(SSMAX).SNRโREAL. also just vibing here with zero description, we respect itCSRโREAL. The vector(CSR, SNR)is a unit right singular vector for the singular valueabs(SSMAX).
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Further Details
- Any input parameter may be aliased with any output parameter. yes, really, go off
- Barring over/underflow and assuming a guard digit in subtraction, all output quantities are correct to within a few units in the last place (ulps).
- In IEEE arithmetic, the code works correctly if one matrix element is infinite. ๐
- Overflow will not occur unless the largest singular value itself overflows or is within a few ulps of overflow. (On machines with partial overflow, like the Cray, overflow may occur if the largest singular value is within a factor of 2 of overflow.)
- Underflow is harmless if underflow is gradual. Otherwise, results may correspond to a matrix modified by perturbations of size near the underflow threshold.
๐ฅ subroutine xerbla (character*(*) SRNAME, integer INFO)
XERBLA
๐ Purpose
XERBLA is an error handler for the LAPACK routines. it is the one who knocks ๐
It is called by an LAPACK routine if an input parameter has an invalid value. A message is printed and execution stops. Like, actually stops. No vibe check, no second chance.
Installers may consider modifying the STOP statement in order to call system-specific exception-handling facilities.
๐งพ Parameters
SRNAMEโ okay bestie hold on, this one's description is literally the very next thing and it got cut off right here, stay tuned ๐SRNAMEโ bestie, this one's aCHARACTER(*)type. It's literally the name of the routine that calledXERBLA. ๐INFOโ this cutie is anINTEGER. It holds the position of the invalid parameter in the parameter list of the calling routine. ๐
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine xerbla_array โจ
subroutine xerbla_array (character(1), dimension(srname_len) SRNAME_ARRAY,
integer SRNAME_LEN, integer INFO)
XERBLA_ARRAY ๐ซถ
Purpose ๐ธ
Okay so XERBLA_ARRAY is here to help other languages call XERBLA, which is the LAPACK and BLAS error handler. Instead of taking a Fortran string argument as the function's name, XERBLA_ARRAY takes an array of single characters along with the array's length. Then it copies up to 32 characters of that array into a Fortran string and passes that to XERBLA. If you call it with a non-positive SRNAME_LEN, XERBLA_ARRAY will call XERBLA with a string of all blank characters. No cap. ๐ฏ
Say some macro or other device makes XERBLA_ARRAY available to C99 by a name lapack_xerbla and with a common Fortran calling convention. Then a C99 program could invoke XERBLA via:
{
int flen = strlen(__func__);
lapack_xerbla(__func__, &flen, &info);
}
Providing XERBLA_ARRAY is not necessary for intercepting LAPACK errors. XERBLA_ARRAY calls XERBLA. Periodt. ๐
Parameters ๐
SRNAME_ARRAYโSRNAME_ARRAY is CHARACTER(1) array, dimension (SRNAME_LEN). It's the name of the routine which calledXERBLA_ARRAY. ๐SRNAME_LENโSRNAME_LEN is INTEGER. The length of the name inSRNAME_ARRAY. ๐INFOโINFO is INTEGER. The position of the invalid parameter in the parameter list of the calling routine. ๐
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Author ๐
Generated automatically by Doxygen for LAPACK from the source code.
This lil page is from LAPACK version 3.11.0, dated Sun Nov 27 2022, and it's filed under OTHERauxiliary(3). Stay iconic, bestie! ๐โจ๐
๐ฆ where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms