OTHERauxiliary(3)
๐ธ NAME ๐ธ
okay so bestie, this is OTHERauxiliary(3) from LAPACK, and it's literally the page for Other Auxiliary Routines. no cap, that's the name. it's giving "the extras that still ate." ๐
โจ
โจ SYNOPSIS โจ
๐ Modules ๐
doublerealcomplexcomplex16
โจ Functions โจ
okay bestie, buckle UP ๐ this is the full roster of little helper routines โ the supporting cast, the background dancers, the ones doing the actual math while the main characters get all the credit. every single one of them, no skipping, periodt.
subroutine dcombssq (V1, V2)โ DCOMBSSQ is out here adding two scaled sum of squares quantities together. that's the job. it does the job. slay ๐logical function disnan (DIN)โ DISNAN runs a vibe check on its input for NaN. is it a number? is it a NaN? it will let you know ๐งsubroutine dlabad (SMALL, LARGE)โ DLABAD. and that's it. that's the whole description. no notes, iconic minimalism ๐subroutine dlacpy (UPLO, M, N, A, LDA, B, LDB)โ DLACPY copies all of a two-dimensional array, or just part of it, into another one. move it, copy it, love it ๐subroutine dlae2 (A, B, C, RT1, RT2)โ DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. tiny matrix, big brain 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 how many eigenvalues of a real symmetric tridiagonal matrix are less than or equal to a given value, and handles the other tasks that the routinesstebzneeds done. it's the whole support system fr fr ๐ซถsubroutine dlaev2 (A, B, C, RT1, RT2, CS1, SN1)โ DLAEV2 computes the eigenvalues and the eigenvectors of a 2-by-2 symmetric/Hermitian matrix. double the work, double the slay ๐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. team effort, bestie ๐คlogical function dlaisnan (DIN1, DIN2)โ DLAISNAN tests its input for NaN by comparing two arguments for inequality. sneaky little NaN detector ๐ต๏ธinteger function dlaneg (N, D, LLD, SIGMA, PIVMIN, R)โ DLANEG computes the Sturm count. just. the Sturm count. ๐double precision function dlanst (NORM, N, D, E)โ DLANST hands you 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 โจdouble precision function dlapy2 (X, Y)โ DLAPY2 returnssqrt(x2+y2). pythagoras said what he said ๐double precision function dlapy3 (X, Y, Z)โ DLAPY3 returnssqrt(x2+y2+z2). pythagoras but make it three-dimensional ๐ฆsubroutine dlarnv (IDIST, ISEED, N, X)โ DLARNV returns a vector of random numbers from a uniform or normal distribution. chaos, but make it mathematically rigorous ๐ฒsubroutine dlarra (N, D, E, E2, SPLTOL, TNRM, NSPLIT, ISPLIT, INFO)โ DLARRA computes the splitting points with the specified threshold. chopping it up, respectfully โ๏ธ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 precision ๐subroutine dlarrc (JOBT, N, VL, VU, D, E, PIVMIN, EIGCNT, LCNT, RCNT, INFO)โ DLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. counting, but like, mathematically ๐ข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 work in that sentence and honestly? relatable ๐ญ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 takes the tridiagonal matrix T, sets the small off-diagonal elements to zero, and then for each unreduced block Ti it finds base representations and eigenvalues. multi-step icon behavior ๐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. giving that 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 arc for your eigenvalues โจ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. it's focused. it's got main character energy ๐subroutine dlarrr (N, D, E, INFO)โ DLARRR performs tests to decide whether the symmetric tridiagonal matrix T is worth the expensive computations that guarantee high relative accuracy in the eigenvalues. it's the friend who asks "is this really worth it" before you spend money ๐
subroutine dlartgp (F, G, CS, SN, R)โ DLARTGP generates a plane rotation so that the diagonal is nonnegative. rotate, bestie ๐ซsubroutine dlaruv (ISEED, N, X)โ DLARUV returns a vector of n random real numbers from a uniform distribution. more randomness, now with a lowercase n ๐subroutine dlas2 (F, G, H, SSMIN, SSMAX)โ DLAS2 computes singular values of a 2-by-2 triangular matrix. tiny triangle, huge significance โจsubroutine dlascl (TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)โ DLASCL multiplies a general rectangular matrix by a real scalar defined ascto/cfrom. math said "scale it" and it scaled it ๐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. ๐ฆ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. ๐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. friendship bracelet behavior ๐ค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. that's a lot of steps and it ate every single one ๐ฅ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. ๐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. the little sibling of DLASD4 and it's thriving ๐ธ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. ๐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. โจ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. ๐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 full SVD, the whole package, no half measures ๐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. ๐ฆsubroutine dlasdt (N, LVL, ND, INODE, NDIML, NDIMR, MSUB)โ DLASDT creates a tree of subproblems for bidiagonal divide and conquer. used bysbdsdc. it's giving organizational skills ๐ณ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 stage, literally ๐subroutine dlasr (SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA)โ DLASR applies a sequence of plane rotations to a general rectangular matrix. spin it, bestie ๐ซsubroutine dlasv2 (F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL)โ DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix. small triangle, full SVD, obsessed โจinteger function ieeeck (ISPEC, ZERO, ONE)โ IEEECK. that's all we got. mysterious queen, no further comment ๐integer function iladlc (M, N, A, LDA)โ ILADLC scans a matrix for its last non-zero column. finding the end of the line, respectfully ๐integer function iladlr (M, N, A, LDA)โ ILADLR scans a matrix for its last non-zero row. same energy, other axis ๐ซถinteger function ilaenv (ISPEC, NAME, OPTS, N1, N2, N3, N4)โ ILAENV. no description, just vibes and seven arguments ๐integer function ilaenv2stage (ISPEC, NAME, OPTS, N1, N2, N3, N4)โ ILAENV2STAGE. the sequel. same signature, new era ๐ฌinteger function iparmq (ISPEC, NAME, OPTS, N, ILO, IHI, LWORK)โ IPARMQ. no notes, only mystery and parameters ๐logical function lsamen (N, CA, CB)โ LSAMEN. that's the whole entry. minimalism is a lifestyle โจsubroutine scombssq (V1, V2)โ SCOMBSSQ adds two scaled sum of squares quantities. same job as its double-precision twin, different letter ๐logical function sisnan (SIN)โ SISNAN tests input for NaN. ๐งsubroutine slabad (SMALL, LARGE)โ SLABAD. nothing more to say and honestly, respect ๐subroutine slacpy (UPLO, M, N, A, LDA, B, LDB)โ SLACPY copies all or part of one two-dimensional array to another. ๐subroutine slae2 (A, B, C, RT1, RT2)โ SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix. ๐ธ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 the other tasks required by the routinesstebz. ๐ฅsubroutine slaev2 (A, B, C, RT1, RT2, CS1, SN1)โ SLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. ๐subroutine slag2d (M, N, SA, LDSA, A, LDA, INFO)โ SLAG2D converts a single precision matrix to a double precision matrix. glow-up, but numerically ๐ฆ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. ๐ซถlogical function slaisnan (SIN1, SIN2)โ SLAISNAN tests input for NaN by comparing two arguments for inequality. ๐ต๏ธinteger function slaneg (N, D, LLD, SIGMA, PIVMIN, R)โ SLANEG computes the 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. โจreal function slapy2 (X, Y)โ SLAPY2 returnssqrt(x2+y2). ๐real function slapy3 (X, Y, Z)โ SLAPY3 returnssqrt(x2+y2+z2). ๐ซsubroutine slarnv (IDIST, ISEED, N, X)โ SLARNV returns a vector of random numbers from a uniform or normal distribution. ๐ฒsubroutine slarra (N, D, E, E2, SPLTOL, TNRM, NSPLIT, ISPLIT, INFO)โ SLARRA computes the splitting points with the specified threshold. โ๏ธsubroutine slarrb (N, D, LLD, IFIRST, ILAST, RTOL1, RTOL2, OFFSET, W, WGAP, WERR, WORK, IWORK, PIVMIN, SPDIAM, TWIST, INFO)โ SLARRBSLARRBโ provides limited bisection to locate eigenvalues for more accuracy. ๐ no cap, she's just out here refining eigenvalues.slarrcโsubroutine slarrc (JOBT, N, VL, VU, D, E, PIVMIN, EIGCNT, LCNT, RCNT, INFO)โ SLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. ๐slarrdโ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. โจslarreโ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 matrix T, sets small off-diagonal elements to zero and for each unreduced block Ti, finds base representations and eigenvalues. ๐slarrfโ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. ๐ฆslarrjโ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 matrix T. ๐ธslarrkโsubroutine slarrk (N, IW, GL, GU, D, E2, PIVMIN, RELTOL, W, WERR, INFO)โ SLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. ๐slarrrโsubroutine slarrr (N, D, E, INFO)โ SLARRR performs tests to decide whether the symmetric tridiagonal matrix T warrants expensive computations which guarantee high relative accuracy in the eigenvalues. ๐ฅslartgpโsubroutine slartgp (F, G, CS, SN, R)โ SLARTGP generates a plane rotation so that the diagonal is nonnegative. ๐ซslaruvโsubroutine slaruv (ISEED, N, X)โ SLARUV returns a vector of n random real numbers from a uniform distribution. ๐ฒslas2โsubroutine slas2 (F, G, H, SSMIN, SSMAX)โ SLAS2 computes singular values of a 2-by-2 triangular matrix. ๐งslasclโsubroutine slascl (TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)โ SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom. ๐slasd0โ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 matrix B with diagonal d and off-diagonal e. Used by sbdsdc. ๐slasd1โsubroutine slasd1 (NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO)โ SLASD1 computes the SVD of an upper bidiagonal matrix B of the specified size. Used by sbdsdc. โญslasd2โ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 by sbdsdc. ๐slasd3โ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 in D and Z, and then updates the singular vectors by matrix multiplication. Used by sbdsdc. ๐slasd4โ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 by sbdsdc. โจslasd5โ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 by sbdsdc. ๐ฆslasd6โ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 by sbdsdc. ๐ธslasd7โ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 by sbdsdc. ๐slasd8โ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 in D, the distance to its two nearest poles. Used by sbdsdc. ๐slasdaโ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 diagonal d and off-diagonal e. Used by sbdsdc. ๐ฅslasdqโ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 diagonal d and off-diagonal e. Used by sbdsdc. ๐ซslasdtโsubroutine slasdt (N, LVL, ND, INODE, NDIML, NDIMR, MSUB)โ SLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used by sbdsdc. ๐งslasetโ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. ๐slasrโsubroutine slasr (SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA)โ SLASR applies a sequence of plane rotations to a general rectangular matrix. ๐slasv2โsubroutine slasv2 (F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL)โ SLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix. โญxerblaโsubroutine xerbla (SRNAME, INFO)โ XERBLA. ๐xerbla_arrayโsubroutine xerbla_array (SRNAME_ARRAY, SRNAME_LEN, INFO)โ XERBLA_ARRAY. ๐
โจ Detailed Description โจ
This is the group of Other Auxiliary routines. ๐
๐ธ Function Documentation ๐ธ
๐ subroutine dcombssq (double precision, dimension( 2 ) V1, double precision, dimension( 2 ) V2)
DCOMBSSQ adds two scaled sum of squares quantities. ๐
Purpose:
DCOMBSSQ adds two scaled sum of squares quantities, V1 := V1 + V2. That is,
V1_scale**2 * V1_sumsq := V1_scale**2 * V1_sumsq
+ V2_scale**2 * V2_sumsq
Parameters
V1โV1isDOUBLE PRECISIONarray, dimension(2). The first scaled sum.V1(1) = V1_scale,V1(2) = V1_sumsq. โจV2โV2isDOUBLE PRECISIONarray, dimension(2). The second scaled sum.V2(1) = V2_scale,V2(2) = V2_sumsq. ๐
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ logical function disnan (double precision, intent(in) DIN)
DISNAN tests input for NaN. ๐
Purpose:
DISNAN returns .TRUE. if its argument is NaN, and .FALSE. otherwise. To be replaced by the Fortran 2003 intrinsic in the future. ๐ฎ
Parameters
DINโDINisDOUBLE 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. ๐ญ
Parameters
SMALLโSMALLisDOUBLE PRECISION. On entry, the underflow threshold as computed by DLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, the square root ofSMALL, otherwise unchanged. ๐ธLARGEโLARGEisDOUBLE 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. ๐ซถ
Purpose:
DLACPY copies all or part of a two-dimensional matrix A to another matrix B. โจ
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โAisDOUBLE 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. ๐ฆLDAโLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M). ๐BโBisDOUBLE PRECISIONarray, 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 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. ๐ซ
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
AโAisDOUBLE PRECISION. The (1,1) element of the 2-by-2 matrix. ๐BโBisDOUBLE PRECISION. it's the(1,2)and(2,1)elements of the 2-by-2 matrix. ๐CโCisDOUBLE PRECISION. it's the(2,2)element of the 2-by-2 matrix. ๐RT1โRT1isDOUBLE PRECISION. it's the eigenvalue of larger absolute value. ๐RT2โRT2isDOUBLE PRECISION. it's 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 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)
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 routine sstebz. no cap, it's giving very specific eigenvalue energy. ๐ฆ
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 by IJOB=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 eigenvalues NAB(j,1)+1,...,NAB(j,2), where 1 <= j <= MOUT. ๐ธ
IJOB=3: It performs a binary search in each input interval (AB(j,1),AB(j,2)] for a point w(j) such that N(w(j))=NVAL(j), and uses C(j) as the starting point of the search. If such a w(j) is found, then on output AB(j,1)=AB(j,2)=w. If no such w(j) is found, then on output (AB(j,1),AB(j,2)] will be a small interval containing the point where N(w) jumps through NVAL(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 intervalionly eigenvaluesNAB(i,1)+1,...,NAB(i,2)will be considered. Usually,NAB(i,j)=N(AB(i,j)), from a previous call toDLAEBZwithIJOB=1. On output,NAB(i,j)will containmax(na(k),min(nb(k),N(AB(i,j)))), wherekis the index of the input interval that the output interval(AB(j,1),AB(j,2)]came from, andna(k)andnb(k)are the the input values ofNAB(k,1)andNAB(k,2). IfIJOB=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) beforeDLAEBZis 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,
DLAEBZshould have one or more initial intervals set up inAB, andDLAEBZshould be called withIJOB=1. This sets upNAB, 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 intervaliare desired,NAB(i,1)can be increased orNAB(i,2)decreased. For example, setNAB(i,1)=NAB(i,2)-1to get the largest eigenvalue.DLAEBZis then called withIJOB=2andMMAXno smaller than the value ofMOUTreturned by the call withIJOB=1. After this (IJOB=2) call, eigenvaluesNAB(i,1)+1throughNAB(i,2)are approximatelyAB(i,1)(orAB(i,2)) to the tolerance specified byABSTOLandRELTOL. ๐ - (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)
DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. bestie this one is TINY and it's giving little matrix energy โจ
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
AAisDOUBLE PRECISIONThe(1,1)element of the 2-by-2 matrix. ๐BBisDOUBLE PRECISIONThe(1,2)element and the conjugate of the(2,1)element of the 2-by-2 matrix.CCisDOUBLE PRECISIONThe(2,2)element of the 2-by-2 matrix. ๐RT1RT1isDOUBLE PRECISIONThe eigenvalue of larger absolute value.RT2RT2isDOUBLE PRECISIONThe eigenvalue of smaller absolute value.CS1CS1isDOUBLE PRECISIONSN1SN1isDOUBLE PRECISIONThe 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:
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. ๐ญ
CS1 and SN1 are accurate to a few ulps barring over/underflow.
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 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. slay, it's the follow-up act ๐ค
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
JOBJOBisINTEGERSpecifies 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. ๐ฆ
NNisINTEGERThe order of the matrixT.AAisDOUBLE PRECISION array, dimension (N)On entry,Amust contain the diagonal elements ofUas returned fromDLAGTF.BBisDOUBLE PRECISION array, dimension (N-1)On entry,Bmust contain the first super-diagonal elements ofUas returned fromDLAGTF.CCisDOUBLE PRECISION array, dimension (N-1)On entry,Cmust contain the sub-diagonal elements ofLas returned fromDLAGTF.DDisDOUBLE PRECISION array, dimension (N-2)On entry,Dmust contain the second super-diagonal elements ofUas returned fromDLAGTF.ININisINTEGER array, dimension (N)On entry,INmust contain details of the matrixPas returned fromDLAGTF. ๐YYisDOUBLE PRECISION array, dimension (N)On entry, the right hand side vectory. On exit,Yis overwritten by the solution vectorx. periodt.TOLTOLisDOUBLE PRECISIONOn 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, TOL is changed as described above, only if TOL is non-positive on entry. Otherwise TOL is unchanged.
INFOINFOisINTEGER= 0: successful exit< 0: ifINFO = -i, thei-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. ๐ญ
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. not the glow-up anyone asked for but here we are ๐
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. ๐ฅ
Parameters
DIN1DIN1isDOUBLE PRECISIONDIN2DIN2isDOUBLE PRECISIONTwo 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, iconic job ๐
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.)
Parameters
N
okay bestie we're back in it, mid-parameter-list and thriving ๐ here's the rest of the args for the function we were just doing:
Nโ INTEGER. The order of the matrix. slay, that's it, that's the whole job.Dโ DOUBLE PRECISION array, dimension (N). TheNdiagonal elements of the diagonal matrixD. the main characters of the diagonal, honestly.LLDโ DOUBLE PRECISION array, dimension (N-1). The(N-1)elementsL(i)*L(i)*D(i). notL(i)*D(i), notL(i), it's the whole squared-and-scaled situation, no cap.SIGMAโ DOUBLE PRECISION. Shift amount inT - sigma I = L D L^T. the lil nudge that shifts everything, iconic.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. twisted factorization?? yes and it ate, fr fr.
๐ธ 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
๐ dlanst โ the norm queen
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.
Purpose:
DLANST 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:
DLANST gives you:
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 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. ๐ญ it's giving "technically a value but not technically a norm," we move.
Parameters:
NORMโ CHARACTER*1. Specifies the value to be returned inDLANSTas described above. pick your fighter, bestie.Nโ INTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANSTis set to zero. โจDโ DOUBLE PRECISION array, dimension (N). The diagonal elements ofA.Eโ DOUBLE PRECISION array, 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.
๐ dlapy2 โ pythagoras but make it safe
double precision function dlapy2 (double precision X, double precision Y)
DLAPY2 returns sqrt(x2+y2). yes, the whole entire point is the hypotenuse. ๐
Purpose:
DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary overflow and unnecessary underflow. it's the cautious queen of the diagonal โ no drama, no overflow, no underflow, just vibes and accuracy. ๐
Parameters:
Xโ DOUBLE PRECISION.Yโ DOUBLE PRECISION.XandYspecify the valuesxandy.
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ dlapy3 โ pythagoras but in 3D, main character energy
double precision function dlapy3 (double precision X, double precision Y,
double precision Z)
DLAPY3 returns sqrt(x2+y2+z2). three coordinates, one iconic diagonal. ๐ฅ
Purpose:
DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause unnecessary overflow and unnecessary underflow. same energy as dlapy2 but she brought a friend. ๐ซถ
Parameters:
Xโ DOUBLE PRECISION.Yโ DOUBLE PRECISION.Zโ DOUBLE PRECISION.X,YandZspecify the valuesx,yandz.
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โจ dlarnv โ the random number generator, no cap
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. it's giving chaos, but make it deterministic. ๐ฒ
Purpose:
DLARNV returns a vector of n random real numbers from a uniform or normal distribution.
Parameters:
IDISTโ INTEGER. Specifies the distribution of the random numbers:= 1: uniform(0,1)= 2: uniform(-1,1)= 3: normal(0,1)
choose your fate, bestie. ๐
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 the seed changes on the way out, that's the whole point, iykyk.
bestie the rules here are real: elements0โ4095, andISEED(4)has to be odd. don't skip that, it's not a suggestion. ๐
Nโ INTEGER. The number of random numbers to be generated.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 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. โจ vectorisable code + Box-Muller = ate, periodt.
๐ง dlarra โ she finds the splitting points
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. tiny numbers get yeeted to zero, respectfully. ๐
Parameters:
Nโ INTEGER. The order of the matrix.N > 0. (note: strictly greater, no zero allowed here bestie)Dโ DOUBLE PRECISION array, dimension (N). On entry, 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)need not be set. On exit, the entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, are set to zero, the other entries ofEare untouched. the untouched ones stay untouched, we don't do unnecessary edits here. ๐E2โ DOUBLE PRECISION array, 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. ๐ฅ squared, not the raw values โ read that twice.SPLTOLโ DOUBLE 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
the sign literally picks the strategy, it's giving "your vibe check is your algorithm." โญ
TNRMโ DOUBLE PRECISION. The norm of the matrix.NSPLITโ INTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITโ INTEGER array, 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 a whole seating chart for your matrix, iconic. ๐INFOโ INTEGER.= 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
๐ dlarrb โ limited bisection, maximum accuracy
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. ๐ she's not doing the whole thing, she's just refining. limited bisection, unlimited slay.
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. ๐ซถ mid-points and semi-widths, that's the whole storage scheme, no cap.
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).IFIRSTโ INTEGER. The index of the first eigenvalue to be computed.ILASTโ INTEGER. The index of the last eigenvalue to be computed.RTOL1โ DOUBLE PRECISION.RTOL2โ DOUBLE 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. that's the convergence test, memorize it or perish. ๐OFFSETโ INTEGER. Offset for the arraysW,WGAPandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are to be used.WWโDOUBLE PRECISIONarray, dimension(N). On the way in,W( IFIRST-OFFSET )throughW( ILAST-OFFSET )are your best guesses at the eigenvalues ofL D L^T, indexedIFIRSTthroughILAST. On the way out? bestie those estimates are โจrefinedโจ.WGAPโDOUBLE PRECISIONarray, dimension(N-1). On input, the (estimated) gaps between consecutive eigenvalues ofL D L^T, likeWGAP(I-OFFSET)is the gap between eigenvaluesIandI+1. Heads up tho: ifIFIRST = ILASTthenWGAP(IFIRST-OFFSET)must be set toZERO. On output, these gaps get refined too. ๐WERRโDOUBLE 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. slay.WORKโDOUBLE PRECISIONarray, dimension(2*N). Workspace, aka the lil scratch pad ๐.IWORKโINTEGERarray, dimension(2*N). Workspace again, integer flavored.PIVMINโDOUBLE PRECISION. The minimum pivot in the Sturm sequence. iconic little number.SPDIAMโDOUBLE PRECISION. The spectral diameter of the matrix. ๐TWISTโINTEGER. The twist index for the twisted factorization that's 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โINTEGER. Error flag. that's it that's the whole job ๐ซถ
๐ 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. no cap, that's the whole vibe check ๐
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โCHARACTER*1= 'T': Compute Sturm count for matrixT.= 'L': Compute Sturm count for matrixL D L^T.
NโINTEGER. The order of the matrix.N > 0.VLโDOUBLE PRECISION. The lower bound for the eigenvalues.VUโDOUBLE PRECISION. The upper bound for the eigenvalues.DโDOUBLE PRECISIONarray, dimension(N).JOBT = 'T': TheNdiagonal elements of the tridiagonal matrixT.JOBT = 'L': TheNdiagonal elements of the diagonal matrixD.
EโDOUBLE PRECISIONarray, dimension(N).JOBT = 'T': TheN-1offdiagonal elements of the matrixT.JOBT = 'L': TheN-1offdiagonal elements of the matrixL.
PIVMINโDOUBLE PRECISION. The minimum pivot in the Sturm sequence forT.EIGCNTโINTEGER. The number of eigenvalues of the symmetric tridiagonal matrixTthat are in the interval(VL,VU].LCNTโINTEGER.RCNTโINTEGER. The left and right negcounts of the interval.INFOโINTEGER.
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. ๐
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โCHARACTER*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โCHARACTER*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โINTEGER. The order of the tridiagonal matrixT.N >= 0.VLโDOUBLE 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โDOUBLE 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โINTEGER. 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โINTEGER. 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โDOUBLE PRECISIONarray, dimension(2*N). TheNGerschgorin intervals (thei-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i))).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.DโDOUBLE PRECISIONarray, dimension(N). Thendiagonal elements of the tridiagonal matrixT.EโDOUBLE PRECISIONarray, dimension(N-1). The(n-1)off-diagonal elements of the tridiagonal matrixT.E2โDOUBLE PRECISIONarray, 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.NSPLITโINTEGER. The number of diagonal blocks in the matrixT.1 <= NSPLIT <= N.ISPLITโINTEGERarray, 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โINTEGER. The actual number of eigenvalues found.0 <= M <= N. (See also the description ofINFO=2,3.)W
W ๐
W is DOUBLE PRECISION array, dimension (N).
On exit, the first M elements of W will contain the eigenvalue approximations. DLARRD computes an interval I_j = (a_j, b_j] that includes eigenvalue j. The eigenvalue approximation is given as the interval midpoint:
W(j)= ( a_j + b_j)/2
The corresponding error is bounded by:
WERR(j) = abs( a_j - b_j)/2
WERR ๐ธ
WERR is DOUBLE PRECISION array, dimension (N).
The error bound on the corresponding eigenvalue approximation in W. bestie this is literally the "how sure are we" number, no cap.
WL ๐ฆ
WL is DOUBLE PRECISION.
WU โจ
WU is DOUBLE PRECISION.
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 byDLAEBZfrom the index range specified.
IBLOCK ๐
IBLOCK is INTEGER array, dimension (N).
At each row/column j where E(j) is zero or small, the matrix T is considered to split into a block diagonal matrix. On exit, if INFO = 0, IBLOCK(i) specifies to which block (from 1 to the number of blocks) the eigenvalue W(i) belongs. (DLARRD may use the remaining N-M elements as workspace.)
INDEXW ๐
INDEXW is INTEGER array, dimension (N).
The indices of the eigenvalues within each block (submatrix); for example, INDEXW(i)= j and IBLOCK(i)=k imply that the i-th eigenvalue W(i) is the j-th eigenvalue in block k. it's giving "which one in which block" energy, periodt.
WORK ๐ง
WORK is DOUBLE PRECISION array, dimension (4*N).
IWORK ๐
IWORK is INTEGER array, dimension (3*N).
INFO ๐
INFO is INTEGER.
- = 0: successful exit
- < 0: if INFO = -i, the i-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 the PARAMETER"FUDGE"may make things work.
- = 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.
not the sloppy floating-point arithmetic jump scare ๐ญ if you see INFO = 4 your machine is lowkey embarrassing you fr fr.
โจ Internal Parameters โจ
FUDGE ๐
FUDGE DOUBLE PRECISION, default = 2.
A "fudge factor" to widen the Gershgorin 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 โ it's just here to keep the vibes (and the intervals) wide enough.
๐ 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 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 conpute 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.
๐ Parameters ๐
RANGE
RANGE is CHARACTER*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
N is INTEGER
The order of the matrix. N > 0.
VL
VL is DOUBLE PRECISION
If RANGE='V', the lower bound for the eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. VL < VU.
If RANGE='I' or ='A', DLARRE computes bounds on the desired part of the spectrum.
VU
VU is DOUBLE PRECISION
If RANGE='V', the upper bound for the eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. VL < VU.
If RANGE='I' or ='A', DLARRE computes bounds on the desired part of the spectrum.
IL
IL is INTEGER
If RANGE='I', the index of the smallest eigenvalue to be returned. 1 <= IL <= IU <= N.
IU
IU is INTEGER
If RANGE='I', the index of the largest eigenvalue to be returned. 1 <= IL <= IU <= N.
D
D is DOUBLE PRECISION array, dimension (N)
On entry, the N diagonal elements of the tridiagonal matrix T.
On exit, the N diagonal elements of the diagonal matrices D_i.
E
E is DOUBLE PRECISION array, dimension (N)
On entry, the first (N-1) entries contain the subdiagonal elements of the tridiagonal matrix T; E(N) need not be set.
On exit, E contains the subdiagonal elements of the unit bidiagonal matrices L_i. The entries E( ISPLIT( I ) ), 1 <= I <= NSPLIT, contain the base points sigma_i on output.
E2
E2 is DOUBLE PRECISION array, dimension (N)
On entry, the first (N-1) entries contain the SQUARES of the subdiagonal elements of the tridiagonal matrix T; E2(N) need not be set.
On exit, the entries E2( ISPLIT( I ) ), 1 <= I <= NSPLIT, have been set to zero.
RTOL1
RTOL1 is DOUBLE PRECISION
RTOL2
RTOL2 is DOUBLE PRECISION
Parameters for bisection. An interval [LEFT,RIGHT] has converged if:
RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
SPLTOL
SPLTOL is DOUBLE PRECISION
The threshold for splitting. if it's under this, it's getting split, sorry bestie ๐ซถ
NSPLIT
NSPLIT is INTEGER
The number of blocks T splits into. 1 <= NSPLIT <= N.
ISPLIT
ISPLIT is INTEGER array, dimension (N)
The splitting points, at which T breaks up into blocks. The first block consists of rows/columns 1 to ISPLIT(1), the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), etc., and the NSPLIT-th consists of rows/columns ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N.
M
M is INTEGER
The total number of eigenvalues (of all L_i D_i L_i^T) found.
W
W is DOUBLE PRECISION array, dimension (N)
The first M elements contain the eigenvalues. The eigenvalues of each of the blocks, L_i D_i L_i^T, are sorted in ascending order (DLARRE may use the remaining N-M elements as workspace).
WERR
WERR is DOUBLE PRECISION array, dimension (N)
The error bound on the corresponding eigenvalue in W.
WGAP
WGAPโDOUBLE PRECISION array, dimension (N)
This one is the separation from the right neighbor eigenvalue in W. ๐ซ
Real talk tho, the gap is only measured against eigenvalues of the same block, because every single block has its own representation tree. Exception bestie: at the right end of a block, we store the left gap instead. Asymmetric but that's the vibe.
IBLOCKโINTEGER array, dimension (N)
The indices of the blocks (submatrices) associated with the corresponding eigenvalues in W. So IBLOCK(i)=1 if eigenvalue W(i) belongs to the first block from the top, =2 if W(i) belongs to the second block, etc. Counting from the top, always. ๐
INDEXWโINTEGER array, dimension (N)
The indices of the eigenvalues within each block (submatrix). For example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the i-th eigenvalue W(i) is the 10-th eigenvalue in block 2. Two coordinates, one eigenvalue, it's giving address label energy. ๐ฏ
GERSโDOUBLE PRECISION array, dimension (2*N)
The N Gerschgorin intervals, and the i-th Gerschgorin interval is (GERS(2*i-1), GERS(2*i)). ๐
PIVMINโDOUBLE PRECISION
The minimum pivot in the Sturm sequence for T.
WORKโDOUBLE PRECISION array, dimension (6*N)
Workspace. That's it, that's the whole job description.
IWORKโINTEGER array, dimension (5*N)
Workspace. Same energy, integer edition.
INFOโINTEGER= 0: successful exit ๐> 0: a problem occurred inDLARRE.< 0: one of the called subroutines signaled an internal problem. You're gonna need to inspect 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 performing 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 they define all their eigenvalues to high relative accuracy. That's the whole point, bestie โ accuracy is the main character here.
๐ซถ 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. She's a glow-up subroutine. โจ
๐ธ 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. One is enough, and honestly? One is iconic.
๐ Parameters ๐
NโINTEGER. The order of the matrix (subblock, if the matrix split).DโDOUBLE PRECISION array, dimension (N). TheNdiagonal elements of the diagonal matrixD.LโDOUBLE PRECISION array, dimension (N-1). The(N-1)subdiagonal elements of the unit bidiagonal matrixL.LDโDOUBLE PRECISION array, dimension (N-1). The(N-1)elementsL(i)*D(i).CLSTRTโINTEGER. The index of the first eigenvalue in the cluster.CLENDโINTEGER. The index of the last eigenvalue in the cluster.WโDOUBLE PRECISION array, dimensionand the dimension is>= (CLEND-CLSTRT+1). The eigenvalue APPROXIMATIONS ofL D L^Tin ascending order.W( CLSTRT )throughW( CLEND )form the cluster of relatively close eigenvalues.WGAPโDOUBLE PRECISION array, dimensionand the dimension is>= (CLEND-CLSTRT+1). The separation from the right neighbor eigenvalue inW.WERRโDOUBLE PRECISION array, dimensionand the dimension is>= (CLEND-CLSTRT+1).WERRcontains the semiwidth of the uncertainty interval of the corresponding eigenvalue APPROXIMATION inW. It's the little bubble of "we're pretty sure it's in here somewhere". ๐ซงSPDIAMโDOUBLE PRECISION. Estimate of the spectral diameter obtained from the Gerschgorin intervals.CLGAPLโDOUBLE PRECISION. (That's the whole spec, no notes. She's mysterious. ๐)CLGAPRโ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โDOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence.SIGMAโDOUBLE PRECISION. The shift used to formL(+) D(+) L(+)^T.DPLUSโDOUBLE PRECISION array, dimension (N). TheNdiagonal elements of the diagonal matrixD(+).LPLUSโDOUBLE PRECISION array, dimension (N-1). The first(N-1)elements ofLPLUScontain the subdiagonal elements of the unit bidiagonal matrixL(+).WORKโDOUBLE PRECISION array, dimension (2*N). Workspace.INFOโINTEGER. 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 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 for numbers. ๐ฅ
๐ธ 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, and the corresponding estimate of the error in these guesses goes in WERR. During bisection, intervals [left, right] are maintained by storing their mid-points and semi-widths in the arrays W and WERR respectively. Squeeze, refine, repeat. ๐
๐ Parameters ๐
NโINTEGER. The order of the matrix.DโDOUBLE PRECISION array, dimension (N). TheNdiagonal elements ofT.E2โDOUBLE PRECISION array, dimension (N-1). The squares of the(N-1)subdiagonal elements ofT.IFIRSTโINTEGER. The index of the first eigenvalue to be computed.ILASTโINTEGER. The index of the last eigenvalue to be computed.RTOLโDOUBLE PRECISION. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < RTOL*MAX(|LEFT|,|RIGHT|). That's the finish line, no cap.OFFSETโINTEGER. Offset for the arraysWandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are to be used.Wโ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. โจWERRโ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โDOUBLE PRECISION array, dimension (2*N). Workspace.IWORKโINTEGER array, dimension (2*N). Workspace.PIVMINโDOUBLE PRECISION. The minimum pivot in the Sturm sequence forT.SPDIAMโDOUBLE PRECISION. The spectral diameter ofT.INFOโ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
๐ซ dlarrk
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 ๐
okay so bestie, here's the tea: DLARRK computes one eigenvalue of a symmetric tridiagonal matrix T to suitable accuracy. It's an auxiliary code, so it's not out here living its main character life on its own โ 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. (yes this is a whole vibe constraint, respect it ๐
)
See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal Matrix", Report CS41, Computer Science Dept., Stanford University, July 21, 1966. (an actual icon from 1966, we stan)
Parameters ๐
NโNis INTEGER. The order of the tridiagonal matrixT.N >= 0.IWโIWis INTEGER. The index of the eigenvalues to be returned.GLโGLis DOUBLE PRECISIONGUโGUis DOUBLE PRECISION. An upper and a lower bound on the eigenvalue.DโDis DOUBLE PRECISION array, dimension (N). The n diagonal elements of the tridiagonal matrixT.E2โE2is DOUBLE PRECISION array, dimension (N-1). The (n-1) squared off-diagonal elements of the tridiagonal matrixT.PIVMINโPIVMINis DOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence forT.RELTOLโRELTOLis 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โWis DOUBLE PRECISIONWERRโWERRis DOUBLE PRECISION. The error bound on the corresponding eigenvalue approximation inW.INFOโINFOis INTEGER= 0: Eigenvalue converged= -1: Eigenvalue did NOT converge (not me getting the sad ending ๐ญ)
Internal Parameters ๐
FUDGEโ DOUBLE PRECISION, default = 2. A "fudge factor" to widen the Gershgorin intervals. (the fudge factor!! the moment!!)
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ฆ dlarrr
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 we spend the bag ๐ธ)
Parameters โจ
NโNis INTEGER. The order of the matrix.N > 0.DโDis DOUBLE PRECISION array, dimension (N). TheNdiagonal elements of the tridiagonal matrixT.EโEis 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โINFOis INTEGERINFO = 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
๐ธ dlartgp
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. (they're just standing there, unbothered, moisturized โจ)- 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 DOUBLE PRECISION. The first component of vector to be rotated.GโGis DOUBLE PRECISION. The second component of vector to be rotated.CSโCSis DOUBLE PRECISION. The cosine of the rotation.SNโSNis DOUBLE PRECISION. The sine of the rotation.RโRis 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. (fr fr, thread safety is the moment)
Author ๐
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ dlaruv
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โ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 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. (portability ate and left no crumbs ๐ )
๐ง dlas2
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.
Parameters ๐ซ
FโFis DOUBLE PRECISION. The (1,1) element of the 2-by-2 matrix.GโGis DOUBLE PRECISION. The (1,2) element of the 2-by-2 matrix.HโHis DOUBLE PRECISION. The (2,2) element of the 2-by-2 matrix.SSMINโSSMINis DOUBLE PRECISION. The smaller singular value.SSMAXโSSMAXis 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. (infinite? bestie the code said "I can handle that" ๐)
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.
๐ dlascl
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. (it's giving "one scalar, so many storage formats" ๐)
Parameters โจ
TYPEโTYPEis CHARACTER*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 bandwidth KL and upper bandwidth KU and with the only the lower half stored.= 'Q': A is a symmetric band matrix with lower bandwidth KL and upper bandwidth KU and with the only the upper half stored.= 'Z': A is a band matrix with lower bandwidth KL and upper bandwidth KU. See DGBTRF for storage details.
KLKLis INTEGER โ the lower bandwidth of A. Only referenced ifTYPE='B','Q'or'Z'. ๐KUis INTEGER โ the upper bandwidth of A. Only referenced ifTYPE='B','Q'or'Z'. same energy bestie ๐ซถCFROMis DOUBLE PRECISIONCTOis DOUBLE PRECISION
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 fr fr do not pass zero, she will simply not survive ๐ญ
Mis INTEGER โ the number of rows of the matrix A.M >= 0.Nis INTEGER โ the number of columns of the matrix A.N >= 0.Ais DOUBLE PRECISION array, dimension(LDA,N)โ the matrix to be multiplied byCTO/CFROM. SeeTYPEfor the storage type. โจLDAis 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
pick your lane and meet the minimum, no cutting corners bestie ๐
INFOis INTEGER0โ successful exit, we ate ๐<0โ ifINFO = -i, the i-th argument had an illegal value. not iconic, fix ur input ๐ญ
โจ 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. ๐ซ
๐ 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. no cap, D gets recycled into S, that's the glow-up โจ
A related subroutine, DLASDA, computes only the singular values, and optionally, the singular vectors in compact form. ๐
๐ธ Parameters
Nis INTEGER
On entry, the row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal array D.
SQREis 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;
Dis DOUBLE PRECISION array, dimension(N)
On entry D contains the main diagonal of the bidiagonal matrix. On exit D, if INFO = 0, contains its singular values. ๐
Eis DOUBLE PRECISION array, dimension(M-1)
Contains the subdiagonal entries of the bidiagonal matrix. On exit, E has been destroyed. rip E, gone but not forgotten ๐
Uis DOUBLE PRECISION array, dimension(LDU, N)
On exit, U contains the left singular vectors.
LDUis INTEGER
On entry, leading dimension of U.
VTis DOUBLE PRECISION array, dimension(LDVT, M)
On exit, VT**T contains the right singular vectors.
LDVTis INTEGER
On entry, leading dimension of VT.
SMLSIZis INTEGER
On entry, maximum size of the subproblems at the bottom of the computation tree. ๐ณ
IWORKis INTEGER array, dimension(8*N)WORKis DOUBLE PRECISION array, dimension(3*M**2+2*M)INFOis 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 struggling, not the vibe ๐ญ
โจ 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. ๐ซ
๐ 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.
three stages, three vibes, all iconic ๐ โจ
๐ธ Parameters
NLis INTEGER
The row dimension of the upper block. NL >= 1.
NRis INTEGER
The row dimension of the lower block. NR >= 1.
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 row dimension N = NL + NR + 1, and column dimension M = N + SQRE.
Dis DOUBLE PRECISION array, dimension(N = NL+NR+1).
On entry D(1:NL,1:NL) contains the singular values of the upper block; and D(NL+2:N) contains the singular values of the lower block. On exit D(1:N) contains the singular values of the modified matrix. glow-up complete โจ
ALPHAis DOUBLE PRECISION
Contains the diagonal element associated with the added row.
BETAis DOUBLE PRECISION
Contains the off-diagonal element associated with the added row.
Uis DOUBLE PRECISION array, dimension(LDU,N)
On entry U(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.
LDUis INTEGER
The leading dimension of the array U. LDU >= max( 1, N ).
VTis DOUBLE PRECISION array, dimension(LDVT,M)whereM = N + SQRE.
On entry VT(1:NL+1, 1:NL+1)**T contains the right singular vectors of the upper block; VT(NL+2:M, NL+2:M)**T contains the right singular vectors of the lower block. On exit VT**T contains the right singular vectors of the bidiagonal matrix.
LDVTis INTEGER
The leading dimension of the array VT. LDVT >= max( 1, M ).
IDXQis 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. sorting era ๐ฅ
IWORKis INTEGER array, dimension( 4 * N )WORKis DOUBLE PRECISION array, dimension( 3*M**2 + 2*M )INFOis 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 struggling, not the vibe ๐ญ
โจ 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
๐ฆ dlasd2 โ the merge-and-deflate bestie ๐ฆ
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)
DLASD2 merges the two sets of singular values together into a single sorted set. Used by sbdsdc.
โจ Purpose โจ
So like, DLASD2 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem โ yes bestie, deflate, it's giving "make it smaller, we don't need all that". ๐
There are two ways deflation can happen:
- when two or more singular values are close together, or
- if there is a tiny entry in the
Zvector.
For each such occurrence the order of the related secular equation problem is reduced by one. Periodt.
DLASD2 is called from DLASD1.
๐ธ 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. Okay so:= 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. Slay.
Kโ INTEGER. Contains the dimension of the non-deflated matrix. This is the order of the related secular equation.1 <= K <=N.Dโ 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. Iconic behavior honestly.Zโ DOUBLE PRECISION array, dimension(N). On exitZcontains the updating row vector in the secular equation.ALPHAโ DOUBLE PRECISION. Contains the diagonal element associated with the added row.BETAโ DOUBLE PRECISION. Contains the off-diagonal element associated with the added row.Uโ DOUBLE PRECISION array, dimension(LDU,N). On entryUcontains 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 exitUcontains the trailing(N-K)updated left singular vectors (those which were deflated) in its lastN-Kcolumns. ๐ซถLDUโ INTEGER. The leading dimension of the arrayU.LDU >= N.VTโ DOUBLE PRECISION array, dimension(LDVT,M). On entryVT**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 exitVT**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. Not me readingVT**Tand forgetting it's the transpose again ๐ญLDVTโ INTEGER. The leading dimension of the arrayVT.LDVT >= M.DSIGMAโ DOUBLE PRECISION array, dimension (N). Contains a copy of the diagonal elements (K-1singular values and one zero) in the secular equation.U2โ DOUBLE PRECISION array, dimension(LDU2,N). Contains a copy of the firstK-1left singular vectors which will be used byDLASD3in a matrix multiply (DGEMM) 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
Four blocks. Very structured. We love a girl with a plan. โจ
LDU2โ INTEGER. The leading dimension of the arrayU2.LDU2 >= N.VT2โ DOUBLE PRECISION array, dimension(LDVT2,N).VT2**Tcontains a copy of the firstKright singular vectors which will be used byDLASD3in a matrix multiply (DGEMM) 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
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.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. Two-step prep, 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.
INFOโ INTEGER. The receipts:= 0: successful exit. ๐< 0: ifINFO = -i, thei-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
๐ dlasd3 โ square roots of the secular equation, but make it fashion ๐
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)
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. She's a caller AND a doer, main character energy fr fr. ๐
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. So likeโฆ probably fine bestie, no cap. ๐
DLASD3 is called from DLASD1.
๐ธ 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. Here we go 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.
Kโ INTEGER. The size of the secular equation,1 =< K = < N. (Yes, that's how it's written in the source. We keep it. ๐ซถ)Dโ DOUBLE PRECISION array, dimension(K). On exit the square roots of the roots of the secular equation, in ascending order. Sorted, tidy, organized โ the dream. โจQโ DOUBLE PRECISION array, dimension (LDQ,K). That's it, that's the whole note. ๐LDQโ INTEGER. The leading dimension of the arrayQ.LDQ >= K.DSIGMAโ DOUBLE PRECISION array, dimension(K). The firstKelements of this array contain the old roots of the deflated updating problem. These are the poles of the secular equation.Uโ DOUBLE PRECISION 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.U2โ DOUBLE PRECISION array, dimension (LDU2, N). The firstKcolumns of this matrix contain the non-deflated left singular vectors for the split problem.LDU2โLDU2โ anINTEGER, bestie ๐ and it's the leading dimension of the arrayU2. So like,LDU2 >= N. no cap.VTโDOUBLE PRECISIONarray, dimension(LDVT, M). The lastM - Kcolumns ofVT**Tare holding the deflated right singular vectors, and honestly? they ate. โจLDVTโINTEGER. The leading dimension of the arrayVT.LDVT >= N, periodt.VT2โDOUBLE PRECISIONarray, dimension(LDVT2, N). The firstKcolumns ofVT2**Tare carrying the non-deflated right singular vectors for the split problem ๐LDVT2โINTEGER. The leading dimension of the arrayVT2.LDVT2 >= N.IDXCโINTEGERarray, dimension( N ). It's the permutation used to arrange the columns ofU(and rows ofVT) into three groups, and here's the tea:- the first group has non-zero entries only at and above (or before)
NL +1 - the second has non-zero entries only at and below (or after)
NL+2 - the third is dense, no notes ๐
- the first group has non-zero entries only at and above (or before)
The first column of U and the row of VT are treated separately, however ๐
Also, and this part matters: the rows of the singular vectors found by DLASD4 must be likewise permuted before the matrix multiplies can take place. iykyk.
CTOTโINTEGERarray, dimension( 4 ). It's 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โDOUBLE PRECISIONarray, dimension(K). The firstKelements of this array contain the components of the deflation-adjusted updating row vector. icon behaviour fr.INFOโINTEGER, and here's the vibe check:= 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. It's used by dbdsdc ๐ฆ
โจ 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. cute, efficient, slay.
โจ Parameters โจ
NโNisINTEGER. The length of all arrays.IโIisINTEGER. The index of the eigenvalue to be computed.1 <= I <= N.DโDisDOUBLE PRECISIONarray, dimension( N ). The original eigenvalues. It is assumed that they are in order,0 <= D(I) < D(J)forI < J.ZโZisDOUBLE PRECISIONarray, dimension( N ). The components of the updating vector.DELTAโDELTAisDOUBLE PRECISIONarray, 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โRHOisDOUBLE PRECISION. The scalar in the symmetric updating formula.SIGMAโSIGMAisDOUBLE PRECISION. The computedsigma_I, the I-th updated eigenvalue.WORKโWORKisDOUBLE PRECISIONarray, dimension( N ). IfN .ne. 1,WORKcontains(D(j) + sigma_I)in its j-th component. IfN = 1, thenWORK( 1 ) = 1.INFOโINFOisINTEGER, and the tea is:= 0: successful exit ๐> 0: ifINFO = 1, the updating process failed ๐ญ
โจ Internal Parameters โจ
- Logical variable
ORGATI(origin-at-i?) is used for distinguishing whetherD(i)orD(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! ๐ฅ MAXITis 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. It's used by sbdsdc ๐ง
โจ 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โIisINTEGER. The index of the eigenvalue to be computed.I = 1orI = 2.DโDisDOUBLE PRECISIONarray, dimension( 2 ). The original eigenvalues. We assume0 <= D(1) < D(2).ZโZisDOUBLE PRECISIONarray, dimension( 2 ). The components of the updating vector.DELTAโDELTAisDOUBLE PRECISIONarray, dimension( 2 ). Contains(D(j) - sigma_I)in its j-th component. The vectorDELTAcontains the information necessary to construct the eigenvectors.RHOโRHOisDOUBLE PRECISION. The scalar in the symmetric updating formula.DSIGMAโDSIGMAisDOUBLE PRECISION. The computedsigma_I, the I-th updated eigenvalue.WORKโWORKisDOUBLE PRECISIONarray, 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 โจ
ICOMPQICOMPQโ it's anINTEGERthat decides whether singular vectors are computed in factored form, bestie.= 0: compute singular values only.= 1: compute singular vectors in factored form as well. Choose your fighter. โจNLโINTEGER, the row dimension of the upper block.NL >= 1. Respect the minimum. ๐NRโINTEGER, the row dimension of the lower block.NR >= 1. Same energy. ๐ฆ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. Math is mathing. ๐DโDOUBLE PRECISIONarray, dimension( NL+NR+1 ). On entry,D(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 exit,D(1:N)contains the singular values of the modified matrix. She's updated. ๐VFโDOUBLE PRECISIONarray, 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. Firsties! โจVLโDOUBLE PRECISIONarray, 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. Last but not least. ๐ALPHAโDOUBLE PRECISION. Contains the diagonal element associated with the added row. Main character diagonal. ๐BETAโDOUBLE PRECISION. Contains the off-diagonal element associated with the added row. The sidekick. ๐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. Sorting? We love to see it. ๐ฅPERMโINTEGERarray, dimension( N ). The permutations (from deflation and sorting) to be applied to each block. Not referenced ifICOMPQ = 0. So if you're not doing vectors, she's ghost. ๐ปGIVPTRโINTEGER. The number of Givens rotations which took place in this subproblem. Not referenced ifICOMPQ = 0. Count them if you care. ๐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. Two columns, one rotation, iconic. ๐LDGCOLโINTEGER. Leading dimension ofGIVCOL, must be at leastN. Don't lowball it. ๐ซGIVNUMโDOUBLE PRECISIONarray, dimension( LDGNUM, 2 ). Each number indicates theCorSvalue to be used in the corresponding Givens rotation. Not referenced ifICOMPQ = 0. Trig values said present. ๐LDGNUMโINTEGER. The leading dimension ofGIVNUMandPOLES, must be at leastN. Same rule, same energy. โจPOLESโDOUBLE PRECISIONarray, 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. Secular equation? She's solving. ๐งฎDIFLโDOUBLE PRECISIONarray, dimension( N ). On exit,DIFL(I)is the distance between theI-th updated (undeflated) singular value and theI-th (undeflated) old singular value. Distance makes the heart grow fonder. ๐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. SeeDLASD8for details onDIFLandDIFR. Details in the group chat. ๐ZโDOUBLE PRECISIONarray, dimension( M ). The first elements of this array contain the components of the deflation-adjusted updating row vector. Glow-up row vector. โจKโINTEGER. Contains the dimension of the non-deflated matrix. This is the order of the related secular equation.1 <= K <=N. Keep it in range, bestie. ๐CโDOUBLE PRECISION.Ccontains garbage ifSQRE =0and theC-value of a Givens rotation related to the right null space ifSQRE = 1. Garbage? We said what we said. ๐๏ธSโDOUBLE PRECISION.Scontains garbage ifSQRE =0and theS-value of a Givens rotation related to the right null space ifSQRE = 1. Same garbage energy. ๐๏ธWORKโDOUBLE PRECISIONarray, dimension( 4 * M ). Workspace. Do not question her. ๐IWORKโINTEGERarray, dimension( 3 * N ). Integer workspace. Slay. ๐ฅINFOโINTEGER.= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. The receipts. ๐งพ
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. She's a merger and a deflator. ๐
Purpose:
So like, 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. Periodt. โจ
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. Compact queen. ๐NLโINTEGER. The row dimension of the upper block.NL >= 1. Respect. ๐ฆNRโINTEGER. The row dimension of the lower block.NR >= 1. Same. ๐ฆ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. Math again. ๐KโINTEGER. Contains the dimension of the non-deflated matrix, this is the order of the related secular equation.1 <= K <=N. Keep it cute. ๐DโDOUBLE PRECISIONarray, 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. Sorted and updated. โจZโDOUBLE PRECISIONarray, dimension( M ). On exitZcontains the updating row vector in the secular equation. Row vector glow. ๐ZWโDOUBLE PRECISIONarray, dimension( M ). Workspace forZ. Supportive bestie. ๐ซถVFโDOUBLE PRECISIONarray, 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. Firsties again. โจVFWโDOUBLE PRECISIONarray, dimension( M ). Workspace forVF. Supportive bestie. ๐ซถVLโDOUBLE PRECISIONarray, 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. Lasties. ๐VLWโDOUBLE PRECISIONarray, dimension( M ). Workspace forVL. Supportive bestie. ๐ซถALPHAโDOUBLE PRECISION. Contains the diagonal element associated with the added row. Main character. ๐BETAโDOUBLE PRECISION. Contains the off-diagonal element associated with the added row. Sidekick. ๐DSIGMAโDOUBLE PRECISIONarray, dimension( N ). Contains a copy of the diagonal elements (K-1singular values and one zero) in the secular equation. Copy that. ๐IDXIDXโ INTEGER array, dimension( N ). This one is holding the receipts: it contains the permutation that got used to sort whatever's inDinto ascending order. ๐IDXPโ INTEGER array, dimension( N ). The placement planner โจ It contains the permutation used to place 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.IDXQโ INTEGER array, dimension( N ). This holds the permutation that 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. Do not skip that step, bestie, it is not optional ๐PERMโ INTEGER array, dimension( N ). The permutations (from deflation and sorting) that get applied to each singular block. Not referenced ifICOMPQ = 0.GIVPTRโ INTEGER. The number of Givens rotations that took place in this subproblem. Not referenced ifICOMPQ = 0. ๐GIVCOLโ INTEGER array, dimension( LDGCOL, 2 ). Every pair of numbers in here points at a pair of columns where a Givens rotation is gonna take place. Not referenced ifICOMPQ = 0.LDGCOLโ INTEGER. The leading dimension ofGIVCOL, and it must be at leastN.GIVNUMโ DOUBLE PRECISION array, dimension( LDGNUM, 2 ). Each number in here is theCorSvalue that gets 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 = 0, and the C-value of a Givens rotation related to the right null space ifSQRE = 1. ๐๏ธ (yes, actual garbage, the manpage said it, not me)Sโ DOUBLE PRECISION. Same energy:Scontains garbage ifSQRE = 0, and the S-value of a Givens rotation related to the right null space ifSQRE = 1.INFOโ INTEGER. The vibe check at the end:= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value. ๐จ illegal argument alert ๐จ
๐ธ 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. Like, it's giving extremely specific mathematician energy and honestly? We respect it. ๐
โจ 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. Says 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 PRECISION array, dimension( K ). On output,Dcontains the updated singular values. โจZโ DOUBLE PRECISION array, 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 PRECISION array, 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 PRECISION array, 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 PRECISION array, dimension( K ). On exit,DIFL(I) = D(I) - DSIGMA(I).DIFRโ 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 โ do not go looking for it, bestie, it is simply not there ๐. 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 PRECISION array, 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. ๐ very slightly, bestie. Barely. A whisper of a change.WORKโ DOUBLE PRECISION array, 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. ๐ it 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. She's the main character of the divide-and-conquer bidiagonal saga, fr fr. ๐
โจ 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. Says whether singular vectors are to be computed in compact form, like this:= 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 PRECISION array, dimension( N ). On entryDcontains the main diagonal of the bidiagonal matrix. On exitD, ifINFO = 0, contains its singular values. โจEโ DOUBLE PRECISION array, dimension( M-1 ). Contains the subdiagonal entries of the bidiagonal matrix. On exit,Ehas been destroyed. ๐ gone. reduced to atoms. do not expect to read it back.Uโ DOUBLE PRECISION array, 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 PRECISION array, 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โ INTEGER array, 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 PRECISION array, dimension( LDU, NLVL ), whereNLVL = floor(log_2 (N/SMLSIZ))).DIFRโ okay bestie theDIFRtea is literally right there and we are spilling it the second this part picks back up ๐ โจDIFRโ aDOUBLE PRECISIONarray, and bestie its shape depends onICOMPQ, so pay attention ๐ dimension( LDU, 2 * NLVL )whenICOMPQ = 1, and dimension( N )whenICOMPQ = 0. IfICOMPQ = 1, then on exit,DIFL(1:N, I)andDIFR(1:N, 2 * I - 1)record the distances between 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. SeeDLASD8for the deets. ๐ฆZโ aDOUBLE PRECISIONarray, dimension( LDU, NLVL )ifICOMPQ = 1and 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. That's it, that's the tea. ๐POLESโ aDOUBLE PRECISIONarray, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and not referenced at all ifICOMPQ = 0(she's not invited to that party ๐). IfICOMPQ = 1, 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โ anINTEGERarray, dimension( N )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,GIVPTR( I )records the number of Givens rotations performed on the I-th problem on the computation tree. Counting rotations, so main character of her ๐GIVCOLโ anINTEGERarray, dimension( LDGCOL, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for eachI,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. Location drop ๐LDGCOLโ anINTEGER,LDGCOL = > N. The leading dimension of arraysGIVCOLandPERM. She's the structural support, lowkey essential ๐ซถPERMโ anINTEGERarray, dimension( LDGCOL, NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,PERM(1, I)records permutations done on the I-th level of the computation tree. Rearranging, as she does ๐GIVNUMโ aDOUBLE PRECISIONarray, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for eachI,GIVNUM(1, 2 *I - 1)andGIVNUM(1, 2 *I)record theC- andS-values of Givens rotations performed on the I-th level on the computation tree. The actual numbers, iconic ๐Cโ aDOUBLE PRECISIONarray, dimension( N )ifICOMPQ = 1, and dimension1ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, on exit,C( I )contains theC-value of a Givens rotation related to the right null space of the I-th subproblem. ๐Sโ aDOUBLE PRECISIONarray, dimension( N )ifICOMPQ = 1, and dimension1ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, on exit,S( I )contains theS-value of a Givens rotation related to the right null space of the I-th subproblem. C and S, a matched set, we love to see it ๐WORKโ aDOUBLE PRECISIONarray, dimension(6 * N + (SMLSIZ + 1)*(SMLSIZ + 1)). The workspace. Give her the room she asked for. ๐งIWORKโ anINTEGERarray, dimension(7*N). Same energy, but integer flavored. ๐ขINFOโ anINTEGER, and this is the vibe check right here:= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value. Not her fault, blame the caller ๐ญ> 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. No cap, that's the whole job description. ๐ผ
โจ 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. Go read the lore bestie, it's giving foundational ๐
๐ฆ 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'โBis upper bidiagonal.UPLO = 'L'or'l'โBis 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 least0.NCVTโNCVTisINTEGER. On entry,NCVTspecifies the number of columns of the matrixVT.NCVTmust be at least0.NRUโNRUisINTEGER. On entry,NRUspecifies the number of rows of the matrixU.NRUmust be at least0.NCCโNCCisINTEGER. On entry,NCCspecifies the number of columns of the matrixC.NCCmust be at least0.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. Sorted, organized, slaying ๐EโEisDOUBLE PRECISIONarray. 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 least1. 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 ). Respect the max, bestie ๐ซก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 least1. 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 least2. Selective, and honestly? Valid. ๐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. That's your count of things that said "no thanks" ๐ญ
๐ 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. She builds the whole family tree ๐ณ
โจ 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โINTEGER array, 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 max row dimension that each subproblem down at the bottom of the tree is allowed to have. like a height restriction but for subproblems.
๐ 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 fills in the off-diagonal elements and the diagonal elements of a matrix with whatever values you hand it. bestie it is literally the "set it and forget it" of matrix init. โจ
๐ฆ Purpose:
DLASET initializes an m-by-n matrix A to BETA on the diagonal and ALPHA on the offdiagonals. that's the whole vibe.
๐ Parameters
UPLOโUPLO is CHARACTER*1. Tells the routine which part of the matrix A is getting set, because sometimes you only want half the drama.= 'U': the upper triangular part gets set; the strictly lower triangular part of A is not changed. (don't touch her. ๐)= 'L': the lower triangular part gets set; the strictly upper triangular part of A is not changed.- Otherwise: the whole entire matrix A is set. all of it. no crumbs.
MโM is INTEGER. The number of rows of the matrix A.M >= 0.NโN is INTEGER. The number of columns of the matrix A.N >= 0.ALPHAโALPHA is DOUBLE PRECISION. The constant that the offdiagonal elements are being set to.BETAโBETA is DOUBLE PRECISION. The constant that the diagonal elements are being set to.AโA is DOUBLE PRECISION array, dimension (LDA,N). On exit, the leading m-by-n submatrix of A is set like this:
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).
not the i.ne.j sneaking in there to say "diagonal stays out of this" ๐
LDAโLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).
๐ 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 "spin the whole thing, but make it orthogonal." ๐ฅ
โญ 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. iconic behavior tbh
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. The rotations are performed without ever forming P(k) explicitly. no notes, that's just efficiency, periodt.
๐ Parameters
SIDEโSIDE is CHARACTER*1. Says whether the plane rotation matrix P gets applied to A on the left or the right.= 'L': Left, computeA := P*A= 'R': Right, computeA:= A*P**T
PIVOTโPIVOT is CHARACTER*1. Specifies the plane for which P(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โDIRECT is CHARACTER*1. Says whether P is a forward or backward sequence of plane rotations.MโM is INTEGER. The number of rows of the matrix A. Ifm <= 1, an immediate return is effected. like it just leaves. ๐ซถNโN is INTEGER. The number of columns of the matrix A. Ifn <= 1, an immediate return is effected.CโC is DOUBLE PRECISION array, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
The cosines c(k) of the plane rotations.
SโS is DOUBLE PRECISION array, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
The sines s(k) of the plane rotations. 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โA is DOUBLE PRECISION array, dimension (LDA,N). The M-by-N matrix A. On exit, A is overwritten byP*AifSIDE = 'L'or byA*P**TifSIDE = 'R'.LDAโLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).
๐ 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. tiny matrix, huge main character energy. ๐
๐ธ 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 ].
look at her go ๐ โจ
๐ฆ Parameters
FโF is DOUBLE PRECISION. The (1,1) element of the 2-by-2 matrix.GโG is DOUBLE PRECISION. The (1,2) element of the 2-by-2 matrix.HโH is DOUBLE PRECISION. The (2,2) element of the 2-by-2 matrix.SSMINโSSMIN is DOUBLE PRECISION.abs(SSMIN)is the smaller singular value.SSMAXโSSMAX is DOUBLE PRECISION.abs(SSMAX)is the larger singular value.SNLโSNL is DOUBLE PRECISION.CSLโCSL is DOUBLE PRECISION. The vector(CSL, SNL)is a unit left singular vector for the singular valueabs(SSMAX).SNRโSNR is DOUBLE PRECISION.CSRโCSR is DOUBLE PRECISION. 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. chaotic but valid, we love a flexible queen
- 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.
bestie if underflow is not gradual, the answers you get back are basically for a slightly different matrix. not a vibe, just a fact. ๐
๐ฆ integer function ieeeck (integer ISPEC, real ZERO, real ONE)
IEEECK โ the literal vibe-check for your floating point arithmetic, bestie โจ
Purpose:
IEEECK gets called from ILAENV to verify that Infinity and possibly NaN arithmetic is safe โ meaning it won't trap on you ๐
Parameters
ISPECโISPEC is INTEGER. 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โZERO is REAL. Must contain the value0.0. It's passed in so the compiler can't be shady and optimize this whole code block away ๐ONEโONE is REAL. Must contain the value1.0. Same energy โ passed in so the compiler doesn'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.
๐ธ integer function iladlc (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
ILADLC scans a matrix for its last non-zero column. Obsessed, honestly ๐
Purpose:
ILADLC scans A for its last non-zero column. That's it. That's the whole job ๐
Parameters
MโM is INTEGER. The number of rows of the matrixA.NโN is INTEGER. The number of columns of the matrixA.AโA is DOUBLE PRECISION array, dimension (LDA,N). ThembynmatrixA.LDAโLDA is 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.
๐ง integer function iladlr (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA)
ILADLR scans a matrix for its last non-zero row ๐ฆ
Purpose:
ILADLR scans A for its last non-zero row. Periodt. ๐
Parameters
MโM is INTEGER. The number of rows of the matrixA.NโN is INTEGER. The number of columns of the matrixA.AโA is DOUBLE PRECISION array, dimension (LDA,N). ThembynmatrixA.LDAโLDA is 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.
๐ integer function ilaenv (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
ILAENV โ the main character of tuning parameters, no cap โจ
Purpose:
ILAENV is called from the LAPACK routines to choose problem-dependent parameters for the local environment. Peep ISPEC for a whole description of the parameters ๐
ILAENV returns an INTEGER:
- if
ILAENV >= 0:ILAENVreturns the value of the parameter specified byISPEC - if
ILAENV < 0: ifILAENV = -k, thek-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 ๐ ๏ธ
This routine will not function correctly if it is converted to all lower case. Converting it to all upper case is allowed.
Parameters
ISPECโISPEC is INTEGER. Specifies the parameter to be returned as the value ofILAENV.= 1: the optimal blocksize; if this value is1, 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 leastkbym, wherekis given byILAENV(2,...)andmbyILAENV(5,...)= 6: the crossover point for the SVD (when reducing anmbynmatrix 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โNAME is CHARACTER*(*). The name of the calling subroutine, in either upper case or lower case.OPTSโOPTS is 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โN1 is INTEGERN2โN2 is INTEGERN3โN3 is INTEGERN4โN4 is 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 )
๐ integer function ilaenv2stage (integer ISPEC, character*( * ) NAME, character*( * ) OPTS, integer N1, integer N2, integer N3, integer N4)
ILAENV2STAGE โ the two-stage sequel we've all been waiting for ๐
Purpose:
ILAENV2STAGE is called from the LAPACK routines to choose problem-dependent parameters for the local environment. See 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, thek-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.
Parameters
ISPECโISPEC is INTEGER. Specifies the parameter to be returned as the value ofILAENV2STAGE.= 1: the optimal blocksizenbfor the reduction to BAND= 2: the optimal blocksizeibfor 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โNAME is CHARACTER*(*). The name of the calling subroutine, in either upper case or lower case.OPTSโOPTS is 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โN1 is INTEGERN2โN2 is INTEGERN3โN3 is INTEGERN4โN4 is 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:
okay so before we dip into the next function, here are the conventions LAPACK uses when it calls ILAENV2STAGE 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. periodt.- 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. no cap. - The parameter value returned by
ILAENV2STAGEis checked for validity in the calling subroutine. validity check, slay.
integer function iparmq
integer function iparmq (integer ISPEC, character, dimension( * ) NAME,
character, dimension( * ) OPTS, integer N, integer ILO, integer IHI,
integer LWORK)
IPARMQ โจ the moment โจ
Purpose:
This program sets problem and machine dependent parameters useful for xHSEQR and related subroutines for eigenvalue problems. It is called whenever IPARMQ is called with 12 <= ISPEC <= 16. iykyk.
Parameters
ISPECโISPECisINTEGER.ISPECspecifies which tunable parameterIPARMQshould return. choose 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.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 toTTQRE.NโNisINTEGER.Nis the order of the Hessenberg matrixH.ILOโILOisINTEGER.IHIโIHIisINTEGER. It is assumed thatHis already upper triangular in rows and columns1:ILO-1andIHI+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,SHSEQRandZHSEQR. it's giving mystery. - 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. not yet, bestie.
- The best choices of most of the parameters depend in an ill-understood way on the relative execution rate of
xLAQR3andxLAQR5and on the nature of each particular eigenvalue problem. Experiment may be the only practical way to determine which choices are most effective. vibe check via experiment. - 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. 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 routine
xLAHQR. 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
logical function lsamen (integer N, character*( * ) CA, character*( * ) CB)
LSAMEN the case-insensitive bestie
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. slay comparison.
Parameters
NโNisINTEGER. The number of characters inCAandCBto be compared.CAโCAisCHARACTER*(*).CBโCBisCHARACTER*(*).CAandCBspecify two character strings of length at leastN. Only the firstNcharacters of each string will be accessed.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine scombssq
subroutine scombssq (real, dimension( 2 ) V1, real, dimension( 2 ) V2)
SCOMBSSQ adds two scaled sum of squares quantities math moment ๐งฎ
Purpose:
SCOMBSSQ adds two scaled sum of squares quantities, V1 := V1 + V2. That is,
V1_scale**2 * V1_sumsq := V1_scale**2 * V1_sumsq
+ V2_scale**2 * V2_sumsq
Parameters
V1โV1isREALarray, dimension(2). The first scaled sum.V1(1) = V1_scale,V1(2) = V1_sumsq.V2โV2isREALarray, dimension(2). The second scaled sum.V2(1) = V2_scale,V2(2) = V2_sumsq.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
logical function sisnan
logical function sisnan (real, intent(in) SIN)
SISNAN tests input for NaN.
Purpose:
SISNAN</p> returns .TRUE. if its argument is NaN, and .FALSE. otherwise. Heads up bestie: this one is slated to be replaced by the Fortran 2003 intrinsic somewhere down the line. ๐ซถ
Parameters
SINโSINisREAL. It's the input we're testing for NaN. ๐
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
subroutine slabad (real SMALL, real LARGE)
SLABAD
Purpose โจ
SLABAD takes as input the values computed by SLAMCH for underflow and overflow, and hands you back the square root of each of those values if the log of LARGE is sufficiently large. No cap.
So like, this subroutine exists to spot machines with a huuuge exponent range โ think Crays โ and redefine the underflow and overflow limits to be the square roots of whatever SLAMCH computed. Why tho? Because SLAMCH does not compensate for poor arithmetic in the upper half of the exponent range, which is exactly the kind of thing you find on a Cray. ๐
Parameters
SMALLโSMALLisREAL. On entry, it's the underflow threshold as computed bySLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, it becomes the square root ofSMALLโ otherwise it's left untouched, bestie. ๐ธLARGEโLARGEisREAL. On entry, it's the overflow threshold as computed bySLAMCH. On exit, ifLOG10(LARGE)is sufficiently large, it becomes the square root ofLARGEโ otherwise, unchanged. Periodt.
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 make it linear algebra. โจ
Purpose โจ
SLACPY copies all or part of a two-dimensional matrix A to another matrix B. Simple as that, and honestly? Iconic.
Parameters
UPLOโUPLOisCHARACTER*1. Tells us which part of matrixAgets copied over toB:= 'U': Upper triangular part ๐= 'L': Lower triangular part ๐ฆ- Otherwise: All of the matrix
A
MโMisINTEGER. The number of rows of the matrixA.M >= 0.NโNisINTEGER. The number of columns of the matrixA.N >= 0.AโAisREALarray, dimension(LDA,N). ThembynmatrixA. IfUPLO = 'U', only the upper triangle or trapezoid is accessed; ifUPLO = 'L', only the lower triangle or trapezoid is accessed. She's selective, and that's valid. ๐LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BโBisREALarray, dimension(LDB,N). On exit,B = Ain the locations specified byUPLO. ๐LDBโLDBisINTEGER. The leading dimension of the arrayB.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</p> computes the eigenvalues of a 2-by-2 symmetric matrix. Tiny matrix, big main character energy. ๐ฅ
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. Boom. ๐
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:
RT1 is accurate to a few ulps barring over/underflow. Slay.
RT2 may be inaccurate if there's massive cancellation in the determinant A*C-B*B. To compute RT2 accurately in all cases you'd need higher precision, or correctly rounded, or correctly truncated arithmetic. It's giving "we did our best". ๐ญ
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 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. She's the whole backstage crew, fr fr. ๐ซถ
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 by IJOB=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 eigenvalues NAB(j,1)+1,...,NAB(j,2), where 1 <= j <= MOUT.
IJOB=3: It performs a binary search in each input interval (AB(j,1),AB(j,2)] for a point w(j) such that N(w(j))=NVAL(j), and uses C(j) as the starting point of the search. If such a w(j) is found, then on output AB(j,1)=AB(j,2)=w. If no such w(j) is found, then on output (AB(j,1),AB(j,2)] will be a small interval containing the point where N(w) jumps through NVAL(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. Inclusive on one side only, she's complicated like that. ๐
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. And to assure the most accurate computation of small eigenvalues, the matrix should be scaled to be not much smaller than that, either. Basically, right in that Goldilocks zone. ๐
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 likeโฆ please be normal about your inputs, bestie. ๐
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
SLAEBZto 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. She keeps receipts. ๐งพ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, 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. Choose your fighter. โจ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 least radix*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โDisREALarray, dimension(N). The diagonal elements of the tridiagonal matrixT. The main characters of the diagonal. ๐EโEisREALarray, dimension(N). The offdiagonal elements of the tridiagonal matrixTin positions 1 throughN-1.E(N)is arbitrary. Do whatever with it, she doesn't care. ๐E2โE2isREALarray, dimension(N). The squares of the offdiagonal elements of the tridiagonal matrixT.E2(N)is ignored.NVALโ โฆ
NVAL ๐ธ
NVALisINTEGER array, dimension (MINP)- If
IJOB=1or2, not referenced. ๐ - If
IJOB=3, the desired values ofN(w). The elements ofNVALwill be reordered to correspond with the intervals inAB. So like,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. bestie the array is not where you left it, ok?? ๐
- If
AB โจ
ABisREAL array, dimension (MMAX,2)- The endpoints of the intervals.
AB(j,1)is a(j), the left endpoint of the j-th interval, andAB(j,2)is b(j), the right endpoint of the j-th interval. The input intervals will, in general, be modified, split, and reordered by the calculation. it's giving chaos but make it math ๐ฆ
- The endpoints of the intervals.
C ๐
CisREAL array, dimension (MMAX)- If
IJOB=1, ignored. - If
IJOB=2, workspace. - If
IJOB=3, then on inputC(j)should be initialized to the first search point in the binary search.
- If
MOUT ๐
MOUTisINTEGER- If
IJOB=1, the number of eigenvalues in the intervals. - If
IJOB=2or3, the number of intervals output. - If
IJOB=3,MOUTwill equalMINP.
- If
NAB ๐
NABisINTEGER array, dimension (MMAX,2)- 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 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 points w, 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 points w, in which caseNAB(i,2)will not be modified. Normally,NABshould be set to some distinctive value(s) beforeSLAEBZis called. ๐ญ
WORK ๐ง
WORKisREAL array, dimension (MMAX)- Workspace.
IWORK ๐
IWORKisINTEGER array, dimension (MMAX)- Workspace.
INFO โญ
INFOisINTEGER= 0: All intervals converged. slay ๐= 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, 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. 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 ๐ฆ
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. iconic behavior fr fr ๐
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
AisREAL- The
(1,1)element of the 2-by-2 matrix.
- The
B
BisREAL- The
(1,2)element and the conjugate of the(2,1)element of the 2-by-2 matrix.
- The
C
CisREAL- The
(2,2)element of the 2-by-2 matrix.
- The
RT1
RT1isREAL- The eigenvalue of larger absolute value.
RT2
RT2isREAL- The eigenvalue of smaller absolute value.
CS1
CS1isREAL
SN1
SN1isREAL- The vector
(CS1, SN1)is a unit right eigenvector forRT1.
- The vector
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. ๐ญ
CS1 and SN1 are accurate to a few ulps barring over/underflow.
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 slag2d ๐
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 but for your data โจ
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. bestie, it trusts you completely, don't abuse that ๐ญ
Parameters ๐
M
MisINTEGER- The number of lines of the matrix
A.M >= 0.
- The number of lines of the matrix
N
NisINTEGER- The number of columns of the matrix
A.N >= 0.
- The number of columns of the matrix
SA
SAisREAL array, dimension (LDSA,N)- On entry, the
M-by-Ncoefficient matrixSA.
- On entry, the
LDSA
LDSAisINTEGER- The leading dimension of the array
SA.LDSA >= max(1,M).
- The leading dimension of the array
A
AisDOUBLE PRECISION array, dimension (LDA,N)- On exit, the
M-by-Ncoefficient matrixA.
- On exit, the
LDA
LDAisINTEGER- The leading dimension of the array
A.LDA >= max(1,M).
- The leading dimension of the array
INFO
INFOisINTEGER= 0: successful exit
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ subroutine slagts ๐
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. no cap, it just solves it ๐
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
JOBisINTEGER- Specifies the job to be performed by
SLAGTSas 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.
- Specifies the job to be performed by
N
NisINTEGER- The order of the matrix
T.
- The order of the matrix
A
Aโ okay soAis a REAL array, dimension(N). On entry, bestie,Amust contain the diagonal elements ofUas returned fromSLAGTF. slay ๐BโBis a REAL array, dimension(N-1). On entry,Bmust contain the first super-diagonal elements ofUas returned fromSLAGTF. โจCโCis a REAL array, dimension(N-1). On entry,Cmust contain the sub-diagonal elements ofLas returned fromSLAGTF. ๐DโDis a REAL array, dimension(N-2). On entry,Dmust contain the second super-diagonal elements ofUas returned fromSLAGTF. ๐ฆINโINis an INTEGER array, dimension(N). On entry,INmust contain details of the matrixPas returned fromSLAGTF. ๐ธYโYis a REAL array, dimension(N). On entry, the right hand side vectory. On exit,Yis overwritten by the solution vectorx. ๐TOLโTOLis REAL. 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โINFOis INTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: overflow would occur when computing theINFOth 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. ๐
๐ 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. no cap.
โจ Purpose โจ
This routine is not for general use. It exists solely to avoid over-optimization in SISNAN. iykyk
SLAISNAN 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.
๐ 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.
โจ Purpose โจ
SLANEG 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 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). TheNdiagonal elements of the diagonal matrixD.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.
โจ 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.
๐ธ Parameters ๐ธ
NORMโNORMisCHARACTER*1. Specifies the value to be returned inSLANSTas described above.NโNis INTEGER. The order of the matrixA.N >= 0. WhenN = 0,SLANSTis set to zero.DโDis REAL array, dimension(N). The diagonal elements ofA.EโEis REAL array, 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.
โจ real function slapy2 (real X, real Y) โจ
SLAPY2 returns sqrt(x2+y2).
๐ Purpose ๐
SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary overflow and unnecessary underflow.
๐ฆ Parameters ๐ฆ
XโXis REAL.YโYis REAL.XandYspecify the valuesxandy.
๐ 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).
๐ 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,YandZspecify the valuesx,yandz.
๐ Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ 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.
โจ 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.
๐ 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.
โจ 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โDis REAL array, dimension(N). On entry, theNdiagonal elements of the tridiagonal matrixT.EโEโ REAL array, dimension (N). On entry, the first(N-1)entries hold the subdiagonal elements of the tridiagonal matrixT;E(N)doesn't even need to be set, no pressure ๐ซถ. On exit, the entriesE( ISPLIT( I ) ),1 <= I <= NSPLIT, get set to zero, and the other entries ofEare left completely untouched. ๐E2โ REAL array, dimension (N). On entry, the first(N-1)entries hold 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โ REAL. The threshold for splitting, bestie. Two criteria can be used:SPLTOL<0gives you a criterion based on absolute off-diagonal value, andSPLTOL>0gives you a criterion that preserves relative accuracy. Choose wisely โจTNRMโ REAL. The norm of the matrix. That's it, that's the whole vibe.NSPLITโ INTEGER. The number of blocksTsplits into.1 <= NSPLIT <= N.ISPLITโ INTEGER array, dimension (N). The splitting points, aka whereTbreaks up into blocks. The first block is rows/columns 1 toISPLIT(1), the second is rows/columnsISPLIT(1)+1throughISPLIT(2), etc., and the NSPLIT-th one is rows/columnsISPLIT(NSPLIT-1)+1throughISPLIT(NSPLIT)=N. It's giving very organized bestie energy ๐ฆINFOโ INTEGER.= 0: successful exit. Periodt. ๐
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 ๐
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. Bestie it is literally out here doing the detective work on your eigenvalues ๐ฅ
Purpose
Given the relatively robust representation (RRR) L D L^T, SLARRB 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 come in through W, and the corresponding estimate of the error in these guesses plus their gaps come in through 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. So cute, so precise ๐
Parameters
Nโ INTEGER. The order of the matrix.Dโ REAL array, dimension (N). TheNdiagonal elements of the diagonal matrixD.LLDโ REAL array, dimension (N-1). The(N-1)elementsL(i)*L(i)*D(i).IFIRSTโ INTEGER. The index of the first eigenvalue to be computed.ILASTโ INTEGER. The index of the last eigenvalue to be computed.RTOL1โ REAL. (Yeah bestie, that's literally all the page tells us about this one โ no cap ๐)RTOL2โ REAL. Tolerance for the convergence of the bisection intervals. An interval[LEFT,RIGHT]has converged if
RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
where GAP is the (estimated) distance to the nearest eigenvalue. Iconic convergence behaviour honestly ๐
OFFSETโ INTEGER. Offset for the arraysW,WGAPandWERR, i.e., theIFIRST-OFFSETthroughILAST-OFFSETelements of these arrays are the ones being used.Wโ 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. Glow up โจWGAPโ REAL array, 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โ do not skip this bestie, it matters ๐ญ. On output, these gaps are refined.WERRโ 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โ REAL array, dimension (2*N). Workspace. The little helper doing unpaid labour ๐ซถIWORKโ INTEGER array, dimension (2*N). Workspace.PIVMINโ REAL. The minimum pivot in the Sturm sequence.SPDIAMโ REAL. The spectral diameter of the matrix.TWISTโ INTEGER. 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)
The way this factorization twists?? main character behaviour ๐
INFOโ 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 slarrc ๐
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. It's a counter bestie, it counts ๐ฅ
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โ CHARACTER*1.= 'T': Compute Sturm count for matrixT.= 'L': Compute Sturm count for matrixL D L^T.
Nโ INTEGER. The order of the matrix.N > 0. Gotta be positive, no zero vibes allowed ๐VLโ REAL. The lower bound for the eigenvalues.VUโ REAL. The upper bound for the eigenvalues.Dโ REAL array, dimension (N).JOBT = 'T': TheNdiagonal elements of the tridiagonal matrixT.JOBT = 'L': TheNdiagonal elements of the diagonal matrixD.
Eโ REAL array, dimension (N).JOBT = 'T': TheN-1offdiagonal elements of the matrixT.JOBT = 'L': TheN-1offdiagonal elements of the matrixL.
PIVMINโ REAL. The minimum pivot in the Sturm sequence forT.EIGCNTโ INTEGER. The number of eigenvalues of the symmetric tridiagonal matrixTthat are in the interval(VL,VU]. There it is, the whole point ๐LCNTโ INTEGER. (That's all it says bestie, it's a mystery ๐)RCNTโ INTEGER. The left and right negcounts of the interval.INFOโ INTEGER. (Also just vibing here with no description, iconic 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 slarrd โญ
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. She's precise, she's powerful, she's the moment ๐
Purpose
SLARRD computes the eigenvalues of a symmetric tridiagonal matrix T to suitable accuracy. This is an auxiliary code to be called from SSTEMR. 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. Bestie this is not optional, please scale responsibly ๐ญ
See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal Matrix", Report CS41, Computer Science Dept., Stanford University, July 21, 1966. Reading homework, but make it chic ๐
Parameters
RANGEโ CHARACTER*1.= 'A': ("All") all eigenvalues will be found.= 'V': ("Value") all eigenvalues in the half-open interval(VL, VU]will be found.= 'I': ("Index") the IL-th through IU-th eigenvalues (of the entire matrix) will be found.
ORDERโORDERโ this one's aCHARACTER*1, bestie, and it tells us how the eigenvalues should be sorted. Choices:'B': ("By Block") ๐ the eigenvalues get grouped by their split-off block (peepIBLOCK,ISPLIT) and then ordered from smallest to largest within the block.'E': ("Entire matrix") ๐ the eigenvalues for the whole entire matrix get ordered from smallest to largest.
NโNisINTEGER. It's the order of the tridiagonal matrixT. And it's gotta satisfyN >= 0. Periodt.VLโVLisREAL. IfRANGE='V', this is the lower bound of the interval we're searching for eigenvalues in. Eigenvalues less than or equal toVL, or greater thanVU, will not be returned.VL < VU. Not referenced ifRANGE = 'A'or'I'.VUโVUisREAL. IfRANGE='V', this is the upper bound of the interval we're searching for eigenvalues in. 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. Condition:1 <= IL <= IU <= N, ifN > 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 condition:1 <= IL <= IU <= N, ifN > 0; andIL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.GERSโGERSis aREALarray, dimension(2*N). It holds theNGerschgorin intervals (and the i-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i))). ๐ซถRELTOLโRELTOLisREAL. It's the minimum relative width of an interval. When an interval is narrower thanRELTOLtimes the larger (in magnitude) endpoint, then it's considered sufficiently small, i.e. converged. ๐ซ Heads up though: 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 of the tridiagonal matrixT. โจPIVMINโPIVMINisREAL. The minimum pivot allowed in the Sturm sequence forT. No cap.NSPLITโNSPLITisINTEGER. The number of diagonal blocks in the matrixT, with1 <= NSPLIT <= N.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. (Only the firstNSPLITelements actually get used, but since you literally 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.)WโWis aREALarray, dimension(N). On exit, the firstMelements ofWwill contain 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. The corresponding error is bounded byWERR(j) = abs( a_j - b_j)/2. ๐ธ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. Here's the tea:- 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. (And psst โSLARRDmay use the remainingN-Melements as workspace.)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. iykyk ๐WORKโWORKis aREALarray, dimension(4*N).IWORKโIWORKis anINTEGERarray, dimension(3*N).INFOโINFOisINTEGER, and this is the receipts:= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value ๐> 0: some or all of the eigenvalues failed to converge or were not computed:=1or3: 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. ๐ญ=2or3: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 the PARAMETER"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 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. ๐
๐ซถ 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. ๐ฅ
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) a suitable shift at one end of the block's spectrum,
- (b) the base representation,
T_i - sigma_i I = L_i D_i L_i^T, and - (c) 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 conpute all and then discard any unwanted one. As an added benefit, SLARRE also outputs the n Gerschgorin intervals for the matrices L_i D_i L_i^T. ๐
Parameters
RANGEโRANGEisCHARACTER*1, and it's giving options:'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โVU(REAL) โ 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',SLARREcomputes bounds on the desired part of the spectrum. ๐IL(INTEGER) โ IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N. โจIU(INTEGER) โ IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N. โจD(REALarray, dimension(N)) โ On entry, theNdiagonal elements of the tridiagonal matrixT. On exit, theNdiagonal elements of the diagonal matricesD_i. ๐ฆE(REALarray, 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(REALarray, 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(REAL) โ It's just aREAL, bestie. No extra deets here. ๐RTOL2(REAL) โ Parameters for bisection. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ). ๐SPLTOL(REAL) โ The threshold for splitting. โ๏ธNSPLIT(INTEGER) โ The number of blocksTsplits into.1 <= NSPLIT <= N. ๐งฉISPLIT(INTEGERarray, 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. ๐งฉM(INTEGER) โ The total number of eigenvalues (of allL_i D_i L_i^T) found. ๐ขW(REALarray, 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). ๐WERR(REALarray, dimension(N)) โ The error bound on the corresponding eigenvalue inW. ๐WGAP(REALarray, 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 gap. ๐ณIBLOCK(INTEGERarray, 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. ๐งฑINDEXW(INTEGERarray, dimension(N)) โ The indices of the eigenvalues within each block (submatrix); for example,INDEXW(i)= 10andIBLOCK(i)=2imply that thei-th eigenvalueW(i)is the10-th eigenvalue in block2. ๐ขGERS(REALarray, dimension(2*N)) โ TheNGerschgorin intervals (thei-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i))). ๐ฏPIVMIN(REAL) โ The minimum pivot in the Sturm sequence forT. ๐๏ธWORK(REALarray, dimension(6*N)) โ Workspace. ๐ ๏ธIWORK(INTEGERarray, dimension(5*N)) โ Workspace. ๐ ๏ธINFO(INTEGER) โ= 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 ๐
N(INTEGER) โ The order of the matrix (subblock, if the matrix split). ๐งฎD(REALarray, dimension(N)) โ TheNdiagonal elements of the diagonal matrixD. ๐ฆL(REALarray, dimension(N-1)) โ The(N-1)subdiagonal elements of the unit bidiagonal matrixL. ๐ฆLD(REALarray, dimension(N-1)) โ The(N-1)elementsL(i)*D(i). ๐ฆCLSTRT(INTEGER) โ The index of the first eigenvalue in the cluster. ๐ฏCLEND(INTEGER) โ The index of the last eigenvalue in the cluster. ๐ฏW(REALarray, 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. ๐WGAP(REALarray, dimension is>= (CLEND-CLSTRT+1)) โ The separation from the right neighbor eigenvalue inW. ๐ณWERR(REALarray, dimension is>= (CLEND-CLSTRT+1)) โWERRcontain the semiwidth of the uncertainty interval of the corresponding eigenvalue APPROXIMATION inW. ๐SPDIAM(REAL) โ estimate of the spectral diameter obtained from the Gerschgorin intervals. ๐ฏCLGAPL(REAL) โ No extra deets, just aREAL. ๐CLGAPR(REAL) โ absolute gap on each end of the cluster. Set by the calling routine to protect against shifts too close to eigenvalues outside the cluster. ๐ก๏ธPIVMIN(REAL) โ The minimum pivot allowed in the Sturm sequence. ๐๏ธSIGMA(REAL) โ The shift used to formL(+) D(+) L(+)^T. ๐DPLUS(REALarray, dimension(N)) โ TheNdiagonal elements of the diagonal matrixD(+). ๐ฆLPLUS(REALarray, dimension(N-1)) โ The first(N-1)elements ofLPLUScontain the subdiagonal elements of the unit bidiagonal matrixL(+). ๐ฆWORK(REALarray, dimension(2*N)) โ Workspace. ๐ ๏ธINFO(INTEGER) โ 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 given the initial eigenvalue approximations of T, SLARRJ 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. periodt ๐
โจ Parameters โจ
NโNis INTEGER. The order of the matrix. slayDโDis REAL array, dimension (N). The N diagonal elements ofT.E2โE2is REAL array, dimension (N-1). The Squares of the (N-1) subdiagonal elements ofT.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 forT.SPDIAMโSPDIAMis REAL. The spectral diameter ofT.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 โจ
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. bestie, it's giving auxiliary energy โจ
โจ 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 matrixT.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 matrixT.E2โE2is REAL array, dimension (N-1). The (n-1) squared off-diagonal elements of the tridiagonal matrixT.PIVMINโPIVMINis REAL. The minimum pivot allowed in the Sturm sequence forT.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 โจ
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. vibe check ๐ฆ
โจ 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 matrixT.EโEis REAL 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โ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 โจ
subroutine slartgp (real F, real G, real CS, real SN, real R)
SLARTGP generates a plane rotation so that the diagonal is nonnegative. iconic โจ
โจ 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 โจ
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. random queen ๐
โจ 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 โจ
subroutine slas2 (real F, real G, real H, real SSMIN, real SSMAX)
SLAS2 computes singular values of a 2-by-2 triangular matrix. ate ๐
โจ 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.SSMINSSMINโSSMINisREAL, and it's the smaller singular value. that's it, that's the whole vibe ๐SSMAXโSSMAXisREAL, and it's the larger singular value. the big one. main character singular value energy ๐
โจ Author โจ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ Further Details ๐
okay so bestie, here's the fine print and it's actually important:
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. no cap, it just handles it.
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.) watch out for that Cray situation fr fr
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, abrupt underflow = your results are lowkey not your results anymore ๐ญ
๐ธ 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. it's giving "scale the whole thing, but do it safely" ๐ซถ
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.
like, the whole point is that it doesn't blow up on you mid-computation. iconic behaviour honestly โญ
Parameters
TYPEโTYPEisCHARACTER*1. it tells the routine how your matrix is stored, and honestly it's the most important letter you'll type today:= '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. SeeSGBTRFfor storage details.
KLโKLisINTEGER. The lower bandwidth ofA. Referenced only ifTYPE = 'B','Q'or'Z'. so if you're not doing bands, don't stress about it ๐KUโKUisINTEGER. The upper bandwidth ofA. Referenced only ifTYPE = 'B','Q'or'Z'. same deal, band gang only ๐CFROMโCFROMisREAL. (the denominator of the glow-up, if you will)CTOโCTOisREAL. The matrixAis multiplied byCTO/CFROM.A(I,J)is computed without over/underflow if the final resultCTO*A(I,J)/CFROMcan be represented without over/underflow.CFROMmust be nonzero.
โ ๏ธ bestie. CFROM must be nonzero. it is literally the denominator. do not do that to yourself ๐
MโMisINTEGER. The number of rows of the matrixA.M >= 0.NโNisINTEGER. The number of columns of the matrixA.N >= 0.AโAisREAL array, dimension (LDA,N). The matrix to be multiplied byCTO/CFROM. SeeTYPEfor the storage type.LDAโLDAisINTEGER. The leading dimension of the arrayA. here's the vibe check, and yes it's a whole conditional situation:- 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โINFOisINTEGER. the receipts ๐0โ successful exit. slay<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.
๐ฆ 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. it's the behind-the-scenes bestie, iykyk ๐
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. that's her low-effort cousin, still valid โจ
Parameters
NโNisINTEGER. On entry, the row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal arrayD.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โDisREAL array, dimension (N). On entryDcontains the main diagonal of the bidiagonal matrix. On exitD, ifINFO = 0, contains its singular values. it gets a whole glow-up in place ๐EโEisREAL array, dimension (M-1). Contains the subdiagonal entries of the bidiagonal matrix. On exit,Ehas been destroyed. gone. reduced to atoms. do not go looking for it after ๐UโUisREAL array, dimension (LDU, N). On exit,Ucontains the left singular vectors.LDUโLDUisINTEGER. On entry, leading dimension ofU.VTโVTisREAL array, dimension (LDVT, M). On exit,VT**Tcontains the right singular vectors.LDVTโLDVTisINTEGER. On entry, leading dimension ofVT.SMLSIZโSMLSIZisINTEGER. On entry, maximum size of the subproblems at the bottom of the computation tree. tiny subproblems, tiny tree leaves, big results ๐IWORKโIWORKisINTEGER array, dimension (8*N).WORKโWORKisREAL array, dimension (3*M**2+2*M).INFOโINFOisINTEGER.= 0: successful exit. we love to see it< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = 1, a singular value did not converge. not the vibe. something didn't converge and you gotta deal with 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 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. another one from the sbdsdc cinematic universe ๐ฌ
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
Zvector. For each such occurrence the dimension of the secular equation problem is reduced by one. This stage is performed by the routineSLASD2. - 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. - 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.
three stages, one pipeline, zero shortcuts. it's giving methodical. ๐
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 anNR-by-NRsquare matrix.= 1: the lower block is anNR-by-(NR+1)rectangular matrix.
The bidiagonal matrix has row dimension N = NL + NR + 1, and column dimension M = N + SQRE.
DโDisREAL array, 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โUisREAL 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 exitUcontains the left singular vectors of the bidiagonal matrix.LDULDUโ INTEGER, the leading dimension of the arrayU. Gotta beLDU >= max( 1, N ). no exceptions bestieVTโ 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)**Tis holding the right singular vectors of the lower block. On exit?VT**Tcontains the right singular vectors of the bidiagonal matrix. glow up complete โจLDVTโ INTEGER, leading dimension of the arrayVT.LDVT >= max( 1, M ). respect the dimension or perishIDXQโ INTEGER array, dimension (N). This one's carrying the permutation that reintegrates the subproblem we just solved back into sorted order โ so like,D( IDXQ( I = 1, N ) )will come out in ascending order. it's giving organizedIWORKโ INTEGER array, dimension (4*N). just vibing as workspaceWORKโ REAL array, dimension (3*M**2+2*M). big mood, big allocationINFOโ INTEGER= 0: successful exit. we ate ๐< 0: ifINFO = -i, the i-th argument had an illegal value. bestie that argument is NOT valid> 0: ifINFO = 1, a singular value did not converge. it literally would not converge, embarrassing for 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 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. a lil merge-and-deflate moment
โจ 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. shrink era
SLASD2 is called from SLASD1.
๐ Parameters
NLโ INTEGER. The row dimension of the upper block.NL >= 1. mandatory, bestieNRโ INTEGER. The row dimension of the lower block.NR >= 1.SQREโ 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. 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. watch that range frDโ REAL 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. deflated but still sorted, we love a comebackZโ REAL array, dimension (N). On exitZcontains 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 entryUcontains 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 exitUcontains the trailing(N-K)updated left singular vectors (those which were deflated) in its lastN-Kcolumns.LDUโ INTEGER. The leading dimension of the arrayU.LDU >= N.VTโ REAL array, dimension (LDVT,M). On entryVT**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 exitVT**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. spooky null space behavior โจ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.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 with1atNL+1and zero everywhere else; the second block contains non-zero entries only at and aboveNL; the third contains non-zero entries only belowNL+1; and the fourth is dense. four blocks, one slayLDU2โ 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 special0diagonal element inSIGMA; the second block contains non-zeros only at and beforeNL +1; the third block contains non-zeros only at and afterNL +2. three blocks this time, iconicLDVT2โ 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.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 aboveNL, the second contains non-zero entries only belowNL+2, and the third is dense.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. heads up, both halves need a lil pre-editCOLTYPโ 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:1: non-zero in the upper half only2: non-zero in the lower half only3: dense4: deflated
On exit, it is an array of dimension 4, with COLTYP(I) being the dimension of the I-th type columns. labels on labels
INFOโ INTEGER= 0: successful exit. clean ๐< 0: ifINFO = -i, the i-th argument had an illegal value. girl what argument was that
๐ 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. roots of roots, very meta of it
โจ 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. conceivably fail?? on hex/decimal machines with no guard digit. dramatic.
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= 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. same shape lore as before
KKโKis INTEGER. The size of the secular equation, 1 =< K = < N. Yes bestie, that's a real double inequality, that's just how it is ๐DโDis REAL array, dimension(K). On exit? It holds the square roots of the roots of the secular equation, in ascending order. Glow up from roots to square roots, we love an ascending arc โจQโQis REAL array, dimension (LDQ,K). Just sitting there, being an array, no notes.LDQโLDQis INTEGER. The leading dimension of the arrayQ.LDQ >= K. It's the boundary, respect it ๐ซถDSIGMAโDSIGMAis REAL array, dimension(K). The firstKelements of this array contain the old roots of the deflated updating problem. These are the poles of the secular equation. The drama of it all, honestly iconic.UโUis REAL array, dimension (LDU,N). The lastN - Kcolumns of this matrix contain the deflated left singular vectors.LDUโLDUis INTEGER. The leading dimension of the arrayU.LDU >= N.U2โU2is REAL array, dimension (LDU2,N). The firstKcolumns of this matrix contain the non-deflated left singular vectors for the split problem. Not deflated. Hydrated, even ๐งLDU2โLDU2is INTEGER. The leading dimension of the arrayU2.LDU2 >= N.VTโVTis REAL array, dimension (LDVT,M). The lastM - Kcolumns ofVT**Tcontain the deflated right singular vectors. (Yes,VTis holdingVT**T's stuff. It's giving transposed energy ๐)LDVTโLDVTis INTEGER. The leading dimension of the arrayVT.LDVT >= N.VT2โVT2is REAL array, dimension (LDVT2,N). The firstKcolumns ofVT2**Tcontain the non-deflated right singular vectors for the split problem.LDVT2โLDVT2is INTEGER. The leading dimension of the arrayVT2.LDVT2 >= N.IDXCโIDXCis 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. Three groups, one iconique little exception.
The rows of the singular vectors found by SLASD4 must be likewise permuted before the matrix multiplies can take place. No cap โ permute first, multiply later, that's the law ๐
CTOTโCTOTis 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. A little census of the vibes ๐ZโZis REAL array, dimension (K). The firstKelements of this array contain the components of the deflation-adjusted updating row vector. Deflation-adjusted = โจself-careโจINFOโINFOis INTEGER. The receipts:= 0: successful exit. ๐< 0: ifINFO = -i, the i-th argument had an illegal value. Rude argument alert.> 0: ifINFO = 1, a singular value did not converge. She did NOT converge, bestie. It happens.
๐ 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. Very specific, very 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. 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. Fancy approximations, the audacity, the craft ๐
๐ Parameters
NโNis INTEGER. The length of all arrays. All of them. Every single one ๐ซกIโIis INTEGER. The index of the eigenvalue to be computed.1 <= I <= N.DโDis REAL array, dimension (N). The original eigenvalues. It is assumed that they are in order,0 <= D(I) < D(J)forI < J. Sorted, as they should be ๐ZโZis REAL array, dimension (N). The components of the updating vector.DELTAโDELTAis 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. It's giving... the blueprint ๐RHOโRHOis REAL. The scalar in the symmetric updating formula.SIGMAโSIGMAis REAL. The computedsigma_I, theI-th updated eigenvalue. She's computed. She's sigma. ๐WORKโWORKis REAL array, dimension (N). IfN .ne. 1,WORKcontains(D(j) + sigma_I)in its j-th component. IfN = 1, thenWORK( 1 ) = 1. Note the plus.DELTAwas minus. They're a duo ๐คINFOโINFOis INTEGER.= 0: successful exit โ> 0: ifINFO = 1, the updating process failed. She tried. She failed. We move on. ๐ญ
๐ 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! Three. Three poles. Say it with me ๐ฅ
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. Two by two. Tiny. Adorable. Powerful.
๐ธ 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. Norm of one. Always norm of one. It's the house rule ๐ โจ
๐ Parameters
IโIis INTEGER. The index of the eigenvalue to be computed.I = 1orI = 2. That's the whole menu, bestie ๐DโDis REAL array, dimension (2). The original eigenvalues. We assume0 <= D(1) < D(2).ZโZis REAL array, dimension (2). The components of the updating vector.DELTAโDELTAis REAL array, dimension (2). Contains(D(j) - sigma_I)in its j-th component. The vectorDELTAcontains the information necessary to construct the eigenvectors.RHOโRHOis REAL. The scalar in the symmetric updating formula.DSIGMAโDSIGMAis REAL. The computedsigma_I, theI-th updated eigenvalue. Look at her, all computed and everything ๐WORKโWORKis 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. Merging. Appending. SVD. The full package ๐
๐ธ 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. (Shoutout SLASD1, different routine, different vibe, same family ๐ซถ)
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. (Empty entry. She said "no thoughts, blank, 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. Not even referenced. They're just vibing offstage, unbothered ๐
The singular values are stored in D. The algorithm consists of two stages:
okay so stage one is literally all about deflating the problem size when you've got multiple singular values or a zero just vibing in the Z vector. Every time that happens, the dimension of the secular equation problem gets reduced by one. This whole stage is handled by the routine SLASD7. ๐
then stage two is where we calculate the updated singular values. We do that by finding the roots of the secular equation using SLASD4 (which is called by SLASD8). That routine also updates VF and VL and computes the distances between the new singular values and the old ones. slay โจ
SLASD6 gets called from SLASDA. periodt ๐ฆ
โจ Parameters โจ
okay bestie, here's the full parameter breakdown:
ICOMPQโINTEGER. Tells us if singular vectors should 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 dimension N = NL + NR + 1, and column dimension M = N + SQRE.
DโREALarray, dimension(NL+NR+1). On entry,D(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 exit,D(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 between theI-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.
If ICOMPQ = 1, DIFR(1:K,2) is an array containing the normalizing factors for the right singular vector matrix.
See SLASD8 for details on DIFL and DIFR.
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. garbage means don't touch it, bestie ๐SโREAL.Scontains garbage ifSQRE =0and theS-value of a Givens rotation related to the right null space ifSQRE = 1. same energy ๐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 โจ
Shoutout to the legends:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โจ Contributors โจ
Big ups to:
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. it's giving teamwork ๐ค
โจ 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 has N = NL + NR + 1 rows and M = N + SQRE >= N columns.
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.BETAโBETAโ it's REAL, bestie. Holds the off-diagonal element that comes with the added row. that's it, that's the whole job ๐DSIGMAโ a REAL array, dimension( N ). Contains a copy of the diagonal elements โ that'sK-1singular values plus one (1) zero โ living inside the secular equation. iconic behavior honestly.IDXโ INTEGER array, dimension( N ). This one's gonna hold the permutation used to sort what's insideDinto ascending order. sorting is self-care โจIDXPโ INTEGER array, dimension( N ). Contains the permutation used to plop 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. two neighborhoods, one array, we love to see it ๐ฆIDXQโ INTEGER array, dimension( N ). Contains the permutation that 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. do not skip that step, it's giving "I forgot the offset" energy and that's a whole mess ๐ญPERMโ INTEGER array, dimension( N ). The permutations (from deflation and sorting, yes both) 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. it's literally just counting the rotations, no cap ๐GIVCOLโ 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โ INTEGER. The leading dimension ofGIVCOL, and it must be at leastN. no exceptions bestie.GIVNUMโ REAL array, 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. same rules, same energy ๐Cโ REAL.Ccontains garbage ifSQRE = 0, and the C-value of a Givens rotation related to the right null space ifSQRE = 1. yes, literal garbage, don't go reading it ๐Sโ REAL.Scontains garbage ifSQRE = 0, and the S-value of a Givens rotation related to the right null space ifSQRE = 1. twin ofC, same warning ๐INFOโ INTEGER. the vibe check on how it all went:= 0: successful exit. slay.< 0: ifINFO = -i, the i-th argument had an illegal value. somebody passed something illegal, rude.
๐ธ 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. it's giving "I do one very specific thing and I do it flawlessly" ๐
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. family tree moment ๐ณ
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. the full package, periodt โจ
Kโ INTEGER. The number of terms in the rational function to be solved bySLASD4. Constraint:K >= 1.Dโ REAL array, dimension( K ). On output,Dcontains the updated singular values. glow-up complete ๐Zโ REAL array, dimension( K ). On entry, the firstKelements of this array contain the components of the deflation-adjusted updating row vector. On exit,Zis updated.VFโ REAL array, 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โ REAL array, 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.VF's sibling, obviously ๐ฆDIFLโ REAL array, dimension( K ). On exit,DIFL(I) = D(I) - DSIGMA(I). math is math, bestie.DIFRโ REAL 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 โ so don't come for it, it simply does not exist ๐
If ICOMPQ = 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โ REAL array, 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. very slightly. like a whisper of change ๐ธWORKโ REAL array, 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. ๐ญ it tried, it really did.
๐ธ 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. main character algorithm energy fr 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. cousins โจ
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. the little leaves of the 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โ REAL array, dimension( N ). On entryDcontains the main diagonal of the bidiagonal matrix. On exitD, ifINFO = 0, contains its singular values.Eโ REAL array, dimension( M-1 ). Contains the subdiagonal entries of the bidiagonal matrix. On exit,Ehas been destroyed. ๐ it served its purpose and then it was gone, no cap.Uโ REAL array, 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. one dimension to rule them all ๐VTโ REAL array, 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. note the transpose, bestie, don't let it sneak past you ๐ฆKโ INTEGER array, 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โ REAL array, dimension( LDU, NLVL ), whereNLVL = floor(log_2 (N/SMLSIZ))).DIFRDIFRโ a REAL array, dimension( LDU, 2 * NLVL )ifICOMPQ = 1and dimension( N )ifICOMPQ = 0. IfICOMPQ = 1, then on exit,DIFL(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 )contains the normalizing factors for the right singular vector matrix. SeeSLASD8for details, bestie. ๐Zโ a REAL array, dimension( LDU, NLVL )ifICOMPQ = 1and 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โ a REAL array, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0(she is simply not invited ๐ ). IfICOMPQ = 1, 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โ an INTEGER array, dimension( N )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,GIVPTR( I )records the number of Givens rotations performed on the I-th problem on the computation tree. ๐GIVCOLโ an INTEGER array, dimension( LDGCOL, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for eachI,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โ an INTEGER, and literally:LDGCOL = > N.The leading dimension of arraysGIVCOLandPERM. (Yeah, that's how it's written in the source, no cap โ we're just the messengers ๐ซถ)PERMโ an INTEGER array, dimension( LDGCOL, NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit,PERM(1, I)records permutations done on the I-th level of the computation tree.GIVNUMโ a REAL array, dimension( LDU, 2 * NLVL )ifICOMPQ = 1, and not referenced ifICOMPQ = 0. IfICOMPQ = 1, on exit, for eachI,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โ a REAL array, dimension( N )ifICOMPQ = 1, and dimension1ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, on exit,C( I )contains the C-value of a Givens rotation related to the right null space of the I-th subproblem.Sโ a REAL array, dimension( N )ifICOMPQ = 1, and dimension1ifICOMPQ = 0. IfICOMPQ = 1and the I-th subproblem is not square, on exit,S( I )contains the S-value of a Givens rotation related to the right null space of the I-th subproblem.WORKโ a REAL array, dimension(6 * N + (SMLSIZ + 1)*(SMLSIZ + 1)). That's the workspace, and yes, those parentheses are doing important work. ๐งฎIWORKโ an INTEGER array, dimension(7*N).INFOโ an INTEGER, and it's the vibe check at the end:= 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. ๐
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 or not.UPLO = 'U'or'u'โBis upper bidiagonal.UPLO = 'L'or'l'โBis lower bidiagonal.
SQREโSQREis INTEGER.= 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'. (spelledUPLUright there in the original โ iconic typo behavior, we keep it ๐)
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 least0.NCVTโNCVTis INTEGER. On entry,NCVTspecifies the number of columns of the matrixVT.NCVTmust be at least0.NRUโNRUis INTEGER. On entry,NRUspecifies the number of rows of the matrixU.NRUmust be at least0.NCCโNCCis INTEGER. On entry,NCCspecifies the number of columns of the matrixC.NCCmust be at least0.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. 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โVTis a REAL array, 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โLDVTis INTEGER. On entry,LDVTspecifies the leading dimension ofVTas declared in the calling (sub) program.LDVTmust be at least1. IfNCVTis nonzeroLDVTmust also be at leastN.UโUis a REAL array, 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โ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, contains anN-by-NCCmatrix which on exit has been premultiplied byQ**T, dimensionN-by-NCCifSQRE = 0and(N+1)-by-NCCifSQRE = 1(not referenced ifNCC=0).LDCโLDCis INTEGER. On entry,LDCspecifies the leading dimension ofCas declared in the calling (sub) program.LDCmust be at least1. 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 least2.INFOโINFOis INTEGER. 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 slasdt ๐
subroutine slasdt (integer N, integer LVL, integer ND, integer, dimension( *
) INODE, integer, dimension( * ) NDIML, integer, dimension( * ) NDIMR,
integer MSUB)
SLASDT 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. ๐ณ
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.MSUBMSUBisINTEGERโ on entry, this is the maximum row dimension that each subproblem at the bottom of the tree is allowed to be ๐ณ it's giving "size cap for the lil baby subproblems at the leaves" and honestly? iconic.
๐ธ 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
subroutine slaset (character UPLO, integer M, integer N, real ALPHA, real BETA, real, dimension( lda, * ) A, integer LDA)
Bestie, SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to values you pick. It's the "fill it in for me" queen ๐
โจ Purpose
SLASET initializes an m-by-n matrix A to BETA on the diagonal and
ALPHA on the offdiagonals.
๐ Parameters
UPLOisCHARACTER*1โ tells you which chunk of matrix A is getting set ๐ฆ= 'U': the upper triangular part is set; the strictly lower triangular part of A is not changed (hands off ๐ )= 'L': the lower triangular part is set; the strictly upper triangular part of A is not changed- Otherwise: all of the matrix A is set โ every last crumb
MisINTEGERโ the number of rows of the matrix A.M >= 0.NisINTEGERโ the number of columns of the matrix A.N >= 0.ALPHAisREALโ the constant that the offdiagonal elements get set to.BETAisREALโ the constant that the diagonal elements get set to.AisREAL array, dimension (LDA,N)โ on exit, the leading m-by-n submatrix of A is 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).
LDAisINTEGERโ the leading dimension of the array A.LDA >= max(1,M).
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ง subroutine slasr
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 ๐ it's literally rotating, bestie.
โจ 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. The rotations are performed without ever forming P(k) explicitly โ efficient queen behavior, no cap ๐
๐ Parameters
SIDEisCHARACTER*1โ specifies whether the plane rotation matrix P is applied to A on the left or the right ๐ซถ= 'L': Left, computeA := P*A= 'R': Right, computeA:= A*P**T
PIVOTisCHARACTER*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)
DIRECTisCHARACTER*1โ specifies whether P is a forward or backward sequence of plane rotations ๐ฆMisINTEGERโ the number of rows of the matrix A. Ifm <= 1, an immediate return is effected. (yeah it just dips out, respect ๐ซก)NisINTEGERโ the number of columns of the matrix A. Ifn <= 1, an immediate return is effected.CisREAL array, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
The cosines c(k) of the plane rotations.
SisREAL array, dimension
(M-1) if SIDE = 'L'
(N-1) if SIDE = 'R'
The sines s(k) of the plane rotations. 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) ).
AisREAL array, dimension (LDA,N)โ the M-by-N matrix A. On exit, A is overwritten byP*AifSIDE = 'R'or byA*P**TifSIDE = 'L'.LDAisINTEGERโ the leading dimension of the array A.LDA >= max(1,M).
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ซ subroutine slasv2
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 ๐บ teeny tiny matrix, absolutely huge energy.
โจ 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
FisREALโ the (1,1) element of the 2-by-2 matrix.GisREALโ the (1,2) element of the 2-by-2 matrix.HisREALโ the (2,2) element of the 2-by-2 matrix.SSMINisREALโabs(SSMIN)is the smaller singular value.SSMAXisREALโabs(SSMAX)is the larger singular value.SNLisREALCSLisREALโ the vector(CSL, SNL)is a unit left singular vector for the singular valueabs(SSMAX).SNRisREALCSRisREALโ 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. (chaotic? yes. allowed? also yes ๐ )
- 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
subroutine xerbla (character*(*) SRNAME, integer INFO)
XERBLA
โจ Purpose
XERBLA is an error handler for the LAPACK routines.
It is called by an LAPACK routine if an input parameter has an invalid value. A message is printed and execution stops. ๐ญ
Installers may consider modifying the STOP statement in order to call system-specific exception-handling facilities.
๐ Parameters
SRNAME
SRNAMEisCHARACTER*(*)โ the name of the routine which calledXERBLA. ๐INFOisINTEGERโ 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 (character(1), dimension(srname_len) SRNAME_ARRAY,
integer SRNAME_LEN, integer INFO)
XERBLA_ARRAY ๐
Purpose:
XERBLA_ARRAY assists other languages in calling XERBLA, the LAPACK and BLAS error handler. No cap, it's the ultimate translator bestie. Rather than taking a Fortran string argument as the function's name, XERBLA_ARRAY takes an array of single characters along with the array's length. XERBLA_ARRAY then copies up to 32 characters of that array into a Fortran string and passes that to XERBLA. If called with a non-positive SRNAME_LEN, XERBLA_ARRAY will call XERBLA with a string of all blank characters. ๐
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. ๐ซถ
Parameters ๐
SRNAME_ARRAYisCHARACTER(1)array, dimension (SRNAME_LEN) โ the name of the routine which calledXERBLA_ARRAY. ๐ฆSRNAME_LENisINTEGERโ the length of the name inSRNAME_ARRAY. ๐INFOisINTEGERโ 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.
And that's a wrap! ๐ฌ This page isOTHERauxiliary(3), version3.10.0, datedWed Jan 12 2022. Stay slaying, bestie! ๐ โจ
๐ฆ where this page comes from
- ubuntu jammy: liblapack-doc 3.10.0-2ubuntu1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms