doubleOTHERauxiliary(3)
🌸 doubleOTHERauxiliary(3) — LAPACK auxiliary, bestie edition 🌸
okay so real talk: this is the man page for doubleOTHERauxiliary from LAPACK, section 3 of the manual. Yes the name is giving "we named it at 3am", no we are not changing it, it's iconic.
✨ NAME ✨
doubleOTHERauxiliary — double 💅
That's it. That's the whole one-liner. Short, sweet, mysterious, main character energy 🎀. This is a LAPACK auxiliary routine, so it's one of the little helper besties the big decomposition girlies call behind the scenes. iykyk 🦋
lowkey don't panic, bestie — this page comes in 27 parts and this is only part 1. More is coming, so stay perched 🫶
✨ SYNOPSIS ✨
🌸 Functions 🌸
subroutine clatrs3 (UPLO, TRANS, DIAG, NORMIN, N, NRHS, A, LDA, X, LDX, SCALE, CNORM, WORK, LWORK, INFO)— solves a triangular system of equations with the scale factors set to prevent overflow. no cap, it's giving safety first 💅subroutine dlabrd (M, N, NB, A, LDA, D, E, TAUQ, TAUP, X, LDX, Y, LDY)— reduces the first nb rows and columns of a general matrix to a bidiagonal form. iconic reduction behavior ✨subroutine dlacn2 (N, V, X, ISGN, EST, KASE, ISAVE)— estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vector products. reverse communication queen 👑subroutine dlacon (N, V, X, ISGN, EST, KASE)— estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vector products. same energy, different name, still iconic 💖subroutine dladiv (A, B, C, D, P, Q)— performs complex division in real arithmetic, avoiding unnecessary overflow. literally avoiding overflow, bestie 🫶subroutine dladiv1 (A, B, C, D, P, Q)— (no description in the original, bestie — it's just there, mysterious and unbothered 💀)double precision function dladiv2 (A, B, C, D, R, T)— (also no description in the original; it's giving quiet luxury 🙈)subroutine dlaein (RIGHTV, NOINIT, N, H, LDH, WR, WI, VR, VI, B, LDB, WORK, EPS3, SMLNUM, BIGNUM, INFO)— computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iteration. eigenvector slay 💖subroutine dlaexc (WANTQ, N, T, LDT, Q, LDQ, J1, N1, N2, WORK, INFO)— swaps adjacent diagonal blocks of a real upper quasi-triangular matrix in Schur canonical form, by an orthogonal similarity transformation. swapping blocks, periodt 🔥subroutine dlag2 (A, LDA, B, LDB, SAFMIN, SCALE1, SCALE2, WR1, WR2, WI)— computes the eigenvalues of a 2-by-2 generalized eigenvalue problem, with scaling as necessary to avoid over-/underflow. scaling? we love to see it ✨subroutine dlag2s (M, N, A, LDA, SA, LDSA, INFO)— converts a double precision matrix to a single precision matrix. downgrade but make it fashion 💅subroutine dlags2 (UPPER, A1, A2, A3, B1, B2, B3, CSU, SNU, CSV, SNV, CSQ, SNQ)— computes 2-by-2 orthogonal matrices U, V, and Q, and applies them to matrices A and B such that the rows of the transformed A and B are parallel. parallel rows, parallel vibes 🌈subroutine dlagtm (TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA, B, LDB)— performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix, B and C are rectangular matrices, and α and β are scalars, which may be 0, 1, or -1. scalars can be 0, 1, or -1 — keep it exact bestie ⭐subroutine dlagv2 (A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL, CSR, SNR)— computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular. pencil? more like pen-slay ✏️subroutine dlahqr (WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ILOZ, IHIZ, Z, LDZ, INFO)— computes the eigenvalues and Schur factorization of an upper Hessenberg matrix, using the double-shift/single-shift QR algorithm. double-shift/single-shift, the way that it shifts 😭subroutine dlahr2 (N, K, NB, A, LDA, TAU, T, LDT, Y, LDY)— reduces the specified number of first columns of a general rectangular matrix A so that elements below the specified subdiagonal are zero, and returns auxiliary matrices which are needed to apply the transformation to the unreduced part of A. auxiliary matrices? we got you 🫶subroutine dlaic1 (JOB, J, X, SEST, W, GAMMA, SESTPR, S, C)— applies one step of incremental condition estimation. one step at a time, main character energy 👑subroutine dlaln2 (LTRANS, NA, NW, SMIN, CA, A, LDA, D1, D2, B, LDB, WR, WI, X, LDX, SCALE, XNORM, INFO)— solves a 1-by-1 or 2-by-2 linear system of equations of the specified form. tiny systems, big slay 💅double precision function dlangt (NORM, N, DL, D, DU)— returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a general tridiagonal matrix. norms on norms on norms ✨double precision function dlanhs (NORM, N, A, LDA, WORK)— returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of an upper Hessenberg matrix. upper Hessenberg norm energy 🌸double precision function dlansb (NORM, UPLO, N, K, AB, LDAB, WORK)— returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix. symmetric band matrix? periodt 💖double precision function dlansp (NORM, UPLO, N, AP, WORK)— returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form. packed form, packed with slay 🎀double precision function dlantb (NORM, UPLO, DIAG, N, K, AB, LDAB, WORK)— returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix. triangular band, we love a structured moment 🦋double precision function dlantp (NORM, UPLO, DIAG, N, AP, WORK)— returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular matrix supplied in packed form. packed triangular, iconic 💅double precision function dlantr (NORM, UPLO, DIAG, M, N, A, LDA, WORK)— returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a trapezoidal or triangular matrix. trapezoidal or triangular — either way, normed 💜subroutine dlanv2 (A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN)— computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form. nonsymmetric but still getting Schur factorization, periodt 🔥subroutine dlapll (N, X, INCX, Y, INCY, SSMIN)— measures the linear dependence of two vectors. are they dependent? let's measure the drama 💀subroutine dlapmr (FORWRD, M, N, X, LDX, K)— rearranges rows of a matrix as specified by a permutation vector. rows getting rearranged, no cap ✨subroutine dlapmt (FORWRD, M, N, X, LDX, K)— performs a forward or backward permutation of the columns of a matrix. columns are moving, forward or backward 💅subroutine dlaqp2 (M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2, WORK)— computes a QR factorization with column pivoting of the matrix block. QR with pivoting, the way that it factors 😭subroutine dlaqps (M, N, OFFSET, NB, KB, A, LDA, JPVT, TAU, VN1, VN2, AUXV, F, LDF)— computes a step of QR factorization with column pivoting of a real m-by-n matrix A by using BLAS level 3. BLAS level 3, highkey efficient 🔥subroutine dlaqr0 (WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO)— computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition. optionally Schur, optionally iconic ✨subroutine dlaqr1 (N, H, LDH, SR1, SI1, SR2, SI2, V)— sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and specified shifts. scalar multiple, specified shifts, very demure 💅subroutine dlaqr2 (WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ, IHIZ, Z, LDZ, NS, ND, SR, SI, V, LDV, NH, T, LDT, NV, WV, LDWV, WORK, LWORK)— performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate fully converged eigenvalues from a trailing principal submatrix (aggressive early deflation). aggressive early deflation? she's aggressive, she's early, she's deflating 💅subroutine dlaqr3 (WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ, IHIZ, Z, LDZ, NS, ND, SR, SI, V, LDV, NH, T, LDT, NV, WV, LDWV, WORK, LWORK)— performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate fully converged eigenvalues from a trailing principal submatrix (aggressive early deflation). same aggressive early deflation energy, different number 👑subroutine dlaqr4 (WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO)— computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition. Schur decomposition optional, slay mandatory ✨subroutine dlaqr5 (WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, SR, SI, H, LDH, ILOZ, IHIZ, Z, LDZ, V, LDV, U, LDU, NV, WV, LDWV, NH, WH, LDWH)— performs a single small-bulge multi-shift QR sweep. small-bulge multi-shift QR sweep, say that five times fast 😭subroutine dlaqsb (UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, EQUED)— scales a symmetric/Hermitian band matrix, using scaling factors computed by spbequ. scaling factors from spbequ, no cap 🫶subroutine dlaqsp (UPLO, N, AP, S, SCOND, AMAX, EQUED)— scales a symmetric/Hermitian matrix in packed storage, using scaling factors computed by sppequ. sppequ said here are the scaling factors, bestie ✨subroutine dlaqtr (LTRAN, LREAL, N, T, LDT, B, W, SCALE, X, WORK, INFO)— solves a real quasi-triangular system of equations, or a complex quasi-triangular system of special form, in real arithmetic. real arithmetic, complex special form, we contain multitudes 🌈subroutine dlar1v (N, B1, BN, LAMBDA, D, L, LD, LLD, PIVMIN, GAPTOL, Z, WANTNC, NEGCNT, ZTZ, MINGMA, R, ISUPPZ, NRMINV, RESID, RQCORR, WORK)— computes the (scaled) r-th column of the inverse of the submatrix in rows b1 through bn of the tridiagonal matrix LDLT - λI. LDLT - λI, the math is mathing 💅subroutine dlar2v (N, X, Y, Z, INCX, C, S, INCC)— applies a vector of plane rotations with real cosines and real sines from both sides to a sequence of 2-by-2 symmetric/Hermitian matrices. plane rotations from both sides, symmetric/Hermitian, periodt 💖subroutine dlarf (SIDE, M, N, V, INCV, TAU, C, LDC, WORK)— applies an elementary reflector to a general rectangular matrix. elementary reflector, elementary slay ✨subroutine dlarfb (SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, T, LDT, C, LDC, WORK, LDWORK)— applies a block reflector or its transpose to a general rectangular matrix. block reflector or its transpose — either way, applied 💅subroutine dlarfb_gett (IDENT, M, N, K, T, LDT, A, LDA, B, LDB, WORK, LDWORK)— DLARFB_GETT (that's the whole description in the original, bestie — minimalism is a vibe 💀)subroutine dlarfg (N, ALPHA, X, INCX, TAU)— generates an elementary reflector (Householder matrix). Householder matrix, iconic name, iconic reflector 👑subroutine dlarfgp (N, ALPHA, X, INCX, TAU)— generates an elementary reflector (Householder matrix) with non-negative beta. non-negative beta, we love a positive-ish vibe ✨subroutine dlarft (DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT)— forms the triangular factor T of a block reflector H = I - vtvH. forming T, forming the triangular factor, forming the vibe 🫶subroutine dlarfx (SIDE, M, N, V, TAU, C, LDC, WORK)— applies an elementary reflector to a general rectangular matrix, with loop unrolling when the reflector has order ≤ 10. order ≤ 10? loop unrolling activated 💅subroutine dlarfy (UPLO, N, V, INCV, TAU, C, LDC, WORK)— DLARFY (again, that's the whole description in the original — mysterious queen 🙈)subroutine dlargv (N, X, INCX, Y, INCY, C, INCC)— generates a vector of plane rotations with real cosines and real sines. plane rotations, real cosines, real sines, real slay 🌸subroutine dlarrv (N, VL, VU, D, L, PIVMIN, ISPLIT, M, DOL, DOU, MINRGP, RTOL1, RTOL2, W, WERR, WGAP, IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, WORK, IWORK, INFO)— computes the eigenvectors of the tridiagonal matrix T = L D LT given L, D and the eigenvalues of L D LT. eigenvectors from L D LT, no cap 💜subroutine dlartv (N, X, INCX, Y, INCY, C, S, INCC)— applies a vector of plane rotations with real cosines and real sines to the elements of a pair of vectors. pair of vectors getting rotated, periodt 🔥subroutine dlaswp (N, A, LDA, K1, K2, IPIV, INCX)— performs a series of row interchanges on a general rectangular matrix. row interchanges, series of them, we love a swap 💅subroutine dlat2s (UPLO, N, A, LDA, SA, LDSA, INFO)— converts a double-precision triangular matrix to a single-precision triangular matrix. double to single, precision downgrade but make it triangular ✨subroutine dlatbs (UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X, SCALE, CNORM, INFO)— solves a triangular banded system of equations. triangular banded system, solved. periodt 💖subroutine dlatdf (IJOB, N, Z, LDZ, RHS, RDSUM, RDSCAL, IPIV, JPIV)— DLATDF uses the LU factorization of the n-by-n matrix computed bysgetc2and computes a contribution to the reciprocal Dif-estimate. 💅subroutine dlatps (UPLO, TRANS, DIAG, NORMIN, N, AP, X, SCALE, CNORM, INFO)— DLATPS solves a triangular system of equations with the matrix held in packed storage. ✨subroutine dlatrd (UPLO, N, NB, A, LDA, E, TAU, W, LDW)— DLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal form by an orthogonal similarity transformation. 🌸subroutine dlatrs (UPLO, TRANS, DIAG, NORMIN, N, A, LDA, X, SCALE, CNORM, INFO)— DLATRS solves a triangular system of equations with the scale factor set to prevent overflow. 🔥subroutine dlatrs3 (UPLO, TRANS, DIAG, NORMIN, N, NRHS, A, LDA, X, LDX, SCALE, CNORM, WORK, LWORK, INFO)— DLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow. 💖subroutine dlauu2 (UPLO, N, A, LDA, INFO)— DLAUU2 computes the product UUH or LHL, where U and L are upper or lower triangular matrices (unblocked algorithm). 🎀subroutine dlauum (UPLO, N, A, LDA, INFO)— DLAUUM computes the product UUH or LHL, where U and L are upper or lower triangular matrices (blocked algorithm). 🦋subroutine drscl (N, SA, SX, INCX)— DRSCL multiplies a vector by the reciprocal of a real scalar. 💫subroutine dtprfb (SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK)— DTPRFB applies a real 'triangular-pentagonal' block reflector to a real matrix, which is composed of two blocks. 🌈subroutine slatrd (UPLO, N, NB, A, LDA, E, TAU, W, LDW)— SLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal form by an orthogonal similarity transformation. 👑subroutine slatrs3 (UPLO, TRANS, DIAG, NORMIN, N, NRHS, A, LDA, X, LDX, SCALE, CNORM, WORK, LWORK, INFO)— SLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow. ⭐subroutine zlatrs3 (UPLO, TRANS, DIAG, NORMIN, N, NRHS, A, LDA, X, LDX, SCALE, CNORM, WORK, LWORK, INFO)— ZLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow. 💜
Detailed Description 💖
This is the group of double other auxiliary routines — the double-precision backstage besties that keep your matrix math from falling apart. 💅
Function Documentation ✨
subroutine clatrs3
subroutine clatrs3 (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, integer NRHS, complex, dimension( lda, * )
A, integer LDA, complex, dimension( ldx, * ) X, integer LDX, real,
dimension( * ) SCALE, real, dimension( * ) CNORM, real, dimension( * )
WORK, integer LWORK, integer INFO)
CLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow.
Purpose:
CLATRS3 solves one of the triangular systems
A * X = B * diag(scale), A**T * X = B * diag(scale), or
A**H * X = B * diag(scale)
with scaling to prevent overflow. Here A is an upper or lower triangular matrix, A**T denotes the transpose of A, A**H denotes the conjugate transpose of A. X and B are n-by-nrhs matrices and scale is an nrhs-element vector of scaling factors. A scaling factor scale(j) is usually less than or equal to 1, chosen such that X(:,j) is less than the overflow threshold. If the matrix A is singular (A(j,j) = 0 for some j), then a non-trivial solution to A*X = 0 is returned. If the system is so badly scaled that the solution cannot be represented as (1/scale(k))*X(:,k), then x(:,k) = 0 and scale(k) is returned.
This is a BLAS-3 version of LATRS for solving several right hand sides simultaneously.
Parameters
UPLO—UPLOisCHARACTER*1. Specifies whether the matrix A is upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—TRANSisCHARACTER*1. Specifies the operation applied to A.= 'N': Solve A * x = s*b (No transpose)= 'T': Solve A**T* x = s*b (Transpose)= 'C': Solve A**T* x = s*b (Conjugate transpose)
DIAG—DIAGisCHARACTER*1. Specifies whether or not the matrix A is unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—NORMINisCHARACTER*1. Specifies whetherCNORMhas been set or not.= 'Y': CNORM contains the column norms on entry= 'N': CNORM is not set on entry. On exit, the norms will be computed and stored in CNORM.
N—NisINTEGER. The order of the matrix A.N >= 0.NRHS—NRHSisINTEGER. The number of columns of X.NRHS >= 0.A—AisCOMPLEXarray, dimension(LDA,N). The triangular matrix A. IfUPLO = 'U', the leading n by n upper triangular part of the array A contains the upper triangular matrix, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading n by n lower triangular part of the array A contains the lower triangular matrix, and the strictly upper triangular part of A is not referenced. IfDIAG = 'U', the diagonal elements of A are also not referenced and are assumed to be 1.LDA—LDAisINTEGER. The leading dimension of the array A.LDA >= max (1,N).X—XisCOMPLEXarray, dimension(LDX,NRHS). On entry, the right hand side B of the triangular system. On exit, X is overwritten by the solution matrix X.LDX—LDXisINTEGER. The leading dimension of the array X.LDX >= max (1,N).SCALE—SCALEisREALarray, dimension(NRHS). The scaling factors(k)is for the triangular systemA * x(:,k) = s(k)*b(:,k)orA**T* x(:,k) = s(k)*b(:,k). IfSCALE = 0, the matrix A is singular or badly scaled. IfA(j,j) = 0is encountered, a non-trivial vectorx(:,k)that is an exact or approximate solution toA*x(:,k) = 0is returned. If the system so badly scaled that solution cannot be presented asx(:,k) * 1/s(k), thenx(:,k) = 0is returned.CNORM—CNORMisREALarray, dimension(N).- If
NORMIN = 'Y',CNORMis an input argument andCNORM(j)contains the norm of the off-diagonal part of the j-th column of A. IfTRANS = 'N',CNORM(j)must be greater than or equal to the infinity-norm, and ifTRANS = 'T'or'C',CNORM(j)must be greater than or equal to the 1-norm. - If
NORMIN = 'N',CNORMis an output argument andCNORM(j)returns the 1-norm of the offdiagonal part of the j-th column of A.
- If
WORK—WORKisREALarray, dimension(LWORK). On exit, ifINFO = 0,WORK(1)returns the optimal size ofWORK.LWORK—LWORKisINTEGERLWORK >= MAX(1, 2*NBA * MAX(NBA, MIN(NRHS, 32)), where NBA = (N + NB - 1)/NB and NB is the optimal block size.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal dimensions of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
Parameters
INFO—INFOisINTEGER.= 0: successful exit< 0: if INFO = -k, the k-th argument had an illegal value
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
subroutine dlabrd
subroutine dlabrd (integer M, integer N, integer NB, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( * ) D,
double precision, dimension( * ) E, double precision, dimension( * )
TAUQ, double precision, dimension( * ) TAUP, double precision,
dimension( ldx, * ) X, integer LDX, double precision, dimension( ldy, *
) Y, integer LDY)
DLABRD reduces the first nb rows and columns of a general matrix to a bidiagonal form.
Purpose:
DLABRD reduces the first NB rows and columns of a real general m by n matrix A to upper or lower bidiagonal form by an orthogonal transformation Q**T * A * P, and returns the matrices X and Y which are needed to apply the transformation to the unreduced part of A.
If m >= n, A is reduced to upper bidiagonal form; if m < n, to lower bidiagonal form.
This is an auxiliary routine called by DGEBRD.
Parameters
M—MisINTEGER. The number of rows in the matrix A.N—NisINTEGER. The number of columns in the matrix A.NB—NBisINTEGER. The number of leading rows and columns of A to be reduced.A—AisDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the m by n general matrix to be reduced. On exit, the first NB rows and columns of the matrix are overwritten; the rest of the array is unchanged.- If
m >= n, elements on and below the diagonal in the first NB columns, with the arrayTAUQ, represent the orthogonal matrix Q as a product of elementary reflectors; and elements above the diagonal in the first NB rows, with the arrayTAUP, represent the orthogonal matrix P as a product of elementary reflectors. - If
m < n, elements below the diagonal in the first NB columns, with the arrayTAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and elements on and above the diagonal in the first NB rows, with the arrayTAUP, represent the orthogonal matrix P as a product of elementary reflectors. - See Further Details.
- If
LDA—LDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).D—DisDOUBLE PRECISIONarray, dimension(NB). The diagonal elements of the first NB rows and columns of the reduced matrix.D(i) = A(i,i).E— a DOUBLE PRECISION array, dimension(NB). These are the off-diagonal elements of the firstNBrows and columns of the reduced matrix. she's carrying the tea that lives just off the diagonal 💅TAUQ— a DOUBLE PRECISION array, dimension(NB). The scalar factors of the elementary reflectors that represent the orthogonal matrixQ. (Scroll down to Further Details, bestie, it's all there 🦋)TAUP— a DOUBLE PRECISION array, dimension(NB). The scalar factors of the elementary reflectors that represent the orthogonal matrixP. Same deal, see Further Details ✨X— a DOUBLE PRECISION array, dimension(LDX,NB). It's them-by-nbmatrixXthat you need to update the unreduced part ofA. literally her whole job 🌸LDX— an INTEGER. The leading dimension of the arrayX.LDX >= max(1,M). respect the bounds or perish 💀Y— a DOUBLE PRECISION array, dimension(LDY,NB). It's then-by-nbmatrixYthat you need to update the unreduced part ofA. twin ofX, same energy 🫶LDY— an INTEGER. The leading dimension of the arrayY.LDY >= max(1,N). no cap 📏
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
📚 Further Details:
okay so the matrices Q and P are represented as products of elementary reflectors:
Q = H(1) H(2) . . . H(nb) and P = G(1) G(2) . . . G(nb)
and every single H(i) and G(i) has this form:
H(i) = I - tauq * v * v**T and G(i) = I - taup * u * u**T
where tauq and taup are real scalars, and v and u are real vectors. iconic behavior fr fr 💜
If m >= n, then v(1:i-1) = 0, v(i) = 1, and v(i:m) is stored on exit in A(i:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+1:n) is stored on exit in A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
If m < n, then v(1:i) = 0, v(i+1) = 1, and v(i+1:m) is stored on exit in A(i+2:m,i); u(1:i-1) = 0, u(i) = 1, and u(i:n) is stored on exit in A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
The elements of the vectors v and u together form the m-by-nb matrix V and the nb-by-n matrix U**T, which are needed — together with X and Y — to apply the transformation to the unreduced part of the matrix, using a block update of the form:
A := A - V*Y**T - X*U**T.
The contents of A on exit are illustrated by the following examples with nb = 2:
m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n):
( 1 1 u1 u1 u1 ) ( 1 u1 u1 u1 u1 u1 )
( v1 1 1 u2 u2 ) ( 1 1 u2 u2 u2 u2 )
( v1 v2 a a a ) ( v1 1 a a a a )
( v1 v2 a a a ) ( v1 v2 a a a a )
( v1 v2 a a a ) ( v1 v2 a a a a )
( v1 v2 a a a )
where a denotes an element of the original matrix which is unchanged, vi denotes an element of the vector defining H(i), and ui an element of the vector defining G(i). so a is the chill one who didn't get touched ✨
🌈 subroutine dlacn2 (integer N, double precision, dimension( * ) V, double precision, dimension( * ) X, integer, dimension( * ) ISGN, double precision EST, integer KASE, integer, dimension( 3 ) ISAVE)
DLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vector products. she's a little indirect about it but she gets there 💅
🎯 Purpose:
DLACN2 estimates the 1-norm of a square, real matrix A. Reverse communication is used for evaluating matrix-vector products.
🧾 Parameters
N—Nis INTEGER. The order of the matrix.N >= 1. periodt ✋V—Vis a DOUBLE PRECISION array, dimension(N). On the final return,V = A*W, whereEST = norm(V)/norm(W)(andWis not returned — she left the group chat, you'll never see her 😭).X—Xis a DOUBLE PRECISION array, dimension(N). On an intermediate return,Xshould be overwritten by
A * X, if KASE=1,
A**T * X, if KASE=2,
and DLACN2 must be re-called with all the other parameters unchanged. don't go changing things behind her back 🫶
ISGN—ISGNis an INTEGER array, dimension(N).EST—ESTis DOUBLE PRECISION. On entry withKASE = 1or2andISAVE(1) = 3,ESTshould be unchanged from the previous call to DLACN2. On exit,ESTis an estimate (a lower bound) fornorm(A).KASE—KASEis INTEGER. On the initial call to DLACN2,KASEshould be0. On an intermediate return,KASEwill be1or2, indicating whetherXshould be overwritten byA * XorA**T * X. On the final return from DLACN2,KASEwill again be0. it's giving boomerang 🪃ISAVE—ISAVEis an INTEGER array, dimension(3).ISAVEis used to save variables between calls to DLACN2.
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
📚 Further Details:
Originally named SONEST, dated March 16, 1988. a vintage icon, honestly 👑
This is the thread safe version of DLACON, which uses the array ISAVE in place of a SAVE statement, as follows:
DLACON DLACN2
JUMP ISAVE(1)
J ISAVE(2)
ITER ISAVE(3)
🫶 Contributors:
- Nick Higham, University of Manchester
📖 References:
N.J. Higham, 'FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation', ACM Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, December 1988.
🌈 subroutine dlacon (integer N, double precision, dimension( * ) V, double precision, dimension( * ) X, integer, dimension( * ) ISGN, double precision EST, integer KASE)
DLACON estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vector products. the OG version of the vibe 🦋
🎯 Purpose:
DLACON estimates the 1-norm of a square, real matrix A. Reverse communication is used for evaluating matrix-vector products.
🧾 Parameters
N—Nis INTEGER. The order of the matrix.N >= 1.V—Vis a DOUBLE PRECISION array, dimension(N). On the final return,V = A*W, whereEST = norm(V)/norm(W)(Wis not returned). gone but not forgotten 💔X—Xis a DOUBLE PRECISION array, dimension(N). On an intermediate return,Xshould be overwritten by
A * X, if KASE=1,
A**T * X, if KASE=2,
and DLACON must be re-called with all the other parameters unchanged.
ISGN—ISGNis an INTEGER array, dimension(N).EST—ESTis DOUBLE PRECISION. On entry withKASE = 1or2andJUMP = 3,ESTshould be unchanged from the previous call to DLACON. On exit,ESTis an estimate (a lower bound) fornorm(A).KASE—KASEis INTEGER. On the initial call to DLACON,KASEshould be0. On an intermediate return,KASEwill be1or2, indicating whetherXshould be overwritten byA * XorA**T * X. On the final return from DLACON,KASEwill again be0.
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🫶 Contributors:
- Nick Higham, University of Manchester.
- Originally named SONEST, dated March 16, 1988.
📖 References:
N.J. Higham, 'FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation', ACM Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, December 1988.
🌈 subroutine dladiv (double precision A, double precision B, double precision C, double precision D, double precision P, double precision Q)
DLADIV performs complex division in real arithmetic, avoiding unnecessary overflow. she does the fancy math so your numbers don't explode 💥✨
🎯 Purpose:
DLADIV performs complex division in real arithmetic
a + i*b
p + i*q = ---------
c + i*d
The algorithm is due to Michael Baudin and Robert L. Smith and can be found in the paper 'A Robust Complex Division in Scilab'. stan the researchers 🔥
🧾 Parameters
A—Ais DOUBLE PRECISION.B—Bis DOUBLE PRECISION.C—Cis DOUBLE PRECISION.D—Dis DOUBLE PRECISION. The scalarsa,b,c, anddin the above expression.P—Pis DOUBLE PRECISION.Q—Qis DOUBLE PRECISION. The scalarspandqin the above expression.
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🌈 subroutine dlaein (logical RIGHTV, logical NOINIT, integer N, double precision, dimension( ldh, * ) H, integer LDH, double precision WR, double precision WI, double precision, dimension( * ) VR, double precision, dimension( * ) VI, double precision, dimension( ldb, * ) B, integer LDB, double precision, dimension( * ) WORK, double precision EPS3, double precision SMLNUM, double precision BIGNUM, integer INFO)
DLAEIN computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iteration. main character energy, obviously 👑
🎯 Purpose:
DLAEIN uses inverse iteration to find a right or left eigenvector corresponding to the eigenvalue (WR,WI) of a real upper Hessenberg matrix H. that's the whole assignment 💅
🧾 Parameters
RIGHTV—RIGHTVis LOGICAL.
= .TRUE. : compute right eigenvector;
= .FALSE.: compute left eigenvector.
pick your side bestie, but you do have to pick 🌸
NOINIT—NOINITis LOGICAL.
= .TRUE. : no initial vector supplied in (VR,VI).
= .FALSE.: initial vector supplied in (VR,VI).
N—Nis INTEGER. The order of the matrixH.N >= 0.H—His a DOUBLE PRECISION array, dimension(LDH,N). The upper Hessenberg matrixH. her name is on the building 🏛️LDH—LDHis INTEGER. The leading dimension of the arrayH.LDH >= max(1,N).WR—WRis DOUBLE PRECISION.WI—WIis DOUBLE PRECISION. The real and imaginary parts of the eigenvalue ofHwhose corresponding right or left eigenvector is to be computed. yes you need both parts, it's a whole package 🎀VR—VRis a DOUBLE PRECISION array, dimension(N).VIVI💖 — okay so bestie, this is aDOUBLE PRECISIONarray, dimension(N). On entry, ifNOINIT = .FALSE.andWI = 0.0,VRmust contain a real starting vector for inverse iteration using the real eigenvalueWR; ifNOINIT = .FALSE.andWI.ne.0.0,VRandVImust contain the real and imaginary parts of a complex starting vector for inverse iteration using the complex eigenvalue(WR,WI); otherwiseVRandVIneed not be set. On exit, ifWI = 0.0(real eigenvalue),VRcontains the computed real eigenvector; ifWI.ne.0.0(complex eigenvalue),VRandVIcontain the real and imaginary parts of the computed complex eigenvector. The eigenvector is normalized so that the component of largest magnitude has magnitude1; here the magnitude of a complex number(x,y)is taken to be|x| + |y|.VIis not referenced ifWI = 0.0. 💅B🦋 — literally just aDOUBLE PRECISIONarray, dimension(LDB,N).LDB✨ — isINTEGER. The leading dimension of the arrayB.LDB >= N+1. no cap.WORK🎀 — is aDOUBLE PRECISIONarray, dimension(N). that's it, that's the tea.EPS3🌸 — isDOUBLE PRECISION. A small machine-dependent value which is used to perturb close eigenvalues, and to replace zero pivots. lowkey important.SMLNUM💅 — isDOUBLE PRECISION. A machine-dependent value close to the underflow threshold. underflow era.BIGNUM🫶 — isDOUBLE PRECISION. A machine-dependent value close to the overflow threshold. overflow? not today.INFO😭 — isINTEGER.= 0: successful exit= 1: inverse iteration did not converge;VRis set to the last iterate, and so isVIifWI.ne.0.0. rip.
Author 💖
Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd.
subroutine dlaexc (logical WANTQ, integer N, double precision, dimension( ldt, * ) T, integer LDT, double precision, dimension( ldq, * ) Q, integer LDQ, integer J1, integer N1, integer N2, double precision, dimension( * ) WORK, integer INFO) 🔥
okay so this one is iconic. DLAEXC swaps adjacent diagonal blocks T11 and T22 of order 1 or 2 in an upper quasi-triangular matrix T by an orthogonal similarity transformation.
Purpose ✨
DLAEXC swaps adjacent diagonal blocks T11 and T22 of order 1 or 2 in an upper quasi-triangular matrix T by an orthogonal similarity transformation. fr fr.
T must be in Schur canonical form, that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign. the way that works.
Parameters 🎀
WANTQ💅 — isLOGICAL.= .TRUE.: accumulate the transformation in the matrixQ;= .FALSE.: do not accumulate the transformation.
N🌸 — isINTEGER. The order of the matrixT.N >= 0.T🦋 — isDOUBLE PRECISIONarray, dimension(LDT,N). On entry, the upper quasi-triangular matrixT, in Schur canonical form. On exit, the updated matrixT, again in Schur canonical form. glow up.LDT✨ — isINTEGER. The leading dimension of the arrayT.LDT >= max(1,N).Q🫶 — isDOUBLE PRECISIONarray, dimension(LDQ,N). On entry, ifWANTQis.TRUE., the orthogonal matrixQ. On exit, ifWANTQis.TRUE., the updated matrixQ. IfWANTQis.FALSE.,Qis not referenced. she's not invited.LDQ💖 — isINTEGER. The leading dimension of the arrayQ.LDQ >= 1; and ifWANTQis.TRUE.,LDQ >= N.J1🔥 — isINTEGER. The index of the first row of the first blockT11.N1😭 — isINTEGER. The order of the first blockT11.N1 = 0,1or2.N2💀 — isINTEGER. The order of the second blockT22.N2 = 0,1or2.WORK🎀 — isDOUBLE PRECISIONarray, dimension(N).INFO🙈 — isINTEGER.= 0: successful exit= 1: the transformed matrixTwould be too far from Schur form; the blocks are not swapped andTandQare unchanged. oop, no swap.
Author 💖
Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd.
subroutine dlag2 (double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( ldb, * ) B, integer LDB, double precision SAFMIN, double precision SCALE1, double precision SCALE2, double precision WR1, double precision WR2, double precision WI) 🌈
DLAG2 computes the eigenvalues of a 2-by-2 generalized eigenvalue problem, with scaling as necessary to avoid over-/underflow. bestie, scaling is the moment.
Purpose ⭐
DLAG2 computes the eigenvalues of a 2 x 2 generalized eigenvalue problem A - w B, with scaling as necessary to avoid over-/underflow.
The scaling factor 's' results in a modified eigenvalue equation
s A - w B
where s is a non-negative scaling factor chosen so that w, w B, and s A do not overflow and, if possible, do not underflow, either. no cap.
Parameters 🧚
A💜 — isDOUBLE PRECISIONarray, dimension(LDA, 2). On entry, the2 x 2matrixA. It is assumed that its 1-norm is less than1/SAFMIN. Entries less thansqrt(SAFMIN)*norm(A)are subject to being treated as zero. vibe check: keep it small.LDA✨ — isINTEGER. The leading dimension of the arrayA.LDA >= 2.B🦋 — isDOUBLE PRECISIONarray, dimension(LDB, 2). On entry, the2 x 2upper triangular matrixB. It is assumed that the one-norm ofBis less than1/SAFMIN. The diagonals should be at leastsqrt(SAFMIN)times the largest element ofB(in absolute value); if a diagonal is smaller than that, then+/- sqrt(SAFMIN)will be used instead of that diagonal. she's got standards.LDB🌸 — isINTEGER. The leading dimension of the arrayB.LDB >= 2.SAFMIN🫶 — isDOUBLE PRECISION. The smallest positive number s.t.1/SAFMINdoes not overflow. (This should always beDLAMCH('S')-- it is an argument in order to avoid having to callDLAMCHfrequently.) iykyk.SCALE1💅 — isDOUBLE PRECISION. A scaling factor used to avoid over-/underflow in the eigenvalue equation which defines the first eigenvalue. If the eigenvalues are complex, then the eigenvalues are( WR1 +/- WI i ) / SCALE1(which may lie outside the exponent range of the machine),SCALE1=SCALE2, andSCALE1will always be positive. If the eigenvalues are real, then the first (real) eigenvalue isWR1 / SCALE1, but this may overflow or underflow, and in fact,SCALE1may be zero or less than the underflow threshold if the exact eigenvalue is sufficiently large. it's giving chaos.SCALE2🎀 — isDOUBLE PRECISION. A scaling factor used to avoid over-/underflow in the eigenvalue equation which defines the second eigenvalue. If the eigenvalues are complex, thenSCALE2=SCALE1. If the eigenvalues are real, then the second (real) eigenvalue isWR2 / SCALE2, but this may overflow or underflow, and in fact,SCALE2may be zero or less than the underflow threshold if the exact eigenvalue is sufficiently large.WR1🔥 — isDOUBLE PRECISION. If the eigenvalue is real, thenWR1isSCALE1times the eigenvalue closest to the(2,2)element ofA B**(-1). If the eigenvalue is complex, thenWR1=WR2isSCALE1times the real part of the eigenvalues.WR2😭 — isDOUBLE PRECISION. If the eigenvalue is real, thenWR2isSCALE2times the other eigenvalue. If the eigenvalue is complex, thenWR1=WR2isSCALE1times the real part of the eigenvalues.WI💀 — isDOUBLE PRECISION. If the eigenvalue is real, thenWIis zero. If the eigenvalue is complex, thenWIisSCALE1times the imaginary part of the eigenvalues.WIwill always be non-negative. always positive energy.
Author 💖
Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd.
subroutine dlag2s (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, real, dimension( ldsa, * ) SA, integer LDSA, integer INFO) 🌟
DLAG2S converts a double precision matrix to a single precision matrix. glow down, but make it precision.
Purpose ⭐
DLAG2S converts a DOUBLE PRECISION matrix, A, to a SINGLE PRECISION matrix, SA.
RMAX is the overflow for the SINGLE PRECISION arithmetic. DLAG2S checks that all the entries of A are between -RMAX and RMAX. If not the conversion is aborted and a flag is raised. not me getting overflow.
This is an auxiliary routine so there is no argument checking. no cap, she doesn't check.
Parameters 🧚
M💜 — isINTEGER. The number of lines of the matrixA.M >= 0.N✨ — isINTEGER. The number of columns of the matrixA.N >= 0.A🦋 — isDOUBLE PRECISIONarray, dimension(LDA,N). On entry, theM-by-Ncoefficient matrixA.LDA🌸 — isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).SA🫶 — isREALarray, dimension(LDSA,N). On exit, ifINFO=0, theM-by-Ncoefficient matrixSA; ifINFO>0, the content ofSAis unspecified. unspecified? mysterious.LDSA💅 — isINTEGER. The leading dimension of the arraySA.LDSA >= max(1,M).INFO🎀 — isINTEGER.= 0: successful exit.= 1: an entry of the matrixAis greater than theSINGLE PRECISIONoverflow threshold, in this case, the content ofSAin exit is unspecified. rip.
Author 💖
Univ. of Tennessee
🌸 subroutine dlags2 🌸
subroutine dlags2 (logical UPPER, double precision A1, double precision A2,
double precision A3, double precision B1, double precision B2, double
precision B3, double precision CSU, double precision SNU, double
precision CSV, double precision SNV, double precision CSQ, double
precision SNQ)
DLAGS2 computes 2-by-2 orthogonal matrices U, V, and Q, and applies them to matrices A and B such that the rows of the transformed A and B are parallel. 🦋
✨ Purpose ✨
okay so bestie, DLAGS2 is out here cooking up three 2-by-2 orthogonal matrices U, V and Q so that stuff lines up parallel. here's the whole vibe, verbatim, because the math is the math:
DLAGS2 computes 2-by-2 orthogonal matrices U, V and Q, such
that if ( UPPER ) then
U**T *A*Q = U**T *( A1 A2 )*Q = ( x 0 )
( 0 A3 ) ( x x )
and
V**T*B*Q = V**T *( B1 B2 )*Q = ( x 0 )
( 0 B3 ) ( x x )
or if ( .NOT.UPPER ) then
U**T *A*Q = U**T *( A1 0 )*Q = ( x x )
( A2 A3 ) ( 0 x )
and
V**T*B*Q = V**T*( B1 0 )*Q = ( x x )
( B2 B3 ) ( 0 x )
The rows of the transformed A and B are parallel, where
U = ( CSU SNU ), V = ( CSV SNV ), Q = ( CSQ SNQ )
( -SNU CSU ) ( -SNV CSV ) ( -SNQ CSQ )
Z**T denotes the transpose of Z.
so basically: the rows of the transformed A and B come out parallel, and the three orthogonal matrices U, V and Q are literally built out of the cosines and sines you feed in. it's giving trigonometry main character energy 💅
🎀 Parameters 🎀
UPPER—UPPERisLOGICAL= .TRUE.: the input matrices A and B are upper triangular.= .FALSE.: the input matrices A and B are lower triangular.
A1—A1isDOUBLE PRECISIONA2—A2isDOUBLE PRECISIONA3—A3isDOUBLE PRECISIONOn entry,A1,A2andA3are elements of the input 2-by-2 upper (lower) triangular matrix A.B1—B1isDOUBLE PRECISIONB2—B2isDOUBLE PRECISIONB3—B3isDOUBLE PRECISIONOn entry,B1,B2andB3are elements of the input 2-by-2 upper (lower) triangular matrix B.CSU—CSUisDOUBLE PRECISIONSNU—SNUisDOUBLE PRECISIONThe desired orthogonal matrix U.CSV—CSVisDOUBLE PRECISIONSNV—SNVisDOUBLE PRECISIONThe desired orthogonal matrix V.CSQ—CSQisDOUBLE PRECISIONSNQ—SNQisDOUBLE PRECISIONThe desired orthogonal matrix Q.
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🌈 subroutine dlagtm 🌈
subroutine dlagtm (character TRANS, integer N, integer NRHS, double
precision ALPHA, double precision, dimension( * ) DL, double precision,
dimension( * ) D, double precision, dimension( * ) DU, double precision,
dimension( ldx, * ) X, integer LDX, double precision BETA, double
precision, dimension( ldb, * ) B, integer LDB)
DLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix, B and C are rectangular matrices, and α and β are scalars, which may be 0, 1, or -1. 🔥
✨ Purpose ✨
fr fr, DLAGTM performs a matrix-vector product of the form
B := alpha * A * X + beta * B
where A is a tridiagonal matrix of order N, B and X are N by NRHS matrices, and alpha and beta are real scalars, each of which may be 0., 1., or -1. ⭐
ngl the one-line blurb up top saysC = αAB+βCwhile the Purpose saysB := alpha * A * X + beta * B— not me noticing, just saying. both are in the source, both stay. iykyk 💀
🎀 Parameters 🎀
TRANS—TRANSisCHARACTER*1Specifies the operation applied to A.= 'N': No transpose,B := alpha * A * X + beta * B= 'T': Transpose,B := alpha * A'* X + beta * B= 'C': Conjugate transpose = Transpose
N—NisINTEGERThe order of the matrix A.N >= 0.NRHS—NRHSisINTEGERThe number of right hand sides, i.e., the number of columns of the matrices X and B.ALPHA—ALPHAisDOUBLE PRECISIONThe scalar alpha.ALPHAmust be0.,1., or-1.; otherwise, it is assumed to be0.DL—DLisDOUBLE PRECISIONarray, dimension(N-1)The(n-1)sub-diagonal elements of T.D—DisDOUBLE PRECISIONarray, dimension(N)The diagonal elements of T.DU—DUisDOUBLE PRECISIONarray, dimension(N-1)The(n-1)super-diagonal elements of T.X—XisDOUBLE PRECISIONarray, dimension(LDX,NRHS)The N by NRHS matrix X.LDX—LDXisINTEGERThe leading dimension of the array X.LDX >= max(N,1).BETA—BETAisDOUBLE PRECISIONThe scalar beta.BETAmust be0.,1., or-1.; otherwise, it is assumed to be1.B—BisDOUBLE PRECISIONarray, dimension(LDB,NRHS)On entry, the N by NRHS matrix B. On exit, B is overwritten by the matrix expressionB := alpha * A * X + beta * B.LDB—LDBisINTEGERThe leading dimension of the array B.LDB >= max(N,1).
heads up bestie:ALPHAandBETAonly accept0.,1., or-1.— anything else gets silently treated as0forALPHAand1forBETA. no error, no warning, just vibes 🙈
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🦋 subroutine dlagv2 🦋
subroutine dlagv2 (double precision, dimension( lda, * ) A, integer LDA,
double precision, dimension( ldb, * ) B, integer LDB, double precision,
dimension( 2 ) ALPHAR, double precision, dimension( 2 ) ALPHAI, double
precision, dimension( 2 ) BETA, double precision CSL, double precision
SNL, double precision CSR, double precision SNR)
DLAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular. 💜
✨ Purpose ✨
DLAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular. This routine computes orthogonal (rotation) matrices given by CSL, SNL and CSR, SNR such that
1) if the pencil (A,B) has two real eigenvalues (include 0/0 or 1/0
types), then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 b12 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ],
2) if the pencil (A,B) has a pair of complex conjugate eigenvalues,
then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 0 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ]
where b11 >= b22 > 0.
two cases, two whole moods: real eigenvalues (including the 0/0 and 1/0 types, iconic) and complex conjugate eigenvalues. slay. 🌈
🎀 Parameters 🎀
A—AisDOUBLE PRECISIONarray, dimension(LDA, 2)On entry, the 2 x 2 matrix A. On exit, A is overwritten by the "A-part" of the generalized Schur form.LDA—LDAisINTEGERTHe leading dimension of the array A.LDA >= 2.B—BisDOUBLE PRECISIONarray, dimension(LDB, 2)On entry, the upper triangular 2 x 2 matrix B. On exit, B is overwritten by the "B-part" of the generalized Schur form.LDB—LDBisINTEGERTHe leading dimension of the array B.LDB >= 2.ALPHAR—ALPHARisDOUBLE PRECISIONarray, dimension(2)ALPHAI—ALPHAIisDOUBLE PRECISIONarray, dimension(2)BETA—BETAisDOUBLE PRECISIONarray, dimension(2)(ALPHAR(k)+i*ALPHAI(k))/BETA(k)are the eigenvalues of the pencil (A,B),k=1,2,i = sqrt(-1). Note thatBETA(k)may be zero.CSL—CSLisDOUBLE PRECISIONThe cosine of the left rotation matrix.SNL—SNLisDOUBLE PRECISIONThe sine of the left rotation matrix.CSR—CSRisDOUBLE PRECISIONThe cosine of the right rotation matrix.SNR—SNRisDOUBLE PRECISIONThe sine of the right rotation matrix.
🫶 yes, the source really does spell it "THe leading dimension" twice. we keep it. that's part of the lore now.
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
💖 Contributors 💖
- Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
🌟 subroutine dlahqr 🌟
subroutine dlahqr (logical WANTT, logical WANTZ, integer N, integer ILO,
integer IHI, double precision, dimension( ldh, * ) H, integer LDH,
double precision, dimension( * ) WR, double precision, dimension( * )
WI, integer ILOZ, integer IHIZ, double precision, dimension( ldz, * ) Z,
integer LDZ, integer INFO)
DLAHQR computes the eigenvalues and Schur factorization of an upper Hessenberg matrix, using the double-shift/single-shift QR algorithm. 👑
✨ Purpose ✨
DLAHQR is an auxiliary routine called by DHSEQR to update the
eigenvalues and Schur decomposition already computed by DHSEQR, by
dealing with the Hessenberg submatrix in rows and columns ILO to
IHI.
so it's the little helper that DHSEQR calls in to do the cleanup work on rows and columns ILO to IHI. auxiliary but make it essential ✨
🎀 Parameters 🎀
WANTT—WANTTisLOGICAL= .TRUE.: the full Schur form T is required;= .FALSE.: only eigenvalues are required.
WANTZ—WANTZisLOGICAL= .TRUE.: the matrix of Schur vectors Z is required;= .FALSE.: Schur vectors are not required.
N—NisINTEGERThe order of the matrix H.N >= 0.ILO—ILOisINTEGERIHI—IHIisINTEGERIt is assumed that H is already upper quasi-triangular in rows and columnsIHI+1:N, and thatH(ILO,ILO-1) = 0(unlessILO = 1).DLAHQRworks primarily with the Hessenberg submatrix in rows and columnsILOtoIHI, but applies transformations to all of H ifWANTTis.TRUE..1 <= ILO <= max(1,IHI);IHI <= N.H— okay bestie,His where this part runs out of runway 🌸 the full 411 onHis rolling in with the next chunk, so hold that thought.H—DOUBLE PRECISIONarray, dimension(LDH,N). On entry, it's the upper Hessenberg matrixH. On exit, ifINFOis zero andWANTTis.TRUE.,Hcomes back upper quasi-triangular in rows and columnsILO:IHI, and any 2-by-2 diagonal blocks are in standard form 💅. IfINFOis zero andWANTTis.FALSE., the contents ofHon exit are unspecified (aka: don't look at it, it's giving nothing, mind your business 🙈). The output state ofHwhenINFOis nonzero? It's down below under theINFOdescription, bestie, keep scrolling 👇LDH—INTEGER. It's the leading dimension of the arrayH. Requirement:LDH >= max(1,N).WR—DOUBLE PRECISIONarray, dimension(N). That's it, that's the whole note 🎀WI—DOUBLE PRECISIONarray, dimension(N). SoWRandWIare the real and imaginary parts, respectively, of the computed eigenvaluesILOtoIHI, and they're stored in the corresponding elements ofWRandWI. If two eigenvalues get computed as a complex conjugate pair, they're stored in consecutive elements ofWRandWI— like the i-th and (i+1)th — withWI(i) > 0andWI(i+1) < 0. IfWANTTis.TRUE., the eigenvalues are stored in the same order as on the diagonal of the Schur form returned inH, withWR(i) = H(i,i), and, ifH(i:i+1,i:i+1)is a 2-by-2 diagonal block,WI(i) = sqrt(H(i+1,i)*H(i,i+1))andWI(i+1) = -WI(i). Math ate that fr fr 🔥ILOZ—INTEGER.IHIZ—INTEGER. These two specify the rows ofZthat transformations get applied to, but only ifWANTZis.TRUE.. Constraints:1 <= ILOZ <= ILOandIHI <= IHIZ <= N.Z—DOUBLE PRECISIONarray, dimension(LDZ,N). IfWANTZis.TRUE., then on entryZmust contain the current matrixZof transformations accumulated byDHSEQR, and on exitZhas been updated; transformations are applied only to the submatrixZ(ILOZ:IHIZ,ILO:IHI). IfWANTZis.FALSE.,Zis literally not referenced. Not even glanced at. It's invisible bestie 👻LDZ—INTEGER. The leading dimension of the arrayZ. Requirement:LDZ >= max(1,N).INFO—INTEGER. The vibes check 👑:= 0: successful exit ✨> 0: IfINFO = i,DLAHQRfailed to compute all the eigenvaluesILOtoIHIin a total of 30 iterations per eigenvalue; elements i+1:ihi ofWRandWIcontain those eigenvalues which have been successfully computed.
If INFO > 0 and WANTT is .FALSE., then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and WANTT is .TRUE., then on exit
(*) (initial value of H)*U = U*(final value of H)
where U is an orthogonal matrix. The final value of H is upper Hessenberg and triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and WANTZ is .TRUE., then on exit
(final value of Z) = (initial value of Z)*U
where U is the orthogonal matrix in (*) — and yes, that holds regardless of the value of WANTT 🫶
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
02-96 Based on modifications by
David Day, Sandia National Laboratory, USA
12-04 Further modifications by
Ralph Byers, University of Kansas, USA
This is a modified version of DLAHQR from LAPACK version 3.0.
It is (1) more robust against overflow and underflow and
(2) adopts the more conservative Ahues & Tisseur stopping
criterion (LAWN 122, 1997).
🦋 subroutine dlahr2
subroutine dlahr2 (integer N, integer K, integer NB, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( nb )
TAU, double precision, dimension( ldt, nb ) T, integer LDT, double
precision, dimension( ldy, nb ) Y, integer LDY)
DLAHR2 reduces the specified number of first columns of a general rectangular matrix A so that elements below the specified subdiagonal are zero, and it hands back the auxiliary matrices you need to apply that transformation to the unreduced part of A. It's the little helper doing the heavy lifting, and honestly? iconic behavior 💖
Purpose:
DLAHR2 reduces the first NB columns of A real general n-BY-(n-k+1) matrix A so that elements below the k-th subdiagonal are zero. The reduction is performed by an orthogonal similarity transformation Q**T * A * Q. The routine returns the matrices V and T which determine Q as a block reflector I - V*T*V**T, and also the matrix Y = A * V * T.
This is an auxiliary routine called by DGEHRD.
Parameters
N—INTEGER. The order of the matrixA.K—INTEGER. The offset for the reduction. Elements below the k-th subdiagonal in the firstNBcolumns are reduced to zero.K < N.NB—INTEGER. The number of columns to be reduced.A—DOUBLE PRECISIONarray, dimension(LDA,N-K+1). On entry, the n-by-(n-k+1) general matrixA. On exit, the elements on and above the k-th subdiagonal in the firstNBcolumns are overwritten with the corresponding elements of the reduced matrix; the elements below the k-th subdiagonal, together with the arrayTAU, represent the matrixQas a product of elementary reflectors. The other columns ofAare unchanged. See Further Details 👀LDA—INTEGER. The leading dimension of the arrayA. Requirement:LDA >= max(1,N).TAU—DOUBLE PRECISIONarray, dimension(NB). The scalar factors of the elementary reflectors. See Further Details.T—DOUBLE PRECISIONarray, dimension(LDT,NB). The upper triangular matrixT.LDT—INTEGER. The leading dimension of the arrayT. Requirement:LDT >= NB.Y—DOUBLE PRECISIONarray, dimension(LDY,NB). The n-by-nb matrixY.LDY—INTEGER. The leading dimension of the arrayY. Requirement:LDY >= N.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
The matrix Q is represented as a product of nb elementary reflectors
Q = H(1) H(2) . . . H(nb).
Each H(i) has the form
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(1:i+k-1) = 0, v(i+k) = 1; v(i+k+1:n) is stored on exit in A(i+k+1:n,i), and tau in TAU(i).
The elements of the vectors v together form the (n-k+1)-by-nb matrix V which is needed, with T and Y, to apply the transformation to the unreduced part of the matrix, using an update of the form: A := (I - V*T*V**T) * (A - Y*V**T).
The contents of A on exit are illustrated by the following example with n = 7, k = 3 and nb = 2:
( a a a a a )
( a a a a a )
( a a a a a )
( h h a a a )
( v1 h a a a )
( v1 v2 a a a )
( v1 v2 a a a )
where a denotes an element of the original matrix A, h denotes a modified element of the upper Hessenberg matrix H, and vi denotes an element of the vector defining H(i) 🌸
This subroutine is a slight modification of LAPACK-3.0's DLAHRD incorporating improvements proposed by Quintana-Orti and Van de Gejin. Note that the entries of A(1:K,2:NB) differ from those returned by the original LAPACK-3.0's DLAHRD routine. (This subroutine is not backward compatible with LAPACK-3.0's DLAHRD.) ⚠️ read that twice bestie, the old code will not recognize the new you 💀
References:
Gregorio Quintana-Orti and Robert van de Geijn, 'Improving the performance of reduction to Hessenberg form,' ACM Transactions on Mathematical Software, 32(2):180-194, June 2006.
💜 subroutine dlaic1
subroutine dlaic1 (integer JOB, integer J, double precision, dimension( j )
X, double precision SEST, double precision, dimension( j ) W, double
precision GAMMA, double precision SESTPR, double precision S, double
precision C)
DLAIC1 applies one step of incremental condition estimation. One step. Baby steps. But make it math 🧚
Purpose:
DLAIC1 applies one step of incremental condition estimation in its simplest version:
Let x, twonorm(x) = 1, be an approximate singular vector of an j-by-j lower triangular matrix L, such that
twonorm(L*x) = sest
Then DLAIC1 computes sestpr, s, c such that the vector
[ s*x ]
xhat = [ c ]
is an approximate singular vector of
[ L 0 ]
Lhat = [ w**T gamma ]
in the sense that
twonorm(Lhat*xhat) = sestpr.
Depending on JOB, an estimate for the largest or smallest singular value is computed.
Note that [s c]**T and sestpr**2 is an eigenpair of the system
diag(sest*sest, 0) + [alpha gamma] * [ alpha ]
[ gamma ]
where alpha = x**T*w.
Parameters
JOB—INTEGER.= 1: an estimate for the largest singular value is computed.= 2: an estimate for the smallest singular value is computed.
J—INTEGER. Length ofXandW.X—DOUBLE PRECISIONarray, dimension(J). The j-vectorx.SEST—DOUBLE PRECISION. Estimated singular value of j by j matrixL.W—DOUBLE PRECISIONarray, dimension(J). The j-vectorw.GAMMA—DOUBLE PRECISION. The diagonal element gamma.SESTPR—DOUBLE PRECISION. Estimated singular value of (j+1) by (j+1) matrixLhat.SS—Sis DOUBLE PRECISION, bestie. It's the Sine needed in formingxhat. ✨C—Cis DOUBLE PRECISION. It's the Cosine needed in formingxhat. 🎀
💫 Author 💫
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 dlaln2 🦋
subroutine dlaln2 (logical LTRANS, integer NA, integer NW, double precision
SMIN, double precision CA, double precision, dimension( lda, * ) A,
integer LDA, double precision D1, double precision D2, double precision,
dimension( ldb, * ) B, integer LDB, double precision WR, double
precision WI, double precision, dimension( ldx, * ) X, integer LDX,
double precision SCALE, double precision XNORM, integer INFO)
okay so DLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form. It's giving tiny but mighty. 💅
🌸 Purpose 🌸
DLALN2 solves a system of the form
(ca A - w D ) X = s B
or
(ca A**T - w D) X = s B
with possible scaling ('s') and perturbation of A. (A**T means A-transpose, iykyk.) 🫶
A is an NA x NA real matrix, ca is a real scalar, D is an NA x NA real diagonal matrix, w is a real or complex value, and X and B are NA x 1 matrices — real if w is real, complex if w is complex. And NA may be 1 or 2. That's it, that's the whole vibe. 💀
If w is complex, X and B are represented as NA x 2 matrices, the first column of each being the real part and the second being the imaginary part. Two columns, two moods. 🦋
's' is a scaling factor (<= 1), computed by DLALN2, which is so chosen that X can be computed without overflow. X is further scaled if necessary to assure that norm(ca A - w D)*norm(X) is less than overflow. Protective queen behavior. 👑
If both singular values of (ca A - w D) are less than SMIN, SMIN*identity will be used instead of (ca A - w D). If only one singular value is less than SMIN, one element of (ca A - w D) will be perturbed enough to make the smallest singular value roughly SMIN. If both singular values are at least SMIN, (ca A - w D) will not be perturbed. In any case, the perturbation will be at most some small multiple of max( SMIN, ulp*norm(ca A - w D) ). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so. Factor of 2?? close enough, we love an approximation era. 😭
Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See BIGNUM.) fr fr, don't test it.
✨ Parameters ✨
LTRANS—LTRANSis LOGICAL.=.TRUE.: A-transpose will be used.=.FALSE.:Awill be used (not transposed.) Pick your fighter. 💅NA—NAis INTEGER. The size of the matrixA. It may (only) be1or2. That's the whole range, bestie, no in-between. 🙈NW—NWis INTEGER.1if'w'is real,2if'w'is complex. It may only be1or2. 🎀SMIN—SMINis DOUBLE PRECISION. The desired lower bound on the singular values ofA. This should be a safe distance away from underflow or overflow, say, between(underflow/machine precision)and(machine precision * overflow ). (SeeBIGNUMandULP.) a safe distance, like emotionally. 🌸CA—CAis DOUBLE PRECISION. The coefficientc, whichAis multiplied by. 🧚A—Ais DOUBLE PRECISION array, dimension(LDA,NA). TheNAxNAmatrixA. The main character herself. 👑LDA—LDAis INTEGER. The leading dimension ofA. It must be at leastNA. ⭐D1—D1is DOUBLE PRECISION. The1,1element in the diagonal matrixD. 💜D2—D2is DOUBLE PRECISION. The2,2element in the diagonal matrixD. Not used ifNA=1. She gets the night off. 💤B—Bis DOUBLE PRECISION array, dimension(LDB,NW). TheNAxNWmatrixB(right-hand side). IfNW=2('w'is complex), column 1 contains the real part ofBand column 2 contains the imaginary part. 💖LDB—LDBis INTEGER. The leading dimension ofB. It must be at leastNA. 🌈WR—WRis DOUBLE PRECISION. The real part of the scalar'w'. ✨WI—WIis DOUBLE PRECISION. The imaginary part of the scalar'w'. Not used ifNW=1. 🎀X—Xis DOUBLE PRECISION array, dimension(LDX,NW). TheNAxNWmatrixX(unknowns), as computed byDLALN2. IfNW=2('w'is complex), on exit, column 1 will contain the real part ofXand column 2 will contain the imaginary part. the glow-up happens on exit. 💅LDX—LDXis INTEGER. The leading dimension ofX. It must be at leastNA. 🦋SCALE—SCALEis DOUBLE PRECISION. The scale factor thatBmust be multiplied by to insure that overflow does not occur when computingX. Thus,(ca A - w D) Xwill beSCALE*B, notB(ignoring perturbations ofA.) It will be at most1. at most 1, never overachieving, respect. 😌XNORM—XNORMis DOUBLE PRECISION. The infinity-norm ofX, whenXis regarded as anNAxNWreal matrix. 🍓INFO—INFOis INTEGER. An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number ifca A - w Dhad to be perturbed. The possible values are:= 0: No error occurred, and(ca A - w D)did not have to be perturbed. 🎉= 1:(ca A - w D)had to be perturbed to make its smallest (or only) singular value greater thanSMIN. 😭
NOTE: In the interests of speed, this routine does not check the inputs for errors. not me finding out the hard way 💀
💫 Author 💫
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 dlangt 🦋
double precision function dlangt (character NORM, integer N, double
precision, dimension( * ) DL, double precision, dimension( * ) D, double
precision, dimension( * ) DU)
DLANGT returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a general tridiagonal matrix. tridiagonal? we stan a three-line queen. 👑
🌸 Purpose 🌸
DLANGT 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 tridiagonal matrix A. ✨
✨ Returns ✨
DLANGT = ( 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 rebel, not a real norm, we still love it. 💅
✨ Parameters ✨
NORM—NORMis CHARACTER*1. Specifies the value to be returned inDLANGTas described above. Pick a letter, any letter (from the list). 🎀N—Nis INTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANGTis set to zero. zero matrix, zero drama. 🌸DL—DLis DOUBLE PRECISION array, dimension(N-1). The(n-1)sub-diagonal elements ofA. 🦋D—Dis DOUBLE PRECISION array, dimension(N). The diagonal elements ofA. The main character row. 👑DU—DUis DOUBLE PRECISION array, dimension(N-1). The(n-1)super-diagonal elements ofA. ⭐
💫 Author 💫
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 dlanhs 🦋
double precision function dlanhs (character NORM, integer N, double
precision, dimension( lda, * ) A, integer LDA, double precision,
dimension( * ) WORK)
DLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of an upper Hessenberg matrix. Hessenberg hive, rise up. 💖
🌸 Purpose 🌸
DLANHS returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a Hessenberg matrix A. ✨
✨ Returns ✨
DLANHS = ( 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. same disclaimer, same energy. 💅
✨ Parameters ✨
NORM—NORMis CHARACTER*1. Specifies the value to be returned inDLANHSas described above. 🎀N—Nis INTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANHSis set to zero. 🌸A—Ais DOUBLE PRECISION array, dimension(LDA,N). The n by n upper Hessenberg matrixA; the part ofAbelow the first sub-diagonal is not referenced. if you're below the sub-diagonal, you're not invited, sorry bestie. 🙈LDA—LDAis INTEGER. The leading dimension of the arrayA.LDA >= max(N,1). ⭐WORK—WORKis DOUBLE PRECISION array, dimension(MAX(1,LWORK)), whereLWORK >= NwhenNORM = 'I'; otherwise,WORKis not referenced. she only shows up for the'I'era. 💜
💫 Author 💫
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 dlansb 🦋
double precision function dlansb (character NORM, character UPLO, integer N,
integer K, double precision, dimension( ldab, * ) AB, integer LDAB,
double precision, dimension( * ) WORK)
DLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix. symmetric AND banded?? iconic. 👑
🌸 Purpose 🌸
DLANSB returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of an n by n symmetric band matrix A, with k super-diagonals. ✨
✨ Returns ✨
DLANSB
okay so if you asked for the biggest absolute value, the 1-norm, the Frobenius norm or the infinity norm, here's the little menu it picks from — for DLANSB it's giving:
DLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 is the one norm of a matrix (maximum column sum), normI is the infinity norm (maximum row sum), and normF is the Frobenius norm (square root of sum of squares). ✨ And bestie, note this: max(abs(A(i,j))) is not a consistent matrix norm. That's just facts, not a vibe.
Parameters
NORM—NORMisCHARACTER*1. It says which value gets handed back to you inDLANSB, as laid out above. 💅UPLO—UPLOisCHARACTER*1. Tells it whether the upper or lower triangular part of the band matrixAis the one you're supplying.= 'U': upper triangular part is supplied= 'L': lower triangular part is supplied
N—NisINTEGER. The order of the matrixA.N >= 0. And whenN = 0,DLANSBis set to zero. (Zero. Gone. Nothing. 🫶)K—KisINTEGER. The number of super-diagonals or sub-diagonals of the band matrixA.K >= 0.AB—ABisDOUBLE PRECISIONarray, dimension(LDAB,N). The upper or lower triangle of the symmetric band matrixA, stored in the firstK+1rows ofAB. The j-th column ofAlives in the j-th column of the arrayABlike this:- if
UPLO = 'U',AB(k+1+i-j,j) = A(i,j)formax(1,j-k)<=i<=j; - if
UPLO = 'L',AB(1+i-j,j) = A(i,j)forj<=i<=min(n,j+k).
- if
LDAB—LDABisINTEGER. The leading dimension of the arrayAB.LDAB >= K+1.WORK—WORKisDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)), whereLWORK >= NwhenNORM = 'I'or'1'or'O'; otherwise,WORKis not referenced. 🦋
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
double precision function dlansp (character NORM, character UPLO, integer N, double precision, dimension( * ) AP, double precision, dimension( * ) WORK)
DLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form. Packed. Like your suitcase. 🧳
Purpose:
DLANSP 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 matrix A, supplied in packed form.
Returns
DLANSP =
DLANSP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 is the one norm of a matrix (maximum column sum), normI is the infinity norm (maximum row sum), and normF is the Frobenius norm (square root of sum of squares). And again, no cap: max(abs(A(i,j))) is not a consistent matrix norm. 💀
Parameters
NORM—NORMisCHARACTER*1. Specifies the value to be returned inDLANSPas described above. 👑UPLO—UPLOisCHARACTER*1. Says whether the upper or lower triangular part of the symmetric matrixAis supplied.= 'U': upper triangular part ofAis supplied= 'L': lower triangular part ofAis supplied
N—NisINTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANSPis set to zero. (iconic zero behaviour fr fr)AP—APisDOUBLE PRECISIONarray, dimension(N*(N+1)/2). The upper or lower triangle of the symmetric matrixA, packed columnwise in a linear array. The j-th column ofAsits in the arrayAPlike so:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2n-j)/2) = A(i,j)forj<=i<=n.
- if
WORK—WORKisDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)), whereLWORK >= NwhenNORM = 'I'or'1'or'O'; otherwise,WORKis not referenced. 🌸
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
double precision function dlantb (character NORM, character UPLO, character DIAG, integer N, integer K, double precision, dimension( ldab, * ) AB, integer LDAB, double precision, dimension( * ) WORK)
DLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix. Triangular band edition, bestie. 💜
Purpose:
DLANTB returns the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value of an
n by n triangular band matrix A, with ( k + 1 ) diagonals.
Returns
DLANTB =
DLANTB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 is the one norm of a matrix (maximum column sum), normI is the infinity norm (maximum row sum), and normF is the Frobenius norm (square root of sum of squares). And once more for the people in the back: max(abs(A(i,j))) is not a consistent matrix norm. 😭
Parameters
NORM—NORMisCHARACTER*1. Specifies the value to be returned inDLANTBas described above.UPLO—UPLOisCHARACTER*1. Tells it whether the matrixAis upper or lower triangular.= 'U': upper triangular= 'L': lower triangular
DIAG—DIAGisCHARACTER*1. Says whether or not the matrixAis unit triangular.= 'N': non-unit triangular= 'U': unit triangular
N—NisINTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANTBis set to zero. ✨K—KisINTEGER. The number of super-diagonals of the matrixAifUPLO = 'U', or the number of sub-diagonals of the matrixAifUPLO = 'L'.K >= 0.AB—ABisDOUBLE PRECISIONarray, dimension(LDAB,N). The upper or lower triangular band matrixA, stored in the firstk+1rows ofAB. The j-th column ofAis stored in the j-th column of the arrayABas follows:- if
UPLO = 'U',AB(k+1+i-j,j) = A(i,j)formax(1,j-k)<=i<=j; - if
UPLO = 'L',AB(1+i-j,j) = A(i,j)forj<=i<=min(n,j+k).
- if
Heads up: whenDIAG = 'U', the elements of the arrayABcorresponding to the diagonal elements of the matrixAare not referenced, but are assumed to be one. So don't stress about writing them, they're just ~vibes~ assumed to be1. 🎀
LDAB—LDABisINTEGER. The leading dimension of the arrayAB.LDAB >= K+1.WORK—WORKisDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)), whereLWORK >= NwhenNORM = 'I'; otherwise,WORKis not referenced. (Note the difference, bestie — it's only'I'here, not the whole'1'/'O'crew. iykyk 🫶)
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
double precision function dlantp (character NORM, character UPLO, character DIAG, integer N, double precision, dimension( * ) AP, double precision, dimension( * ) WORK)
DLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular matrix supplied in packed form. Triangular AND packed. The crossover episode nobody asked for but we got anyway. 🌈
Purpose:
DLANTP returns the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value of a
triangular matrix A, supplied in packed form.
Returns
DLANTP =
DLANTP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 is the one norm of a matrix (maximum column sum), normI is the infinity norm (maximum row sum), and normF is the Frobenius norm (square root of sum of squares). And yes, one more time: max(abs(A(i,j))) is not a consistent matrix norm. 🍓
Parameters
NORM—NORMisCHARACTER*1. Specifies the value to be returned inDLANTPas described above.UPLO—UPLOisCHARACTER*1. Tells it whether the matrixAis upper or lower triangular.= 'U': upper triangular= 'L': lower triangular
DIAG—DIAGisCHARACTER*1. Says whether or not the matrixAis unit triangular.= 'N': non-unit triangular= 'U': unit triangular
N—NisINTEGER. The order of the matrixA.N >= 0. WhenN = 0,DLANTPis set to zero. 💅AP—APisDOUBLE PRECISIONarray, dimension(N*(N+1)/2). The upper or lower triangular matrixA, packed columnwise in a linear array. The j-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2n-j)/2) = A(i,j)forj<=i<=n.
- if
And same energy as before: whenDIAG = 'U', the elements of the arrayAPcorresponding to the diagonal elements of the matrixAare not referenced, but are assumed to be one. They're literally just placeholders, don't even look at them. 🙈
WORK—WORKisDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)), whereLWORK >= NwhenNORM = 'I'; otherwise,WORKis not referenced. ✨
Author
- Univ. of Tennessee
- Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 dlantr 💜
double precision function dlantr (character NORM, character UPLO, character
DIAG, integer M, integer N, double precision, dimension( lda, * ) A,
integer LDA, double precision, dimension( * ) WORK)
okay so bestie, DLANTR hands you back the 1-norm, or the Frobenius norm, or the infinity norm, or just the element with the largest absolute value of a trapezoidal or triangular matrix. four-for-one deal, we love to see it ✨
🌸 Purpose 🌸
DLANTR returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a trapezoidal or triangular matrix A.
✨ Returns ✨
DLANTR = ( 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). Heads up though — max(abs(A(i,j))) is not a consistent matrix norm, no cap 🙈
🎀 Parameters 🎀
NORM—NORMisCHARACTER*1. Tells you which value gets returned inDLANTR, exactly as described up there ⬆️UPLO—UPLOisCHARACTER*1. Says whether the matrixAis upper or lower trapezoidal.= 'U': Upper trapezoidal= 'L': Lower trapezoidal- ngl,
Ais triangular instead of trapezoidal ifM = N💅
DIAG—DIAGisCHARACTER*1. Says whether or not the matrixAhas a unit diagonal.= 'N': Non-unit diagonal= 'U': Unit diagonal
M—MisINTEGER. The number of rows of the matrixA.M >= 0, and ifUPLO = 'U',M <= N. WhenM = 0,DLANTRis set to zero 🫶N—NisINTEGER. The number of columns of the matrixA.N >= 0, and ifUPLO = 'L',N <= M. WhenN = 0,DLANTRis set to zero 🫶A—AisDOUBLE PRECISIONarray, dimension(LDA,N). The trapezoidal matrixA(Ais triangular ifM = N). IfUPLO = 'U', the leadingmbynupper trapezoidal part of the arrayAcontains the upper trapezoidal matrix, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leadingmbynlower trapezoidal part of the arrayAcontains the lower trapezoidal matrix, and the strictly upper triangular part ofAis not referenced. Note that whenDIAG = 'U', the diagonal elements ofAare not referenced and are assumed to be one 👑LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(M,1).WORK—WORKisDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)), whereLWORK >= MwhenNORM = 'I'; otherwise,WORKis not referenced. she only shows up for the infinity norm, main character energy 🌈
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🔥 dlanv2 🔥
subroutine dlanv2 (double precision A, double precision B, double precision
C, double precision D, double precision RT1R, double precision RT1I,
double precision RT2R, double precision RT2I, double precision CS,
double precision SN)
DLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form. tiny matrix, big brain energy 🧚
🌟 Purpose 🌟
DLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form:
[ A B ] = [ CS -SN ] [ AA BB ] [ CS SN ]
[ C D ] [ SN CS ] [ CC DD ] [-SN CS ]
where either
CC = 0so thatAAandDDare real eigenvalues of the matrix, orAA = DDandBB*CC < 0, so thatAA + or - sqrt(BB*CC)are complex conjugate eigenvalues.
💖 Parameters 💖
A—AisDOUBLE PRECISIONB—BisDOUBLE PRECISIONC—CisDOUBLE PRECISIOND—DisDOUBLE PRECISION. On entry, the elements of the input matrix. On exit, they are overwritten by the elements of the standardised Schur form. bye original values, it was real 😭RT1R—RT1RisDOUBLE PRECISIONRT1I—RT1IisDOUBLE PRECISIONRT2R—RT2RisDOUBLE PRECISIONRT2I—RT2IisDOUBLE PRECISION. The real and imaginary parts of the eigenvalues. If the eigenvalues are a complex conjugate pair,RT1I > 0.CS—CSisDOUBLE PRECISIONSN—SNisDOUBLE PRECISION. Parameters of the rotation matrix. spinny spinny 💫
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🦋 Further Details: 🦋
Modified by V. Sima, Research Institute for Informatics, Bucharest, Romania, to reduce the risk of cancellation errors, when computing real eigenvalues, and to ensure, if possible, that abs(RT1R) >= abs(RT2R). protective queen behaviour, we stan 🫶
🌈 dlapll 🌈
subroutine dlapll (integer N, double precision, dimension( * ) X, integer
INCX, double precision, dimension( * ) Y, integer INCY, double precision
SSMIN)
DLAPLL measures the linear dependence of two vectors. are y'all actually different or just vibing the same? vibe check incoming ⭐
🌸 Purpose 🌸
Given two column vectors X and Y, let
A = ( X Y ).
The subroutine first computes the QR factorization of A = Q*R, and then computes the SVD of the 2-by-2 upper triangular matrix R. The smaller singular value of R is returned in SSMIN, which is used as the measurement of the linear dependency of the vectors X and Y. literally a whole detective arc for two vectors 💀
🎀 Parameters 🎀
N—NisINTEGER. The length of the vectorsXandY.X—XisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCX). On entry,Xcontains theN-vectorX. On exit,Xis overwritten. sorry babe, she's changed now 🙈INCX—INCXisINTEGER. The increment between successive elements ofX.INCX > 0.Y—YisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCY). On entry,Ycontains theN-vectorY. On exit,Yis overwritten. same fate fr fr 😭INCY—INCYisINTEGER. The increment between successive elements ofY.INCY > 0.SSMIN—SSMINisDOUBLE PRECISION. The smallest singular value of theN-by-2 matrixA = ( X Y ).
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
💅 dlapmr 💅
subroutine dlapmr (logical FORWRD, integer M, integer N, double precision,
dimension( ldx, * ) X, integer LDX, integer, dimension( * ) K)
DLAPMR rearranges rows of a matrix as specified by a permutation vector. row shuffle era ✨
🌟 Purpose 🌟
DLAPMR rearranges the rows of the M by N matrix X as specified by the permutation K(1),K(2),...,K(M) of the integers 1,...,M.
If FORWRD = .TRUE., forward permutation:
X(K(I),*) is moved X(I,*) for I = 1,2,...,M.
If FORWRD = .FALSE., backward permutation:
X(I,*) is moved to X(K(I),*) for I = 1,2,...,M.
💖 Parameters 💖
FORWRD—FORWRDisLOGICAL= .TRUE., forward permutation= .FALSE., backward permutation
M—MisINTEGER. The number of rows of the matrixX.M >= 0.N—NisINTEGER. The number of columns of the matrixX.N >= 0.X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On entry, theMbyNmatrixX. On exit,Xcontains the permuted matrixX.LDX—LDXisINTEGER. The leading dimension of the arrayX,LDX >= MAX(1,M).K—KisINTEGERarray, dimension(M). On entry,Kcontains the permutation vector.Kis used as internal workspace, but reset to its original value on output. she borrows your stuff and gives it back, that's the respectful icon behaviour 🫶
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🦋 dlapmt 🦋
subroutine dlapmt (logical FORWRD, integer M, integer N, double precision,
dimension( ldx, * ) X, integer LDX, integer, dimension( * ) K)
DLAPMT performs a forward or backward permutation of the columns of a matrix. DLAPMR's sibling but she does columns, not rows, and yes they're both iconic in their own lane 👑
🌈 Purpose 🌈
DLAPMT rearranges the columns of the M by N matrix X as specified by the permutation K(1),K(2),...,K(N) of the integers 1,...,N.
If FORWRD = .TRUE., forward permutation:
X(*,K(J)) is moved X(*,J) for J = 1,2,...,N.
If FORWRD = .FALSE., backward permutation:
X(*,J) is moved to X(*,K(J)) for J = 1,2,...,N.
🎀 Parameters 🎀
FORWRD—FORWRDisLOGICAL= .TRUE., forward permutation= .FALSE., backward permutation
M—MisINTEGER. The number of rows of the matrixX.M >= 0.N—NisINTEGER. The number of columns of the matrixX.N >= 0.X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On entry, theMbyNmatrixX. On exit,Xcontains the permuted matrixX.LDX—LDXisINTEGER. The leading dimension of the arrayX,LDX >= MAX(1,M).K—KisINTEGERarray, dimension(N). On entry,Kcontains the permutation vector.Kis used as internal workspace, but reset to its original value on output. again, borrowed and returned pristine, queen shit 💅
👑 Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🌸 dlaqp2 🌸
subroutine dlaqp2 (integer M, integer N, integer OFFSET, double precision,
dimension( lda, * ) A, integer LDA, integer, dimension( * ) JPVT, double
precision, dimension( * ) TAU, double precision, dimension( * ) VN1,
double precision, dimension( * ) VN2, double precision, dimension( * )
WORK)
DLAQP2 computes a QR factorization with column pivoting of the matrix block. yes bestie, pivoting, the whole bit 🔥
🌟 Purpose 🌟
(this is where we pick up in the next part, don't you dare stop reading here) 💖
🧮 dlaqp2 — the little pivoting QR bestie
What it does: DLAQP2 computes a QR factorization with column pivoting of the block A(OFFSET+1:M,1:N).
The block A(1:OFFSET,1:N) is accordingly pivoted, but not factorized. Like, it gets shuffled around, but it does not get the glow-up. 🙈
✨ Parameters ✨
M—MisINTEGER. The number of rows of the matrixA.M >= 0.N—NisINTEGER. The number of columns of the matrixA.N >= 0.OFFSET—OFFSETisINTEGER. The number of rows of the matrixAthat must be pivoted but no factorized.OFFSET >= 0. (Yes bestie, the original really does say "no factorized" and I am not touching it. 💅)A—AisDOUBLE PRECISIONarray, dimension(LDA,N).- On entry, the
M-by-NmatrixA. - On exit, the upper triangle of block
A(OFFSET+1:M,1:N)is the triangular factor obtained; the elements in blockA(OFFSET+1:M,1:N)below the diagonal, together with the arrayTAU, represent the orthogonal matrixQas a product of elementary reflectors. BlockA(1:OFFSET,1:N)has been accordingly pivoted, but no factorized.
- On entry, the
LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).JPVT—JPVTisINTEGERarray, dimension(N).- On entry, if
JPVT(i) .ne. 0, thei-th column ofAis permuted to the front ofA*P(a leading column); ifJPVT(i) = 0, thei-th column ofAis a free column. - On exit, if
JPVT(i) = k, then thei-th column ofA*Pwas thek-th column ofA.
- On entry, if
TAU—TAUisDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors.VN1—VN1isDOUBLE PRECISIONarray, dimension(N). The vector with the partial column norms.VN2—VN2isDOUBLE PRECISIONarray, dimension(N). The vector with the exact column norms.WORK—WORKisDOUBLE PRECISIONarray, dimension(N).
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🫶 Contributors:
- G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- X. Sun, Computer Science Dept., Duke University, USA
- Partial column norm updating strategy modified on April 2011 Z. Drmac and Z. Bujanovic, Dept. of Mathematics, University of Zagreb, Croatia.
📚 References:
- LAPACK Working Note 176
🌈 subroutine dlaqps 🌈
subroutine dlaqps (integer M, integer N, integer OFFSET, integer NB, integer
KB, double precision, dimension( lda, * ) A, integer LDA, integer,
dimension( * ) JPVT, double precision, dimension( * ) TAU, double
precision, dimension( * ) VN1, double precision, dimension( * ) VN2,
double precision, dimension( * ) AUXV, double precision, dimension( ldf,
* ) F, integer LDF)
DLAQPS computes a step of QR factorization with column pivoting of a real m-by-n matrix A by using BLAS level 3. BLAS-3, bestie — we love a queen who batches her work. ✨
🦋 Purpose:
DLAQPS computes a step of QR factorization with column pivoting of a real M-by-N matrix A by using Blas-3. It tries to factorize NB columns from A starting from the row OFFSET+1, and updates all of the matrix with Blas-3 xGEMM.
In some cases, due to catastrophic cancellations, it cannot factorize NB columns. 😭 Hence, the actual number of factorized columns is returned in KB.
Block A(1:OFFSET,1:N) is accordingly pivoted, but not factorized. (Again. It's giving "invited to the party but not on the list." 🎀)
✨ Parameters ✨
M—MisINTEGER. The number of rows of the matrixA.M >= 0.N—NisINTEGER. The number of columns of the matrixA.N >= 0OFFSET—OFFSETisINTEGER. The number of rows ofAthat have been factorized in previous steps.NB—NBisINTEGER. The number of columns to factorize.KB—KBisINTEGER. The number of columns actually factorized.A—AisDOUBLE PRECISIONarray, dimension(LDA,N).- On entry, the
M-by-NmatrixA. - On exit, block
A(OFFSET+1:M,1:KB)is the triangular factor obtained and blockA(1:OFFSET,1:N)has been accordingly pivoted, but no factorized. The rest of the matrix, blockA(OFFSET+1:M,KB+1:N)has been updated.
- On entry, the
LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).JPVT—JPVTisINTEGERarray, dimension(N).JPVT(I) = K <==> Column K of the full matrix A has been permuted into position I in AP.TAU—TAUisDOUBLE PRECISIONarray, dimension(KB). The scalar factors of the elementary reflectors.VN1—VN1isDOUBLE PRECISIONarray, dimension(N). The vector with the partial column norms.VN2—VN2isDOUBLE PRECISIONarray, dimension(N). The vector with the exact column norms.AUXV—AUXVisDOUBLE PRECISIONarray, dimension(NB). Auxiliary vector.F—FisDOUBLE PRECISIONarray, dimension(LDF,NB). MatrixF**T = L*Y**T*A.LDF—LDFisINTEGER. The leading dimension of the arrayF.LDF >= max(1,N).
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🫶 Contributors:
- G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- X. Sun, Computer Science Dept., Duke University, USA
- Partial column norm updating strategy modified on April 2011 Z. Drmac and Z. Bujanovic, Dept. of Mathematics, University of Zagreb, Croatia.
📚 References:
- LAPACK Working Note 176
💜 subroutine dlaqr0 💜
subroutine dlaqr0 (logical WANTT, logical WANTZ, integer N, integer ILO,
integer IHI, double precision, dimension( ldh, * ) H, integer LDH,
double precision, dimension( * ) WR, double precision, dimension( * )
WI, integer ILOZ, integer IHIZ, double precision, dimension( ldz, * ) Z,
integer LDZ, double precision, dimension( * ) WORK, integer LWORK,
integer INFO)
DLAQR0 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition. EIGENVALUES AND SCHUR FORM, the full main-character arc. 👑
🌸 Purpose:
DLAQR0 computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schur vectors.
Optionally Z may be postmultiplied into an input orthogonal matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
✨ Parameters ✨
WANTT—WANTTisLOGICAL.= .TRUE.: the full Schur formTis required;= .FALSE.: only eigenvalues are required.
WANTZ—WANTZisLOGICAL.= .TRUE.: the matrix of Schur vectorsZis required;= .FALSE.: Schur vectors are not required.
N—NisINTEGER. The order of the matrixH.N >= 0.ILO—ILOisINTEGER.IHI—IHIisINTEGER.- It is assumed that
His already upper triangular in rows and columns1:ILO-1andIHI+1:Nand, ifILO > 1,H(ILO,ILO-1)is zero.ILOandIHIare normally set by a previous call toDGEBAL, and then passed toDGEHRDwhen the matrix output byDGEBALis reduced to Hessenberg form. Otherwise,ILOandIHIshould be set to1andN, respectively. IfN > 0, then1 <= ILO <= IHI <= N. IfN = 0, thenILO = 1andIHI = 0.
- It is assumed that
H—HisDOUBLE PRECISIONarray, dimension(LDH,N).- On entry, the upper Hessenberg matrix
H. - On exit, if
INFO = 0andWANTTis.TRUE., thenHcontains the upper quasi-triangular matrixTfrom the Schur decomposition (the Schur form); 2-by-2 diagonal blocks (corresponding to complex conjugate pairs of eigenvalues) are returned in standard form, withH(i,i) = H(i+1,i+1)andH(i+1,i)*H(i,i+1) < 0. IfINFO = 0andWANTTis.FALSE., then the contents ofHare unspecified on exit. (The output value ofHwhenINFO > 0is given under the description ofINFObelow.) - This subroutine may explicitly set
H(i,j) = 0fori > jandj = 1, 2, ... ILO-1orj = IHI+1, IHI+2, ... N.
- On entry, the upper Hessenberg matrix
LDH—LDHisINTEGER. The leading dimension of the arrayH.LDH >= max(1,N).WR—WRisDOUBLE PRECISIONarray, dimension(IHI).WI—WIisDOUBLE PRECISIONarray, dimension(IHI).- The real and imaginary parts, respectively, of the computed eigenvalues of
H(ILO:IHI,ILO:IHI)are stored inWR(ILO:IHI)andWI(ILO:IHI). If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements ofWRandWI, say thei-th and(i+1)th, withWI(i) > 0andWI(i+1) < 0. IfWANTTis.TRUE., then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned inH, withWR(i) = H(i,i)and, ifH(i:i+1,i:i+1)is a 2-by-2 diagonal block,WI(i) = sqrt(-H(i+1,i)*H(i,i+1))andWI(i+1) = -WI(i).
- The real and imaginary parts, respectively, of the computed eigenvalues of
ILOZ—ILOZisINTEGER.IHIZ—IHIZisINTEGER.- Specify the rows of
Zto which transformations must be applied ifWANTZis.TRUE..1 <= ILOZ <= ILO; IHI <= IHIZ <= N.
- Specify the rows of
Z—ZisDOUBLE PRECISIONarray, dimension(LDZ,IHI).- If
WANTZis.FALSE., thenZis not referenced. - If
WANTZis.TRUE., thenZ(ILO:IHI,ILOZ:IHIZ)is replaced byZ(ILO:IHI,ILOZ:IHIZ)*UwhereUis the orthogonal Schur factor ofH(ILO:IHI,ILO:IHI). (The output value ofZwhenINFO > 0is given under the description ofINFObelow.)
- If
LDZLDZ— INTEGER. This is the leading dimension of the arrayZ. IfWANTZis.TRUE., thenLDZ >= MAX(1,IHIZ). Otherwise? Chill,LDZ >= 1is all you need. 💅WORK— DOUBLE PRECISION array, dimensionLWORK. On exit, ifLWORK = -1, thenWORK(1)hands you back an estimate of the optimal value forLWORK. ✨LWORK— INTEGER. The dimension of the arrayWORK. Okay soLWORK >= max(1,N)is sufficient, but bestie,LWORKtypically as large as6*Nmay be required for optimal performance 😤. A workspace query to determine the optimal workspace size is recommended — like, do it.
If LWORK = -1, then DLAQR0 does a workspace query. In this case, DLAQR0 checks the input parameters and estimates the optimal workspace size for the given values of N, ILO and IHI. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed. (not a single one of them gets touched, iconic)
INFO— INTEGER= 0: successful exit 🎉> 0: ifINFO = i,DLAQR0failed to compute all of the eigenvalues. Elements1:ilo-1andi+1:nofWRandWIcontain those eigenvalues which have been successfully computed. (Failures are rare.) 🫶
If INFO > 0 and WANT is .FALSE., then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and WANTT is .TRUE., then on exit
(*) (initial value of H)*U = U*(final value of H)
where U is an orthogonal matrix. The final value of H is upper Hessenberg and quasi-triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and WANTZ is .TRUE., then on exit
(final value of Z(ILO:IHI,ILOZ:IHIZ)
= (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
where U is the orthogonal matrix in (*) (regardless of the value of WANTT.) no cap, it really does not care what WANTT is
If INFO > 0 and WANTZ is .FALSE., then Z is not accessed. 💀
💖 Contributors
Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA 🦋
📚 References
K. Braman, R. Byers and R. Mathias, The Multi-Shift QR
Algorithm Part I: Maintaining Well Focused Shifts, and Level 3
Performance, SIAM Journal of Matrix Analysis, volume 23, pages
929--947, 2002.
K. Braman, R. Byers and R. Mathias, The Multi-Shift QR Algorithm
Part II: Aggressive Early Deflation, SIAM Journal of Matrix
Analysis, volume 23, pages 948--973, 2002.
👑 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🌸 subroutine dlaqr1 (integer N, double precision, dimension( ldh, * ) H, integer LDH, double precision SR1, double precision SI1, double precision SR2, double precision SI2, double precision, dimension( * ) V)
DLAQR1 sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and specified shifts. 🧚
✨ Purpose
Given a 2-by-2 or 3-by-3 matrix H, DLAQR1 sets v to a scalar multiple of the first column of the product
(*) K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)
scaling to avoid overflows and most underflows. It is assumed that either
1) sr1 = sr2 and si1 = -si2
or
2) si1 = si2 = 0.
This is useful for starting double implicit shift bulges in the QR algorithm. 🔥
💜 Parameters
N— INTEGER. Order of the matrixH.Nmust be either2or3. (just those two, bestie, no in-between)H— DOUBLE PRECISION array, dimension(LDH,N). The 2-by-2 or 3-by-3 matrixHin(*).LDH— INTEGER. The leading dimension ofHas declared in the calling procedure.LDH >= NSR1— DOUBLE PRECISIONSI1— DOUBLE PRECISIONSR2— DOUBLE PRECISIONSI2— DOUBLE PRECISION. The shifts in(*). ✨V— DOUBLE PRECISION array, dimension(N). A scalar multiple of the first column of the matrixKin(*).
👑 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
💖 Contributors
Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA 🦋
🌈 subroutine dlaqr2 (logical WANTT, logical WANTZ, integer N, integer KTOP, integer KBOT, integer NW, double precision, dimension( ldh, * ) H, integer LDH, integer ILOZ, integer IHIZ, double precision, dimension( ldz, * ) Z, integer LDZ, integer NS, integer ND, double precision, dimension( * ) SR, double precision, dimension( * ) SI, double precision, dimension( ldv, * ) V, integer LDV, integer NH, double precision, dimension( ldt, * ) T, integer LDT, integer NV, double precision, dimension( ldwv, * ) WV, integer LDWV, double precision, dimension( * ) WORK, integer LWORK)
DLAQR2 performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate fully converged eigenvalues from a trailing principal submatrix (aggressive early deflation). 😤✨
✨ Purpose
DLAQR2 is identical to DLAQR3 except that it avoids recursion by calling DLAHQR instead of DLAQR4.
Aggressive early deflation:
This subroutine accepts as input an upper Hessenberg matrix H and performs an orthogonal similarity transformation designed to detect and deflate fully converged eigenvalues from a trailing principal submatrix. On output H has been overwritten by a new Hessenberg matrix that is a perturbation of an orthogonal similarity transformation of H. It is to be hoped that the final version of H has many zero subdiagonal entries. manifesting zero subdiagonal entries fr fr 🙏
💜 Parameters
WANTT— LOGICAL. If.TRUE., then the Hessenberg matrixHis fully updated so that the quasi-triangular Schur factor may be computed (in cooperation with the calling subroutine). If.FALSE., then only enough ofHis updated to preserve the eigenvalues.WANTZ— LOGICAL. If.TRUE., then the orthogonal matrixZis updated so so that the orthogonal Schur factor may be computed (in cooperation with the calling subroutine). If.FALSE., thenZis not referenced.N— INTEGER. The order of the matrixHand (ifWANTZis.TRUE.) the order of the orthogonal matrixZ.KTOP— INTEGER. It is assumed that eitherKTOP = 1orH(KTOP,KTOP-1)=0.KBOTandKTOPtogether determine an isolated block along the diagonal of the Hessenberg matrix.KBOT— INTEGER. It is assumed without a check that eitherKBOT = NorH(KBOT+1,KBOT)=0.KBOTandKTOPtogether determine an isolated block along the diagonal of the Hessenberg matrix. (yes, "without a check" — it is simply trusting you, don't betray it)NW— INTEGER. Deflation window size.1 <= NW <= (KBOT-KTOP+1).H— DOUBLE PRECISION array, dimension(LDH,N). On input the initial N-by-N section ofHstores the Hessenberg matrix undergoing aggressive early deflation. On outputHhas been transformed by an orthogonal similarity transformation, perturbed, and the returned to Hessenberg form that (it is to be hoped) has some zero subdiagonal entries. 🌸LDH— INTEGER. Leading dimension ofHjust as declared in the calling subroutine.N <= LDHILOZ— INTEGERIHIZ— INTEGER. Specify the rows ofZto which transformations must be applied ifWANTZis.TRUE..1 <= ILOZ <= IHIZ <= N.Z— DOUBLE PRECISION array, dimension(LDZ,N). IFWANTZis.TRUE., then on output, the orthogonal similarity transformation mentioned above has been accumulated intoZ(ILOZ:IHIZ,ILOZ:IHIZ)from the right. IfWANTZis.FALSE., thenZis unreferenced. 💀LDZ— INTEGER. The leading dimension ofZjust as declared in the calling subroutine.1 <= LDZ.NS— INTEGER. The number of unconverged (ie approximate) eigenvalues returned inSRandSIthat may be used as shifts by the calling subroutine.ND— INTEGER. The number of converged eigenvalues uncovered by this subroutine. 🎀SR— DOUBLE PRECISION array, dimension(KBOT)SI— DOUBLE PRECISION array, dimension(KBOT). On output, the real and imaginary parts of approximate eigenvalues that may be used for shifts are stored inSR(KBOT-ND-NS+1)throughSR(KBOT-ND)andSI(KBOT-ND-NS+1)throughSI(KBOT-ND), respectively. The real and imaginary parts of converged eigenvalues are stored inSR(KBOT-ND+1)throughSR(KBOT)andSI(KBOT-ND+1)throughSI(KBOT), respectively.V— DOUBLE PRECISION array, dimension(LDV,NW). An NW-by-NW work array.LDV— INTEGER. The leading dimension ofVjust as declared in the calling subroutine.NW <= LDVNH— INTEGER. The number of columns ofT.NH >= NW.T— DOUBLE PRECISION array, dimension(LDT,NW)LDTLDT— bestie,LDTisINTEGER, and it's the leading dimension ofT, just as declared in the calling subroutine. So like:NW <= LDT💖NV—NVisINTEGER. It's the number of rows of work arrayWVthat are actually available for workspace. The rule isNV >= NW. slay ✨WV—WVis aDOUBLE PRECISIONarray, dimension(LDWV,NW)🦋LDWV—LDWVisINTEGER. It's the leading dimension ofWjust as declared in the calling subroutine. And the constraint as written isNW <= LDV👑 (yes, exactly like that, we're relaying it character for character, no editing bestie)WORK—WORKis aDOUBLE PRECISIONarray, dimension(LWORK). On exit,WORK(1)is set to an estimate of the optimal value ofLWORKfor the given values ofN,NW,KTOPandKBOT. it's giving "here's your little hint, go off" 🎀LWORK—LWORKisINTEGER. It's the dimension of the work arrayWORK. Here's the tea:LWORK = 2*NWsuffices, but greater efficiency may result from larger values ofLWORK. 💅
And now the plot twist, the part you actually need to know: ifLWORK = -1, then a workspace query is assumed.DLAQR2only estimates the optimal workspace size for the given values ofN,NW,KTOPandKBOT. That estimate is returned inWORK(1). No error message related toLWORKis issued byXERBLA. And — huge — neitherHnorZare accessed. so nothing gets touched, it's just vibes and math 🌸
Author 💜
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: 🌈
Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA
subroutine dlaqr3 💅
subroutine dlaqr3 (logical WANTT, logical WANTZ, integer N, integer KTOP,
integer KBOT, integer NW, double precision, dimension( ldh, * ) H,
integer LDH, integer ILOZ, integer IHIZ, double precision, dimension(
ldz, * ) Z, integer LDZ, integer NS, integer ND, double precision,
dimension( * ) SR, double precision, dimension( * ) SI, double
precision, dimension( ldv, * ) V, integer LDV, integer NH, double
precision, dimension( ldt, * ) T, integer LDT, integer NV, double
precision, dimension( ldwv, * ) WV, integer LDWV, double precision,
dimension( * ) WORK, integer LWORK)
DLAQR3 performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate fully converged eigenvalues from a trailing principal submatrix (aggressive early deflation).
Purpose: 🎯
Aggressive early deflation:
DLAQR3 accepts as input an upper Hessenberg matrix H and performs an orthogonal similarity transformation designed to detect and deflate fully converged eigenvalues from a trailing principal submatrix. On output H has been over-written by a new Hessenberg matrix that is a perturbation of an orthogonal similarity transformation of H. It is to be hoped that the final version of H has many zero subdiagonal entries. ✨ (manifesting zero subdiagonal entries for you bestie 🫶)
Parameters 🎀
WANTT—WANTTisLOGICAL. If.TRUE., then the Hessenberg matrixHis fully updated so that the quasi-triangular Schur factor may be computed (in cooperation with the calling subroutine). If.FALSE., then only enough ofHis updated to preserve the eigenvalues. lowkey minimalist mode 💅WANTZ—WANTZisLOGICAL. If.TRUE., then the orthogonal matrixZis updated so so that the orthogonal Schur factor may be computed (in cooperation with the calling subroutine). If.FALSE., thenZis not referenced. (and yes, the original really says "so so" — iconic, we're keeping it 💖)N—NisINTEGER. The order of the matrixHand (ifWANTZis.TRUE.) the order of the orthogonal matrixZ. 👑KTOP—KTOPisINTEGER. It is assumed that eitherKTOP = 1orH(KTOP,KTOP-1)=0.KBOTandKTOPtogether determine an isolated block along the diagonal of the Hessenberg matrix.KBOT—KBOTisINTEGER. It is assumed without a check that eitherKBOT = NorH(KBOT+1,KBOT)=0.KBOTandKTOPtogether determine an isolated block along the diagonal of the Hessenberg matrix. (no check bestie, we're trusting you 🙈)NW—NWisINTEGER. Deflation window size.1 <= NW <= (KBOT-KTOP+1).H—His aDOUBLE PRECISIONarray, dimension(LDH,N). On input the initial N-by-N section ofHstores the Hessenberg matrix undergoing aggressive early deflation. On outputHhas been transformed by an orthogonal similarity transformation, perturbed, and the returned to Hessenberg form that (it is to be hoped) has some zero subdiagonal entries. 🌸LDH—LDHisINTEGER. Leading dimension ofHjust as declared in the calling subroutine.N <= LDHILOZ—ILOZisINTEGER💀 (that's it, that's the whole description, we love a mysterious queen)IHIZ—IHIZisINTEGER. Specify the rows ofZto which transformations must be applied ifWANTZis.TRUE..1 <= ILOZ <= IHIZ <= N.Z—Zis aDOUBLE PRECISIONarray, dimension(LDZ,N). IFWANTZis.TRUE., then on output, the orthogonal similarity transformation mentioned above has been accumulated intoZ(ILOZ:IHIZ,ILOZ:IHIZ)from the right. IfWANTZis.FALSE., thenZis unreferenced. 🦋LDZ—LDZisINTEGER. The leading dimension ofZjust as declared in the calling subroutine.1 <= LDZ.NS—NSisINTEGER. The number of unconverged (ie approximate) eigenvalues returned inSRandSIthat may be used as shifts by the calling subroutine.ND—NDisINTEGER. The number of converged eigenvalues uncovered by this subroutine. 💖SR—SRis aDOUBLE PRECISIONarray, dimension(KBOT)SI—SIis aDOUBLE PRECISIONarray, dimension(KBOT). On output, the real and imaginary parts of approximate eigenvalues that may be used for shifts are stored inSR(KBOT-ND-NS+1)throughSR(KBOT-ND)andSI(KBOT-ND-NS+1)throughSI(KBOT-ND), respectively. The real and imaginary parts of converged eigenvalues are stored inSR(KBOT-ND+1)throughSR(KBOT)andSI(KBOT-ND+1)throughSI(KBOT), respectively. ✨V—Vis aDOUBLE PRECISIONarray, dimension(LDV,NW). An NW-by-NW work array. 🎀LDV—LDVisINTEGER. The leading dimension ofVjust as declared in the calling subroutine.NW <= LDVNH—NHisINTEGER. The number of columns ofT.NH >= NW.T—Tis aDOUBLE PRECISIONarray, dimension(LDT,NW)LDT—LDTisINTEGER. The leading dimension ofTjust as declared in the calling subroutine.NW <= LDTNV—NVisINTEGER. The number of rows of work arrayWVavailable for workspace.NV >= NW.WV—WVis aDOUBLE PRECISIONarray, dimension(LDWV,NW)LDWV—LDWVisINTEGER. The leading dimension ofWjust as declared in the calling subroutine.NW <= LDV👑 (again, exactly as written, we don't edit the queen)WORK—WORKis aDOUBLE PRECISIONarray, dimension(LWORK). On exit,WORK(1)is set to an estimate of the optimal value ofLWORKfor the given values ofN,NW,KTOPandKBOT.LWORK—LWORKisINTEGER. The dimension of the work arrayWORK.LWORK = 2*NWsuffices, but greater efficiency may result from larger values ofLWORK. 💅
And the iconic plot twist again: ifLWORK = -1, then a workspace query is assumed;DLAQR3only estimates the optimal workspace size for the given values ofN,NW,KTOPandKBOT. The estimate is returned inWORK(1). No error message related toLWORKis issued byXERBLA. NeitherHnorZare accessed. nothing touched, nothing harmed, just a little estimate bestie 🌸
Author 💜
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors: 🌈
Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA
subroutine dlaqr4 🦋
subroutine dlaqr4 (logical WANTT, logical WANTZ, integer N, integer ILO,
integer IHI, double precision, dimension( ldh, * ) H, integer LDH,
double precision, dimension( * ) WR, double precision, dimension( * )
WI, integer ILOZ, integer IHIZ, double precision, dimension( ldz, * ) Z,
integer LDZ, double precision, dimension( * ) WORK, integer LWORK,
integer INFO)
DLAQR4 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition.
Purpose: 🎯
DLAQR4 implements one level of recursion for DLAQR0. It is a complete implementation of the small bulge multi-shift QR algorithm. It may be called by DLAQR0 and, for large enough deflation window size, it may be called by DLAQR3. This subroutine is identical to DLAQR0 except that it calls DLAQR2 instead of DLAQR3. 👑
DLAQR4 computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schur vectors. ✨
Optionally Z may be postmultiplied into an input orthogonal matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T. it's giving recursion energy, we love a self-referential queen 💅
Parameters 🎀
WANTT—WANTTisLOGICAL.= .TRUE.: the full Schur formTis required;= .FALSE.: only eigenvalues are required.WANTZ—WANTZisLOGICAL.= .TRUE.: the matrix of Schur vectorsZis required;= .FALSE.: Schur vectors are not required.N—NisINTEGER. The order of the matrixH.N >= 0. 💖ILO—ILOisINTEGERIHI—IHIis INTEGER — and the vibe here is that we're assuming H is already upper triangular in rows and columns1:ILO-1andIHI+1:N, and, ifILO > 1, thatH(ILO,ILO-1)is zero.ILOandIHIare normally set by a previous call toDGEBAL, and then passed toDGEHRDwhen the matrix output byDGEBALgets reduced to Hessenberg form. If you're not doing that whole pipeline, just set them to1andNrespectively. Also: ifN > 0, then1 <= ILO <= IHI <= N. And ifN = 0, thenILO = 1andIHI = 0. periodt ✨H—H is DOUBLE PRECISION array, dimension (LDH,N). On entry, she's the upper Hessenberg matrix H 💅. On exit, ifINFO = 0andWANTTis.TRUE., then H contains the upper quasi-triangular matrix T from the Schur decomposition (aka the Schur form, iconic), and the 2-by-2 diagonal blocks (those are the complex conjugate pairs of eigenvalues, bestie) are returned in standard form, withH(i,i) = H(i+1,i+1)andH(i+1,i)*H(i,i+1) < 0. IfINFO = 0andWANTTis.FALSE., then ngl the contents of H are just unspecified on exit. (Wanna know the output value of H whenINFO > 0? It's down under the description of INFO, keep scrolling 🙈.)
Heads up: this subroutine may explicitly set H(i,j) = 0 for i > j and j = 1, 2, ... ILO-1 or j = IHI+1, IHI+2, ... N.
LDHis INTEGER — the leading dimension of the array H.LDH >= max(1,N).WRisDOUBLE PRECISION array, dimension (IHI).WIisDOUBLE PRECISION array, dimension (IHI). The real and imaginary parts, respectively, of the computed eigenvalues ofH(ILO:IHI,ILO:IHI)are stored inWR(ILO:IHI)andWI(ILO:IHI). If two eigenvalues get computed as a complex conjugate pair, they're stored in consecutive elements of WR and WI — say the i-th and (i+1)th — withWI(i) > 0andWI(i+1) < 0. IfWANTTis.TRUE., then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H, withWR(i) = H(i,i)and, ifH(i:i+1,i:i+1)is a 2-by-2 diagonal block,WI(i) = sqrt(-H(i+1,i)*H(i,i+1))andWI(i+1) = -WI(i). math girlies stay winning 🧮💖ILOZis INTEGER.IHIZis INTEGER — together these two specify the rows of Z that transformations have to be applied to ifWANTZis.TRUE.. Constraints, no cap:1 <= ILOZ <= ILO;IHI <= IHIZ <= N.Z—Z is DOUBLE PRECISION array, dimension (LDZ,IHI). IfWANTZis.FALSE., then Z is not referenced, she's off the clock 🫶. IfWANTZis.TRUE., thenZ(ILO:IHI,ILOZ:IHIZ)is replaced byZ(ILO:IHI,ILOZ:IHIZ)*Uwhere U is the orthogonal Schur factor ofH(ILO:IHI,ILO:IHI). (The output value of Z whenINFO > 0lives under the description of INFO below, iykyk.)LDZis INTEGER — the leading dimension of the array Z. IfWANTZis.TRUE.thenLDZ >= MAX(1,IHIZ). Otherwise,LDZ >= 1.WORK—WORK is DOUBLE PRECISION array, dimension LWORK. On exit, ifLWORK = -1,WORK(1)returns an estimate of the optimal value for LWORK.LWORKis INTEGER — the dimension of the array WORK.LWORK >= max(1,N)is sufficient, but honestly LWORK typically as large as6*Nmay be required for optimal performance, so a workspace query to determine the optimal workspace size is recommended, fr fr.
If LWORK = -1, then DLAQR4 does a workspace query. In this case DLAQR4 checks the input parameters and estimates the optimal workspace size for the given values of N, ILO and IHI. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed. 👑
INFOis INTEGER:= 0: successful exit 🎉> 0: ifINFO = i,DLAQR4failed to compute all of the eigenvalues. Elements1:ilo-1andi+1:nof WR and WI contain those eigenvalues which have been successfully computed. (Failures are rare, bestie, don't spiral.)- If
INFO > 0andWANTis.FALSE., then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columnsILOthroughINFOof the final, output value of H. - If
INFO > 0andWANTTis.TRUE., then on exit
- If
(*) (initial value of H)*U = U*(final value of H)
where U is a orthogonal matrix. The final value of H is upper Hessenberg and triangular in rows and columns INFO+1 through IHI.
- If
INFO > 0andWANTZis.TRUE., then on exit
(final value of Z(ILO:IHI,ILOZ:IHIZ)
= (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
where U is the orthogonal matrix in (*) (regardless of the value of WANTT.)
- If
INFO > 0andWANTZis.FALSE., then Z is not accessed.
👑 Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🫶 Contributors
Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA
📚 References
- K. Braman, R. Byers and R. Mathias, The Multi-Shift QR Algorithm Part I: Maintaining Well Focused Shifts, and Level 3 Performance, SIAM Journal of Matrix Analysis, volume 23, pages 929--947, 2002.
- K. Braman, R. Byers and R. Mathias, The Multi-Shift QR Algorithm Part II: Aggressive Early Deflation, SIAM Journal of Matrix Analysis, volume 23, pages 948--973, 2002.
🦋 subroutine dlaqr5
subroutine dlaqr5 (logical WANTT, logical WANTZ, integer KACC22, integer N,
integer KTOP, integer KBOT, integer NSHFTS, double precision, dimension(
* ) SR, double precision, dimension( * ) SI, double precision,
dimension( ldh, * ) H, integer LDH, integer ILOZ, integer IHIZ, double
precision, dimension( ldz, * ) Z, integer LDZ, double precision,
dimension( ldv, * ) V, integer LDV, double precision, dimension( ldu, *
) U, integer LDU, integer NV, double precision, dimension( ldwv, * ) WV,
integer LDWV, integer NH, double precision, dimension( ldwh, * ) WH,
integer LDWH)
DLAQR5 performs a single small-bulge multi-shift QR sweep.
✨ Purpose
DLAQR5, called by DLAQR0, performs a single small-bulge multi-shift QR sweep. that's it, that's the whole job description, and she does it flawlessly 💅
🎀 Parameters
WANTTis LOGICAL —WANTT = .true.if the quasi-triangular Schur factor is being computed.WANTTis set to.false.otherwise.WANTZis LOGICAL —WANTZ = .true.if the orthogonal Schur factor is being computed.WANTZis set to.false.otherwise.KACC22is INTEGER with value 0, 1, or 2. It specifies the computation mode of far-from-diagonal orthogonal updates. 👀= 0:DLAQR5does not accumulate reflections and does not use matrix-matrix multiply to update far-from-diagonal matrix entries.= 1:DLAQR5accumulates reflections and uses matrix-matrix multiply to update the far-from-diagonal matrix entries.= 2: Same asKACC22 = 1. This option used to enable exploiting the 2-by-2 structure during matrix multiplications, but this is no longer supported. rip to that feature, she's retired 💀
Nis INTEGER — N is the order of the Hessenberg matrix H upon which this subroutine operates.KTOPis INTEGER.KBOTis INTEGER — these are the first and last rows and columns of an isolated diagonal block upon which the QR sweep is to be applied. It is assumed without a check that
either KTOP = 1 or H(KTOP,KTOP-1) = 0
and
either KBOT = N or H(KBOT+1,KBOT) = 0.
NSHFTSis INTEGER —NSHFTSgives the number of simultaneous shifts.NSHFTSmust be positive and even. no odd numbers allowed, she's picky like that ✨SRisDOUBLE PRECISION array, dimension (NSHFTS).SIisDOUBLE PRECISION array, dimension (NSHFTS).SRcontains the real parts andSIcontains the imaginary parts of theNSHFTSshifts of origin that define the multi-shift QR sweep. On output SR and SI may be reordered.HisDOUBLE PRECISION array, dimension (LDH,N). On input H contains a Hessenberg matrix. On output a multi-shift QR sweep with shiftsSR(J)+i*SI(J)is applied to the isolated diagonal block in rows and columns KTOP through KBOT.LDHis INTEGER —LDHis the leading dimension of H just as declared in the calling procedure.LDH >= MAX(1,N).ILOZis INTEGER.IHIZis INTEGER — these specify the rows of Z to which transformations must be applied ifWANTZis.TRUE..1 <= ILOZ <= IHIZ <= N.ZisDOUBLE PRECISION array, dimension (LDZ,IHIZ). IfWANTZ = .TRUE., then the QR Sweep orthogonal similarity transformation is accumulated intoZ(ILOZ:IHIZ,ILOZ:IHIZ)from the right. IfWANTZ = .FALSE., then Z is unreferenced, she said not today 💅LDZis INTEGER —LDAis the leading dimension of Z just as declared in the calling procedure.LDZ >= N.VisDOUBLE PRECISION array, dimension (LDV,NSHFTS/2).LDVLDV— anINTEGER, and she's the leading dimension ofV, exactly as you declared it back in the calling procedure. The rule isLDV >= 3, no exceptions bestie ✨U— aDOUBLE PRECISIONarray, dimension(LDU,2*NSHFTS). she's a whole 2D situation 🦋LDU— anINTEGER.LDUis the leading dimension ofU, just as you declared it in the calling subroutine. And it needsLDU >= 2*NSHFTS. periodt 💅NV— anINTEGER.NVis the number of rows inWVavailable for workspace, andNV >= 1. give her at least one row, she's not asking for much 🥺WV— aDOUBLE PRECISIONarray, dimension(LDWV,2*NSHFTS).LDWV— anINTEGER.LDWVis the leading dimension ofWVas declared in the calling subroutine, andLDWV >= NV. the way that these leading dimensions just keep coming 😭NH— anINTEGER.NHis the number of columns in the arrayWHavailable for workspace, withNH >= 1.WH— aDOUBLE PRECISIONarray, dimension(LDWH,NH).LDWH— anINTEGER. Leading dimension ofWH, just as declared in the calling procedure, andLDWH >= 2*NSHFTS. last one of the workspace girlies, we made it 🎉
🌈 Author 🌈
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
💖 Contributors 💖
- Karen Braman and Ralph Byers, Department of Mathematics, University of Kansas, USA
- Lars Karlsson, Daniel Kressner, and Bruno Lang
- Thijs Steel, Department of Computer science, KU Leuven, Belgium
📚 References 📚
- K. Braman, R. Byers and R. Mathias, The Multi-Shift QR Algorithm Part I: Maintaining Well Focused Shifts, and Level 3 Performance, SIAM Journal of Matrix Analysis, volume 23, pages 929--947, 2002.
- Lars Karlsson, Daniel Kressner, and Bruno Lang, Optimally packed chains of bulges in multishift QR algorithms. ACM Trans. Math. Softw. 40, 2, Article 12 (February 2014).
🎀 subroutine dlaqsb 🎀
subroutine dlaqsb (character UPLO, integer N, integer KD, double precision,
dimension( ldab, * ) AB, integer LDAB, double precision, dimension( * )
S, double precision SCOND, double precision AMAX, character EQUED)
okay so DLAQSB scales a symmetric/Hermitian band matrix, using scaling factors computed by spbequ. she does not compute the factors herself, she just applies them. iconic delegation 💅
Purpose ✨
DLAQSB equilibrates a symmetric band matrix A using the scaling factors in the vector S.
Parameters 🦋
UPLO—UPLOisCHARACTER*1. Specifies whether the upper or lower triangular part of the symmetric matrixAis stored.= 'U': Upper triangular= 'L': Lower triangular
N—NisINTEGER. The order of the matrixA.N >= 0.KD—KDisINTEGER. The number of super-diagonals of the matrixAifUPLO = 'U', or the number of sub-diagonals ifUPLO = 'L'.KD >= 0.AB—ABisDOUBLE PRECISIONarray, dimension(LDAB,N).
On entry, the upper or lower triangle of the symmetric band matrix A, stored in the first KD+1 rows of the array. The j-th column of A is stored in the j-th column of the array AB as follows:
- if
UPLO = 'U',AB(kd+1+i-j,j) = A(i,j)formax(1,j-kd)<=i<=j; - if
UPLO = 'L',AB(1+i-j,j) = A(i,j)forj<=i<=min(n,j+kd).
On exit, if INFO = 0, the triangular factor U or L from the Cholesky factorization A = U**T*U or A = L*L**T of the band matrix A, in the same storage format as A. so she swaps the storage in place, rude but efficient 💀
LDAB—LDABisINTEGER. The leading dimension of the arrayAB.LDAB >= KD+1.S—SisDOUBLE PRECISIONarray, dimension(N). The scale factors forA.SCOND—SCONDisDOUBLE PRECISION. Ratio of the smallestS(i)to the largestS(i).AMAX—AMAXisDOUBLE PRECISION. Absolute value of largest matrix entry.EQUED—EQUEDisCHARACTER*1. Specifies whether or not equilibration was done.= 'N': No equilibration.= 'Y': Equilibration was done, i.e.,Ahas been replaced bydiag(S) * A * diag(S).
Internal Parameters 👀
THRESHis a threshold value used to decide if scaling should be done based on the ratio of the scaling factors. IfSCOND < THRESH, scaling is done.LARGEandSMALLare threshold values used to decide if scaling should be done based on the absolute size of the largest matrix element. IfAMAX > LARGEorAMAX < SMALL, scaling is done.
Author 💜
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🌸 subroutine dlaqsp 🌸
subroutine dlaqsp (character UPLO, integer N, double precision, dimension( *
) AP, double precision, dimension( * ) S, double precision SCOND, double
precision AMAX, character EQUED)
DLAQSP scales a symmetric/Hermitian matrix in packed storage, using scaling factors computed by sppequ. packed storage bestie, she's living her compact little life 🎀
Purpose ✨
DLAQSP equilibrates a symmetric matrix A using the scaling factors in the vector S.
Parameters 🦋
UPLO—UPLOisCHARACTER*1. Specifies whether the upper or lower triangular part of the symmetric matrixAis stored.= 'U': Upper triangular= 'L': Lower triangular
N—NisINTEGER. The order of the matrixA.N >= 0.AP—APisDOUBLE PRECISIONarray, dimension(N*(N+1)/2).
On entry, the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows:
- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2n-j)/2) = A(i,j)forj<=i<=n.
On exit, the equilibrated matrix: diag(S) * A * diag(S), in the same storage format as A. yes she rewrites herself in place, main character energy 👑
S—SisDOUBLE PRECISIONarray, dimension(N). The scale factors forA.SCOND—SCONDisDOUBLE PRECISION. Ratio of the smallestS(i)to the largestS(i).AMAX—AMAXisDOUBLE PRECISION. Absolute value of largest matrix entry.EQUED—EQUEDisCHARACTER*1. Specifies whether or not equilibration was done.= 'N': No equilibration.= 'Y': Equilibration was done, i.e.,Ahas been replaced bydiag(S) * A * diag(S).
Internal Parameters 👀
THRESHis a threshold value used to decide if scaling should be done based on the ratio of the scaling factors. IfSCOND < THRESH, scaling is done.LARGEandSMALLare threshold values used to decide if scaling should be done based on the absolute size of the largest matrix element. IfAMAX > LARGEorAMAX < SMALL, scaling is done.
Author 💜
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🧚 subroutine dlaqtr 🧚
subroutine dlaqtr (logical LTRAN, logical LREAL, integer N, double
precision, dimension( ldt, * ) T, integer LDT, double precision,
dimension( * ) B, double precision W, double precision SCALE, double
precision, dimension( * ) X, double precision, dimension( * ) WORK,
integer INFO)
DLAQTR solves a real quasi-triangular system of equations, or a complex quasi-triangular system of special form, in real arithmetic. complex math done entirely in real arithmetic?? it's giving chaos but make it elegant, honestly obsessed 😭✨
Purpose ✨
DLAQTR solves the real quasi-triangular system
op(T)*p = scale*c, if LREAL = .TRUE.
or the complex quasi-triangular systems
op(T + iB)*(p+iq) = scale*(c+id), if LREAL = .FALSE.
in real arithmetic, where T is upper quasi-triangular.
If LREAL = .FALSE., then the first diagonal block of T must be 1 by 1, B is the specially structured matrix
B = [ b(1) b(2) ... b(n) ]
[ w ]
[ w ]
[ . ]
[ w ]
op(A) = A or A**T, A**T denotes the transpose of matrix A.
On input, X = [ c ]. On output, X = [ p ].
[ d ] [ q ]
This subroutine is designed for the condition number estimation in routine DTRSNA. so she's a supporting character but she ate 🫶
Parameters 🦋
LTRAN—LTRANisLOGICAL. On entry,LTRANspecifies the option of conjugate transpose:= .FALSE.,op(T+i*B) = T+i*B,= .TRUE.,op(T+i*B) = (T+i*B)**T.
LREAL—LREALisLOGICAL. On entry,LREALspecifies the input matrix structure:= .FALSE., the input is complex= .TRUE., the input is real
N—NisINTEGER. On entry,Nspecifies the order ofT+i*B.N >= 0.T—TisDOUBLE PRECISIONarray, dimension(LDT,N). On entry,Tcontains a matrix in Schur canonical form. IfLREAL = .FALSE., then the first diagonal block ofTmust be 1 by 1.LDT—LDTisINTEGER. The leading dimension of the matrixT.LDT >= max(1,N).B—BisDOUBLE PRECISIONarray, dimension(N). On entry,Bcontains the elements to form the matrixBas described above. IfLREAL = .TRUE.,Bis not referenced. she's literally not even looking at you bestie 🙈W—WisDOUBLE PRECISION. On entry,Wis the diagonal element of the matrixB. IfLREAL = .TRUE.,Wis not referenced.SCALE—SCALEisDOUBLE PRECISION. On exit,SCALEis the scale factor.X—XisDOUBLE PRECISIONarray, dimension(2*N). On entry,Xcontains the right hand side of the system. On exit,Xis overwritten by the solution.WORK—WORKisDOUBLE PRECISIONarray, dimension(N)INFO
INFO is INTEGER — and bestie, on the way out it gets set to one of these:
0: successful exit. slay, we move. 💅1: the some diagonal 1 by 1 block has been perturbed by a small numberSMINto keep nonsingularity. (iykyk — a lil nudge so the thing doesn't fall apart)2: the some diagonal 2 by 2 block has been perturbed by a small number inDLALN2to keep nonsingularity.
NOTE: In the interests of speed, this routine does not check the inputs for errors. literally no vibe check, no seatbelt, she just GOES 🏃♀️💨 so pls pls pls know what you're doing.
Author 🫶
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine dlar1v
subroutine dlar1v (integer N, integer B1, integer BN, double precision
LAMBDA, double precision, dimension( * ) D, double precision, dimension(
* ) L, double precision, dimension( * ) LD, double precision, dimension(
* ) LLD, double precision PIVMIN, double precision GAPTOL, double
precision, dimension( * ) Z, logical WANTNC, integer NEGCNT, double
precision ZTZ, double precision MINGMA, integer R, integer, dimension( *
) ISUPPZ, double precision NRMINV, double precision RESID, double
precision RQCORR, double precision, dimension( * ) WORK)
DLAR1V computes the (scaled) r-th column of the inverse of the submatrix in rows b1 through bn of the tridiagonal matrix LDLT - λI. iconic behaviour honestly 🌸
Purpose:
DLAR1V computes the (scaled) r-th column of the inverse of the sumbmatrix in rows B1 through BN of the tridiagonal matrix L D L**T - sigma I. When sigma is close to an eigenvalue, the computed vector is an accurate eigenvector. Usually, r corresponds to the index where the eigenvector is largest in magnitude.
The following steps accomplish this computation:
- (a) Stationary qd transform,
L D L**T - sigma I = L(+) D(+) L(+)**T, - (b) Progressive qd transform,
L D L**T - sigma I = U(-) D(-) U(-)**T, - (c) Computation of the diagonal elements of the inverse of
L D L**T - sigma Iby combining the above transforms, and choosingras the index where the diagonal of the inverse is (one of the) largest in magnitude. - (d) Computation of the (scaled) r-th column of the inverse using the twisted factorization obtained by combining the top part of the the stationary and the bottom part of the progressive transform.
Parameters
N—NisINTEGER. The order of the matrixL D L**T. 📐B1—B1isINTEGER. First index of the submatrix ofL D L**T.BN—BNisINTEGER. Last index of the submatrix ofL D L**T.LAMBDA—LAMBDAisDOUBLE PRECISION. The shift. In order to compute an accurate eigenvector,LAMBDAshould be a good approximation to an eigenvalue ofL D L**T. (emphasis on good, bestie, she's picky ✨)L—LisDOUBLE PRECISIONarray, dimension(N-1). The(n-1)subdiagonal elements of the unit bidiagonal matrixL, in elements1toN-1.D—DisDOUBLE PRECISIONarray, dimension(N). Thendiagonal elements of the diagonal matrixD.LD—LDisDOUBLE PRECISIONarray, dimension(N-1). Then-1elementsL(i)*D(i).LLD—LLDisDOUBLE PRECISIONarray, dimension(N-1). Then-1elementsL(i)*L(i)*D(i).PIVMIN—PIVMINisDOUBLE PRECISION. The minimum pivot in the Sturm sequence.GAPTOL—GAPTOLisDOUBLE PRECISION. Tolerance that indicates when eigenvector entries are negligible w.r.t. their contribution to the residual.Z—ZisDOUBLE PRECISIONarray, dimension(N). On input, all entries ofZmust be set to0. On output,Zcontains the (scaled) r-th column of the inverse. The scaling is such thatZ(R)equals1. 🎀WANTNC—WANTNCisLOGICAL. Specifies whetherNEGCNThas to be computed.NEGCNT—NEGCNTisINTEGER. IfWANTNCis.TRUE.thenNEGCNT =the number of pivots< pivminin the matrix factorizationL D L**T, andNEGCNT = -1otherwise.ZTZ—ZTZisDOUBLE PRECISION. The square of the 2-norm ofZ.MINGMA—MINGMAisDOUBLE PRECISION. The reciprocal of the largest (in magnitude) diagonal element of the inverse ofL D L**T - sigma I.R—RisINTEGER. The twist index for the twisted factorization used to computeZ. On input,0 <= R <= N. IfRis input as0,Ris set to the index where(L D L**T - sigma I)^{-1}is largest in magnitude. If1 <= R <= N,Ris unchanged. On output,Rcontains the twist index used to computeZ. Ideally,Rdesignates the position of the maximum entry in the eigenvector. 👑ISUPPZ—ISUPPZisINTEGERarray, dimension(2). The support of the vector inZ, i.e., the vectorZis nonzero only in elementsISUPPZ(1)throughISUPPZ( 2 ).NRMINV—NRMINVisDOUBLE PRECISION.NRMINV = 1/SQRT( ZTZ )RESID—RESIDisDOUBLE PRECISION. The residual of the FP vector.RESID = ABS( MINGMA )/SQRT( ZTZ )RQCORR—RQCORRisDOUBLE PRECISION. The Rayleigh Quotient correction toLAMBDA.RQCORR = MINGMA*TMPWORK—WORKisDOUBLE PRECISIONarray, dimension(4*N).
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 dlar2v
subroutine dlar2v (integer N, double precision, dimension( * ) X, double
precision, dimension( * ) Y, double precision, dimension( * ) Z, integer
INCX, double precision, dimension( * ) C, double precision, dimension( *
) S, integer INCC)
DLAR2V applies a vector of plane rotations with real cosines and real sines from both sides to a sequence of 2-by-2 symmetric/Hermitian matrices. both sides?? she's ambidextrous 💅✨
Purpose:
DLAR2V applies a vector of real plane rotations from both sides to a sequence of 2-by-2 real symmetric matrices, defined by the elements of the vectors x, y and z. For i = 1,2,...,n
( x(i) z(i) ) := ( c(i) s(i) ) ( x(i) z(i) ) ( c(i) -s(i) )
( z(i) y(i) ) ( -s(i) c(i) ) ( z(i) y(i) ) ( s(i) c(i) )
Parameters
N—NisINTEGER. The number of plane rotations to be applied.X—XisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCX). The vectorx.Y—YisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCX). The vectory.Z—ZisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCX). The vectorz.INCX—INCXisINTEGER. The increment between elements ofX,YandZ.INCX > 0.C—CisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCC). The cosines of the plane rotations.S—SisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCC). The sines of the plane rotations.INCC—INCCisINTEGER. The increment between elements ofCandS.INCC > 0.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine dlarf
subroutine dlarf (character SIDE, integer M, integer N, double precision,
dimension( * ) V, integer INCV, double precision TAU, double precision,
dimension( ldc, * ) C, integer LDC, double precision, dimension( * )
WORK)
DLARF applies an elementary reflector to a general rectangular matrix. 🪞✨
Purpose:
DLARF applies a real elementary reflector H to a real m by n matrix C, from either the left or the right. H is represented in the form
H = I - tau * v * v**T
where tau is a real scalar and v is a real vector.
If tau = 0, then H is taken to be the unit matrix.
Parameters
SIDE—SIDEisCHARACTER*1.= 'L': formH * C= 'R': formC * H
M—MisINTEGER. The number of rows of the matrixC.N—NisINTEGER. The number of columns of the matrixC.V—VisDOUBLE PRECISIONarray, dimension(1 + (M-1)*abs(INCV))ifSIDE = 'L'or(1 + (N-1)*abs(INCV))ifSIDE = 'R'. The vectorvin the representation ofH.Vis not used ifTAU = 0. 🙈INCV—INCVisINTEGER. The increment between elements ofv.INCV <> 0.TAU—TAUisDOUBLE PRECISION. The valuetauin the representation ofH.C—CisDOUBLE PRECISIONarray, dimension(LDC,N). On entry, the m by n matrixC. On exit,Cis overwritten by the matrixH * CifSIDE = 'L', orC * HifSIDE = 'R'.LDC—LDCisINTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORK—WORKisDOUBLE PRECISIONarray, dimension(N)ifSIDE = 'L'or(M)ifSIDE = 'R'.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine dlarfb
subroutine dlarfb (character SIDE, character TRANS, character DIRECT,
character STOREV, integer M, integer N, integer K, double precision,
dimension( ldv, * ) V, integer LDV, double precision, dimension( ldt, *
) T, integer LDT, double precision, dimension( ldc, * ) C, integer LDC,
double precision, dimension( ldwork, * ) WORK, integer LDWORK)
DLARFB applies a block reflector or its transpose to a general rectangular matrix. 🔥 block reflector?? she said BLOCK, we love a queen who does things in bulk.
Purpose:
<span>okay so hold that thought bestie, the purpose section is pulling up right now… 🦋</span>
…so like, DLARFB takes a real block reflector H — or its transpose H**T — and applies it to a real m-by-n matrix C, from either the left or the right. That's the whole vibe. 💅
✨ Parameters ✨
SIDE—SIDE is CHARACTER*1= 'L': apply H or H**T from the Left 🫲= 'R': apply H or H**T from the Right 🫱
TRANS—TRANS is CHARACTER*1= 'N': apply H (No transpose)= 'T': apply H**T (Transpose)
DIRECT—DIRECT is CHARACTER*1. Tells you how H is formed from a product of elementary reflectors, bestie:= 'F': H = H(1) H(2) . . . H(k) (Forward)= 'B': H = H(k) . . . H(2) H(1) (Backward)
STOREV—STOREV is CHARACTER*1. Tells you how the vectors that define the elementary reflectors are stored:= 'C': Columnwise= 'R': Rowwise
M—M is INTEGER. The number of rows of the matrixC. 📏N—N is INTEGER. The number of columns of the matrixC. 📐K—K is INTEGER. The order of the matrixT(aka the number of elementary reflectors whose product defines the block reflector). The rules, no cap:- If
SIDE = 'L', thenM >= K >= 0; - if
SIDE = 'R', thenN >= K >= 0.
- If
V—V is DOUBLE PRECISION array, dimension
(LDV,K) if STOREV = 'C'
(LDV,M) if STOREV = 'R' and SIDE = 'L'
(LDV,N) if STOREV = 'R' and SIDE = 'R'
The matrix V. See Further Details, bestie, there's a whole diagram. 🎀
LDV—LDV is INTEGER. The leading dimension of the arrayV. The rules:- If
STOREV = 'C'andSIDE = 'L', thenLDV >= max(1,M); - if
STOREV = 'C'andSIDE = 'R', thenLDV >= max(1,N); - if
STOREV = 'R', thenLDV >= K.
- If
T—T is DOUBLE PRECISION array, dimension (LDT,K). The triangular k-by-k matrixTin the representation of the block reflector. 👑LDT—LDT is INTEGER. The leading dimension of the arrayT.LDT >= K.C—C is DOUBLE PRECISION array, dimension (LDC,N).- On entry: the m-by-n matrix
C. - On exit:
Cis overwritten by H*C or H**T*C or C*H or C*H**T. She's getting replaced, periodt. 💀
- On entry: the m-by-n matrix
LDC—LDC is INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORK—WORK is DOUBLE PRECISION array, dimension (LDWORK,K).LDWORK—LDWORK is INTEGER. The leading dimension of the arrayWORK. The rules:- If
SIDE = 'L', thenLDWORK >= max(1,N); - if
SIDE = 'R', thenLDWORK >= max(1,M).
- If
🦋 Author 🦋
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🌸 Further Details: 🌸
The shape of the matrix V and the storage of the vectors which define the H(i) is best illustrated by the following example with n = 5 and k = 3. The elements equal to 1 are not stored; the corresponding array elements are modified but restored on exit. The rest of the array is not used. Lowkey iconic. ✨
DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R':
V = ( 1 ) V = ( 1 v1 v1 v1 v1 )
( v1 1 ) ( 1 v2 v2 v2 )
( v1 v2 1 ) ( 1 v3 v3 )
( v1 v2 v3 )
( v1 v2 v3 )
DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R':
V = ( v1 v2 v3 ) V = ( v1 v1 1 )
( v1 v2 v3 ) ( v2 v2 v2 1 )
( 1 v2 v3 ) ( v3 v3 v3 v3 1 )
( 1 v3 )
( 1 )
💖 subroutine dlarfb_gett 💖
subroutine dlarfb_gett (character IDENT, integer M, integer N, integer K,
double precision, dimension( ldt, * ) T, integer LDT, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( ldb, *
) B, integer LDB, double precision, dimension( ldwork, * ) WORK, integer
LDWORK)
DLARFB_GETT 🧚
🎀 Purpose: 🎀
DLARFB_GETT applies a real Householder block reflector H from the left to a real (K+M)-by-N 'triangular-pentagonal' matrix composed of two block matrices: an upper trapezoidal K-by-N matrix A stored in the array A, and a rectangular M-by-(N-K) matrix B, stored in the array B. The block reflector H is stored in a compact WY-representation, where the elementary reflectors are in the arrays A, B and T. See the Further Details section. 🫶
✨ Parameters ✨
IDENT—IDENT is CHARACTER*1- If
IDENT= not'I', or not'i', thenV1is unit lower-triangular and stored in the left K-by-K block of the input matrixA, - If
IDENT='I'or'i', thenV1is an identity matrix and not stored.
- If
See the Further Details section.
M—M is INTEGER. The number of rows of the matrixB.M >= 0.N—N is INTEGER. The number of columns of the matricesAandB.N >= 0.K—K is INTEGER. The number or rows of the matrixA.Kis also the order of the matrixT, i.e. the number of elementary reflectors whose product defines the block reflector.0 <= K <= N.T—T is DOUBLE PRECISION array, dimension (LDT,K). The upper-triangular K-by-K matrixTin the representation of the block reflector.LDT—LDT is INTEGER. The leading dimension of the arrayT.LDT >= K.A—A is DOUBLE PRECISION array, dimension (LDA,N)- On entry:
- In the K-by-N upper-trapezoidal part
A: input matrixA. - In the columns below the diagonal: columns of
V1(ones are not stored on the diagonal).
- In the K-by-N upper-trapezoidal part
- On exit:
Ais overwritten by rectangular K-by-N product H*A.
- On entry:
See the Further Details section.
LDA—LDB is INTEGER. The leading dimension of the arrayA.LDA >= max(1,K).
okay so yes, the manpage literally saysLDBthere instead ofLDA— we do not fix it, we do not touch it, we report it exactly as it is. Not my typo, not your typo, it's just the lore. 🙈
B—B is DOUBLE PRECISION array, dimension (LDB,N)- On entry:
- In the M-by-(N-K) right block: input matrix
B. - In the M-by-N left block: columns of
V2.
- In the M-by-(N-K) right block: input matrix
- On exit:
Bis overwritten by rectangular M-by-N product H*B.
- On entry:
See the Further Details section.
LDB—LDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,M).WORK—WORK is DOUBLE PRECISION array, dimension(LDWORK,max(K,N-K)).LDWORK—LDWORK is INTEGER. The leading dimension of the arrayWORK.LDWORK>=max(1,K).
🦋 Author 🦋
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
💜 Contributors: 💜
November 2020, Igor Kozachenko, Computer Science Division, University of California, Berkeley
🌈 Further Details: 🌈
(1) Description of the Algebraic Operation.
The matrix A is a K-by-N matrix composed of two column block matrices, A1, which is K-by-K, and A2, which is K-by-(N-K):
A = ( A1, A2 ).
The matrix B is an M-by-N matrix composed of two column block matrices, B1, which is M-by-K, and B2, which is M-by-(N-K):
B = ( B1, B2 ).
Perform the operation:
( A_out ) := H * ( A_in ) = ( I - V * T * V**T ) * ( A_in ) =
( B_out ) ( B_in ) ( B_in )
= ( I - ( V1 ) * T * ( V1**T, V2**T ) ) * ( A_in )
( V2 ) ( B_in )
On input:
a)
( A_in )
( B_in )
consists of two block columns:
( A_in ) = (( A1_in ) ( A2_in )) = (( A1_in ) ( A2_in ))
( B_in ) (( B1_in ) ( B2_in )) (( 0 ) ( B2_in )),
where the column blocks are:
( A1_in ) is a K-by-K upper-triangular matrix stored in the
upper triangular part of the array A(1:K,1:K).
( B1_in ) is an M-by-K rectangular ZERO matrix and not stored.
( A2_in ) is a K-by-(N-K) rectangular matrix stored
in the array A(1:K,K+1:N).
( B2_in ) is an M-by-(N-K) rectangular matrix stored
in the array B(1:M,K+1:N).
b)
V = ( V1 )
( V2 )
where:
- if
IDENT == 'I',V1is a K-by-K identity matrix, not stored; - if
IDENT != 'I',V1is a K-by-K unit lower-triangular matrix, stored in the lower-triangular part of the arrayA(1:K,1:K)(ones are not stored),
and V2 is an M-by-K rectangular stored the array B(1:M,1:K), (because on input B1_in is a rectangular zero matrix that is not stored and the space is used to store V2). 🫶
c) T is a K-by-K upper-triangular matrix stored in the array T(1:K,1:K).
On output:
a)
( A_out )
( B_out )
consists of two block columns:
( A_out ) = (( A1_out ) ( A2_out ))
( B_out ) (( B1_out ) ( B2_out )),
where the column blocks are:
( A1_out ) is a K-by-K square matrix, or a K-by-K
upper-triangular matrix, if V1 is an
identity matrix. AiOut is stored in
the array A(1:K,1:K).
( B1_out ) is an M-by-K rectangular matrix stored
in the array B(1:M,K:N).
( A2_out ) is a K-by-(N-K) rectangular matrix stored
in the array A(1:K,K+1:N).
( B2_out ) is an M-by-(N-K) rectangular matrix stored
in the array B(1:M,K+1:N).
The operation above can be represented as the same operation on each block column:
( A1_out ) := H * ( A1_in ) = ( I - V * T * V**T ) * ( A1_in )
( B1_out ) ( 0 ) ( 0 )
( A2_out ) := H * ( A2_in ) = ( I - V * T * V**T ) * ( A2_in )
( B2_out ) ( B2_in ) ( B2_in )
okay so like, if IDENT != 'I', the computation for column block 1 is giving:
A1_out: = A1_in - V1*T*(V1**T)*A1_in
B1_out: = - V2*T*(V1**T)*A1_in
and the computation for column block 2, which exists if N > K:
A2_out: = A2_in - V1*T*( (V1**T)*A2_in + (V2**T)*B2_in )
B2_out: = B2_in - V2*T*( (V1**T)*A2_in + (V2**T)*B2_in )
but if IDENT == 'I', it's a whole different vibe 💖. The operation for column block 1:
A1_out: = A1_in - V1*T**A1_in
B1_out: = - V2*T**A1_in
and the computation for column block 2, which exists if N > K:
A2_out: = A2_in - T*( A2_in + (V2**T)*B2_in )
B2_out: = B2_in - V2*T*( A2_in + (V2**T)*B2_in )
✨ (2) Description of the Algorithmic Computation ✨
so like, step one: we compute column block 2, aka A2 and B2. For that we need the K-by-(N-K) rectangular workspace matrix W2, same size as A2. W2 lives in WORK(1:K,1:(N-K)).
step two: we compute column block 1, aka A1 and B1. Now we need the K-by-K square workspace matrix W1, same size as A1. W1 is stored in WORK(1:K,1:K).
NOTE: Hence, in this routine, we need the workspace array WORK only of size WORK(1:K,1:max(K,N-K)) so it can hold both W2 from the first step and W1 from the second step.
Case (A), when V1 is unit lower-triangular, i.e. IDENT != 'I', more computations than in the Case (B).
if( IDENT != 'I' ) then
if ( N > K ) then
(First Step - column block 2)
col2_(1) W2: = A2
col2_(2) W2: = (V1**T) * W2 = (unit_lower_tr_of_(A1)**T) * W2
col2_(3) W2: = W2 + (V2**T) * B2 = W2 + (B1**T) * B2
col2_(4) W2: = T * W2
col2_(5) B2: = B2 - V2 * W2 = B2 - B1 * W2
col2_(6) W2: = V1 * W2 = unit_lower_tr_of_(A1) * W2
col2_(7) A2: = A2 - W2
else
(Second Step - column block 1)
col1_(1) W1: = A1
col1_(2) W1: = (V1**T) * W1 = (unit_lower_tr_of_(A1)**T) * W1
col1_(3) W1: = T * W1
col1_(4) B1: = - V2 * W1 = - B1 * W1
col1_(5) square W1: = V1 * W1 = unit_lower_tr_of_(A1) * W1
col1_(6) square A1: = A1 - W1
end if
end if
Case (B), when V1 is an identity matrix, i.e. IDENT == 'I', less computations than in the Case (A)
if( IDENT == 'I' ) then
if ( N > K ) then
(First Step - column block 2)
col2_(1) W2: = A2
col2_(3) W2: = W2 + (V2**T) * B2 = W2 + (B1**T) * B2
col2_(4) W2: = T * W2
col2_(5) B2: = B2 - V2 * W2 = B2 - B1 * W2
col2_(7) A2: = A2 - W2
else
(Second Step - column block 1)
col1_(1) W1: = A1
col1_(3) W1: = T * W1
col1_(4) B1: = - V2 * W1 = - B1 * W1
col1_(6) upper-triangular_of_(A1): = A1 - W1
end if
end if
Combine these cases (A) and (B) together, this is the resulting algorithm:
if ( N > K ) then
(First Step - column block 2)
col2_(1) W2: = A2
if( IDENT != 'I' ) then
col2_(2) W2: = (V1**T) * W2
= (unit_lower_tr_of_(A1)**T) * W2
end if
col2_(3) W2: = W2 + (V2**T) * B2 = W2 + (B1**T) * B2]
col2_(4) W2: = T * W2
col2_(5) B2: = B2 - V2 * W2 = B2 - B1 * W2
if( IDENT != 'I' ) then
col2_(6) W2: = V1 * W2 = unit_lower_tr_of_(A1) * W2
end if
col2_(7) A2: = A2 - W2
else
(Second Step - column block 1)
col1_(1) W1: = A1
if( IDENT != 'I' ) then
col1_(2) W1: = (V1**T) * W1
= (unit_lower_tr_of_(A1)**T) * W1
end if
col1_(3) W1: = T * W1
col1_(4) B1: = - V2 * W1 = - B1 * W1
if( IDENT != 'I' ) then
col1_(5) square W1: = V1 * W1 = unit_lower_tr_of_(A1) * W1
col1_(6_a) below_diag_of_(A1): = - below_diag_of_(W1)
end if
col1_(6_b) up_tr_of_(A1): = up_tr_of_(A1) - up_tr_of_(W1)
end if
✨ subroutine dlarfg ✨
subroutine dlarfg (integer N, double precision ALPHA, double precision,
dimension( * ) X, integer INCX, double precision TAU)
DLARFG generates an elementary reflector (Householder matrix). periodt 💅
Purpose:
DLARFG generates a real elementary reflector H of order n, such that
H * ( alpha ) = ( beta ), H**T * H = I.
( x ) ( 0 )
where alpha and beta are scalars, and x is an (n-1)-element real vector. H is represented in the form
H = I - tau * ( 1 ) * ( 1 v**T ) ,
( v )
where tau is a real scalar and v is a real (n-1)-element vector.
If the elements of x are all zero, then tau = 0 and H is taken to be the unit matrix.
Otherwise 1 <= tau <= 2.
Parameters
N—N is INTEGER. The order of the elementary reflector.ALPHA—ALPHA is DOUBLE PRECISION. On entry, the value alpha. On exit, it is overwritten with the value beta.X—X is DOUBLE PRECISION array, dimension (1+(N-2)*abs(INCX)). On entry, the vector x. On exit, it is overwritten with the vector v.INCX—INCX is INTEGER. The increment between elements of X.INCX > 0.TAU—TAU is DOUBLE PRECISION. The value tau.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
✨ subroutine dlarfgp ✨
subroutine dlarfgp (integer N, double precision ALPHA, double precision,
dimension( * ) X, integer INCX, double precision TAU)
DLARFGP generates an elementary reflector (Householder matrix) with non-negative beta. so extra ✨
Purpose:
DLARFGP generates a real elementary reflector H of order n, such that
H * ( alpha ) = ( beta ), H**T * H = I.
( x ) ( 0 )
where alpha and beta are scalars, beta is non-negative, and x is an (n-1)-element real vector. H is represented in the form
H = I - tau * ( 1 ) * ( 1 v**T ) ,
( v )
where tau is a real scalar and v is a real (n-1)-element vector.
If the elements of x are all zero, then tau = 0 and H is taken to be the unit matrix.
Parameters
N—N is INTEGER. The order of the elementary reflector.ALPHA—ALPHA is DOUBLE PRECISION. On entry, the value alpha. On exit, it is overwritten with the value beta.X—X is DOUBLE PRECISION array, dimension (1+(N-2)*abs(INCX)). On entry, the vector x. On exit, it is overwritten with the vector v.INCX—INCX is INTEGER. The increment between elements of X.INCX > 0.TAU—TAU is DOUBLE PRECISION. The value tau.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
✨ subroutine dlarft ✨
subroutine dlarft (character DIRECT, character STOREV, integer N, integer K,
double precision, dimension( ldv, * ) V, integer LDV, double precision,
dimension( * ) TAU, double precision, dimension( ldt, * ) T, integer
LDT)
DLARFT forms the triangular factor T of a block reflector H = I - vtvH. iconic 🌈
Purpose:
DLARFT forms the triangular factor T of a real block reflector H of order n, which is defined as a product of k elementary reflectors.
If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular;
If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular.
If STOREV = 'C', the vector which defines the elementary reflector H(i) is stored in the i-th column of the array V, and
H = I - V * T * V**T
If STOREV = 'R', the vector which defines the elementary reflector H(i) is stored in the i-th row of the array V, and
H = I - V**T * T * V
Parameters
DIRECT—DIRECT is CHARACTER*1. Specifies the order in which the elementary reflectors are multiplied to form the block reflector:= 'F': H = H(1) H(2) . . . H(k) (Forward)= 'B': H = H(k) . . . H(2) H(1) (Backward)
STOREV—STOREV is CHARACTER*1. Specifies how the vectors which define the elementary reflectors are stored (see also Further Details):= 'C': columnwise= 'R': rowwise
N—N is INTEGER. The order of the block reflector H.N >= 0.K—K is INTEGER. The order of the triangular factor T (= the number of elementary reflectors).K >= 1.V—
V is DOUBLE PRECISION array, dimension
(LDV,K) if STOREV = 'C'
(LDV,N) if STOREV = 'R'
The matrix V. See further details.
LDV—LDV is INTEGER. The leading dimension of the array V. IfSTOREV = 'C',LDV >= max(1,N); ifSTOREV = 'R',LDV >= K.TAU—TAU is DOUBLE PRECISION array, dimension (K).TAU(i)must contain the scalar factor of the elementary reflectorH(i).T—T is DOUBLE PRECISION array, dimension (LDT,K). The k by k triangular factor T of the block reflector. IfDIRECT = 'F', T is upper triangular; ifDIRECT = 'B', T is lower triangular. The rest of the array is not used.LDT—LDTisINTEGER— the leading dimension of the arrayT.LDT >= K. Periodt.
✨ Author ✨
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 Further Details: 🦋
Okay so the shape of the matrix V and the storage of the vectors which define the H(i) is best illustrated by the following example with n = 5 and k = 3. The elements equal to 1 are not stored. Iykyk.
DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R':
V = ( 1 ) V = ( 1 v1 v1 v1 v1 )
( v1 1 ) ( 1 v2 v2 v2 )
( v1 v2 1 ) ( 1 v3 v3 )
( v1 v2 v3 )
( v1 v2 v3 )
DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R':
V = ( v1 v2 v3 ) V = ( v1 v1 1 )
( v1 v2 v3 ) ( v2 v2 v2 1 )
( 1 v2 v3 ) ( v3 v3 v3 v3 1 )
( 1 v3 )
( 1 )
🌸 subroutine dlarfx 🌸
subroutine dlarfx (character SIDE, integer M, integer N, double precision,
dimension( * ) V, double precision TAU, double precision, dimension(
ldc, * ) C, integer LDC, double precision, dimension( * ) WORK)
Bestie, DLARFX applies an elementary reflector to a general rectangular matrix, with loop unrolling when the reflector has order ≤ 10. It's giving optimized.
✨ Purpose ✨
DLARFX applies a real elementary reflector H to a real m by n matrix C, from either the left or the right. H is represented in the form
H = I - tau * v * v**T
where tau is a real scalar and v is a real vector.
If tau = 0, then H is taken to be the unit matrix.
This version uses inline code if H has order < 11.
🎀 Parameters 🎀
SIDE—SIDEisCHARACTER*1='L': formH * C='R': formC * HM—MisINTEGERThe number of rows of the matrixC.N—NisINTEGERThe number of columns of the matrixC.V—VisDOUBLE PRECISIONarray, dimension(M)ifSIDE = 'L'or(N)ifSIDE = 'R'The vectorvin the representation ofH.TAU—TAUisDOUBLE PRECISIONThe valuetauin the representation ofH.C—CisDOUBLE PRECISIONarray, dimension(LDC,N)On entry, thembynmatrixC. On exit,Cis overwritten by the matrixH * CifSIDE = 'L', orC * HifSIDE = 'R'.LDC—LDCisINTEGERThe leading dimension of the arrayC.LDC >= (1,M).WORK—WORKisDOUBLE PRECISIONarray, dimension(N)ifSIDE = 'L'or(M)ifSIDE = 'R'WORKis not referenced ifHhas order < 11.
💖 Author 💖
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 subroutine dlarfy 🦋
subroutine dlarfy (character UPLO, integer N, double precision, dimension( *
) V, integer INCV, double precision TAU, double precision, dimension(
ldc, * ) C, integer LDC, double precision, dimension( * ) WORK)
DLARFY — that's it, that's the name. No cap.
✨ Purpose ✨
DLARFY applies an elementary reflector, or Householder matrix, H, to an n x n symmetric matrix C, from both the left and the right.
H is represented in the form
H = I - tau * v * v'
where tau is a scalar and v is a vector.
If tau is zero, then H is taken to be the unit matrix.
🎀 Parameters 🎀
UPLO—UPLOisCHARACTER*1Specifies whether the upper or lower triangular part of the symmetric matrixCis stored. ='U': Upper triangle ='L': Lower triangleN—NisINTEGERThe number of rows and columns of the matrixC.N >= 0.V—VisDOUBLE PRECISIONarray, dimension(1 + (N-1)*abs(INCV))The vectorvas described above.INCV—INCVisINTEGERThe increment between successive elements ofv.INCVmust not be zero.TAU—TAUisDOUBLE PRECISIONThe valuetauas described above.C—CisDOUBLE PRECISIONarray, dimension(LDC, N)On entry, the matrixC. On exit,Cis overwritten byH * C * H'.LDC—LDCisINTEGERThe leading dimension of the arrayC.LDC >= max( 1, N ).WORK—WORKisDOUBLE PRECISIONarray, dimension(N)
💖 Author 💖
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🌈 subroutine dlargv 🌈
subroutine dlargv (integer N, double precision, dimension( * ) X, integer
INCX, double precision, dimension( * ) Y, integer INCY, double
precision, dimension( * ) C, integer INCC)
DLARGV generates a vector of plane rotations with real cosines and real sines. Periodt.
✨ Purpose ✨
DLARGV generates a vector of real plane rotations, determined by elements of the real vectors x and y. For i = 1,2,...,n
( c(i) s(i) ) ( x(i) ) = ( a(i) )
( -s(i) c(i) ) ( y(i) ) = ( 0 )
🎀 Parameters 🎀
N—NisINTEGERThe number of plane rotations to be generated.X—XisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCX)On entry, the vectorx. On exit,x(i)is overwritten bya(i), fori = 1,...,n.INCX—INCXisINTEGERThe increment between elements ofX.INCX > 0.Y—YisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCY)On entry, the vectory. On exit, the sines of the plane rotations.INCY—INCYisINTEGERThe increment between elements ofY.INCY > 0.C—CisDOUBLE PRECISIONarray, dimension(1+(N-1)*INCC)The cosines of the plane rotations.INCC—INCCisINTEGERThe increment between elements ofC.INCC > 0.
💖 Author 💖
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
👑 subroutine dlarrv 👑
subroutine dlarrv (integer N, double precision VL, double precision VU,
double precision, dimension( * ) D, double precision, dimension( * ) L,
double precision PIVMIN, integer, dimension( * ) ISPLIT, integer M,
integer DOL, integer DOU, double precision MINRGP, double precision
RTOL1, double precision RTOL2, double precision, dimension( * ) W,
double precision, dimension( * ) WERR, double precision, dimension( * )
WGAP, integer, dimension( * ) IBLOCK, integer, dimension( * ) INDEXW,
double precision, dimension( * ) GERS, double precision, dimension( ldz,
* ) Z, integer LDZ, integer, dimension( * ) ISUPPZ, double precision,
dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
DLARRV computes the eigenvectors of the tridiagonal matrix T = L D LT given L, D and the eigenvalues of L D LT. Slay.
✨ Purpose ✨
DLARRV computes the eigenvectors of the tridiagonal matrix T = L D L**T given L, D and APPROXIMATIONS to the eigenvalues of L D L**T. The input eigenvalues should have been computed by DLARRE.
🎀 Parameters 🎀
N—NisINTEGERThe order of the matrix.N >= 0.VL—VLisDOUBLE PRECISIONLower bound of the interval that contains the desired eigenvalues.VL < VU. Needed to compute gaps on the left or right end of the extremal eigenvalues in the desired RANGE.VU—VUisDOUBLE PRECISIONUpper bound of the interval that contains the desired eigenvalues.VL < VU. Note:VUis currently not used by this implementation ofDLARRV,VUis passed toDLARRVbecause it could be used compute gaps on the right end of the extremal eigenvalues. However, with not much initial accuracy inLAMBDAandVU, the formula can lead to an overestimation of the right gap and thus to inadequately early RQI'convergence'. This is currently prevented this by forcing a small right gap. And so it turns out thatVUis currently not used by this implementation ofDLARRV.D—DisDOUBLE PRECISIONarray, dimension(N)On entry, theNdiagonal elements of the diagonal matrixD. On exit,Dmay be overwritten.L—LisDOUBLE PRECISIONarray, dimension(N)On entry, the(N-1)subdiagonal elements of the unit bidiagonal matrixLare in elements1toN-1ofL(if the matrix is not split.) At the end of each block is stored the corresponding shift as given byDLARRE. On exit,Lis overwritten.PIVMIN—PIVMINisDOUBLE PRECISIONThe minimum pivot allowed in the Sturm sequence.ISPLIT—ISPLITisINTEGERarray, dimension(N)The splitting points, at whichTbreaks up into blocks. The first block consists of rows/columns1toISPLIT( 1 ), the second of rows/columnsISPLIT( 1 )+1throughISPLIT( 2 ), etc.M—MisINTEGERThe total number of input eigenvalues.0 <= M <= N.DOL—DOLisINTEGERDOU—DOUisINTEGERIf the user wants to compute only selected eigenvectors from all the eigenvalues supplied, he can specify an index rangeDOL:DOU. Or else the settingDOL=1,DOU=Mshould be applied. Note thatDOLandDOUrefer to the order in which the eigenvalues are stored inW. If the user wants to compute only selected eigenpairs, then the columnsDOL-1toDOU+1of the eigenvector spaceZcontain the computed eigenvectors. All other columns ofZare set to zero.MINRGP—MINRGPisDOUBLE PRECISIONRTOL1RTOL1isDOUBLE PRECISIONRTOL2isDOUBLE PRECISION— Parameters for bisection. An interval[LEFT,RIGHT]has converged ifRIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )W—DOUBLE PRECISION array, dimension (N)— The firstMelements ofWcontain the APPROXIMATE eigenvalues for which eigenvectors are to be computed. The eigenvalues should be grouped by split-off block and ordered from smallest to largest within the block ( The output arrayWfromDLARREis expected here ). Furthermore, they are with respect to the shift of the corresponding root representation for their block. On exit,Wholds the eigenvalues of the UNshifted matrix.WERR—DOUBLE PRECISION array, dimension (N)— The firstMelements contain the semiwidth of the uncertainty interval of the corresponding eigenvalue inWWGAP—DOUBLE PRECISION array, dimension (N)— The separation from the right neighbor eigenvalue inW.IBLOCK—INTEGER array, 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—INTEGER array, 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 the second block.GERS—DOUBLE PRECISION array, dimension (2*N)— TheNGerschgorin intervals (thei-th Gerschgorin interval is(GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should be computed from the original UNshifted matrix.Z—DOUBLE PRECISION array, dimension (LDZ, max(1,M) )— IfINFO = 0, the firstMcolumns ofZcontain the orthonormal eigenvectors of the matrixTcorresponding to the input eigenvalues, with thei-th column ofZholding the eigenvector associated withW(i). Note: the user must ensure that at leastmax(1,M)columns are supplied in the arrayZ.LDZisINTEGER— The leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N).ISUPPZ—INTEGER array, dimension ( 2*max(1,M) )— The support of the eigenvectors inZ, i.e., the indices indicating the nonzero elements inZ. TheI-th eigenvector is nonzero only in elementsISUPPZ( 2*I-1 )throughISUPPZ( 2*I ).WORK—DOUBLE PRECISION array, dimension (12*N)IWORK—INTEGER array, dimension (7*N)INFOisINTEGER= 0: successful exit> 0: A problem occurred inDLARRV.< 0: One of the called subroutines signaled an internal problem. Needs inspection of the corresponding parameterIINFOfor further information.=-1: Problem inDLARRBwhen refining a child's eigenvalues.=-2: Problem inDLARRFwhen computing the RRR of a child. When a child is inside a tight cluster, it can be difficult to find an RRR. A partial remedy from the user's point of view is to make the parameterMINRGPsmaller and recompile. However, as the orthogonality of the computed vectors is proportional to1/MINRGP, the user should be aware that they might be trading in precision when they decreaseMINRGP.=-3: Problem inDLARRBwhen refining a single eigenvalue after the Rayleigh correction was rejected.= 5: The Rayleigh Quotient Iteration failed to converge to full accuracy inMAXITRsteps.
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 dlartv (integer N, double precision, dimension( * ) X, integer INCX, double precision, dimension( * ) Y, integer INCY, double precision, dimension( * ) C, double precision, dimension( * ) S, integer INCC)
DLARTV applies a vector of plane rotations with real cosines and real sines to the elements of a pair of vectors. Rotation energy, fr fr. 💫
Purpose 💫
DLARTV applies a vector of real plane rotations to elements of the real vectors x and y. For i = 1,2,...,n
( x(i) ) := ( c(i) s(i) ) ( x(i) )
( y(i) ) ( -s(i) c(i) ) ( y(i) )
Parameters 📋
NisINTEGER— The number of plane rotations to be applied.X—DOUBLE PRECISION array, dimension (1+(N-1)*INCX)— The vector x.INCXisINTEGER— The increment between elements of X.INCX > 0.Y—DOUBLE PRECISION array, dimension (1+(N-1)*INCY)— The vector y.INCYisINTEGER— The increment between elements of Y.INCY > 0.C—DOUBLE PRECISION array, dimension (1+(N-1)*INCC)— The cosines of the plane rotations.S—DOUBLE PRECISION array, dimension (1+(N-1)*INCC)— The sines of the plane rotations.INCCisINTEGER— The increment between elements of C and S.INCC > 0.
Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine dlaswp (integer N, double precision, dimension( lda, * ) A, integer LDA, integer K1, integer K2, integer, dimension( * ) IPIV, integer INCX)
DLASWP performs a series of row interchanges on a general rectangular matrix. It's giving pivot energy, no cap. 🔥
Purpose 💫
DLASWP performs a series of row interchanges on the matrix A. One row interchange is initiated for each of rows K1 through K2 of A.
Parameters 📋
NisINTEGER— The number of columns of the matrix A.A—DOUBLE PRECISION array, dimension (LDA,N)— On entry, the matrix of column dimension N to which the row interchanges will be applied. On exit, the permuted matrix.LDAisINTEGER— The leading dimension of the array A.K1isINTEGER— The first element of IPIV for which a row interchange will be done.K2isINTEGER—(K2-K1+1)is the number of elements of IPIV for which a row interchange will be done.IPIV—INTEGER array, dimension (K1+(K2-K1)*abs(INCX))— The vector of pivot indices. Only the elements in positionsK1throughK1+(K2-K1)*abs(INCX)of IPIV are accessed.IPIV(K1+(K-K1)*abs(INCX)) = Limplies rowsKandLare to be interchanged.INCXisINTEGER— The increment between successive values of IPIV. If INCX is negative, the pivots are applied in reverse order.
Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details 🔍
Modified by R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA
subroutine dlat2s (character UPLO, integer N, double precision, dimension( lda, * ) A, integer LDA, real, dimension( ldsa, * ) SA, integer LDSA, integer INFO)
DLAT2S converts a double-precision triangular matrix to a single-precision triangular matrix. Precision glow-down, but make it safe. 🦋
Purpose 💫
DLAT2S converts a DOUBLE PRECISION triangular matrix, SA, to a SINGLE PRECISION triangular matrix, A.
RMAX is the overflow for the SINGLE PRECISION arithmetic DLAS2S checks that all the entries of A are between -RMAX and RMAX. If not the conversion is aborted and a flag is raised.
This is an auxiliary routine so there is no argument checking.
Parameters 📋
UPLOisCHARACTER*1= 'U':Ais upper triangular;= 'L':Ais lower triangular.
NisINTEGER— The number of rows and columns of the matrix A.N >= 0.A—DOUBLE PRECISION array, dimension (LDA,N)— On entry, the N-by-N triangular coefficient matrix A.LDAisINTEGER— The leading dimension of the array A.LDA >= max(1,N).SA—REAL array, dimension (LDSA,N)— Only the UPLO part of SA is referenced. On exit, ifINFO=0, the N-by-N coefficient matrix SA; ifINFO>0, the content of the UPLO part of SA is unspecified.LDSAisINTEGER— The leading dimension of the array SA.LDSA >= max(1,M).INFOisINTEGER= 0: successful exit.= 1: an entry of the matrix A is greater than the SINGLE PRECISION overflow threshold, in this case, the content of the UPLO part of SA in exit is unspecified.
Author 👑
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
🦋 dlatbs — triangular banded solve, but make it safe
subroutine dlatbs (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, integer KD, double precision, dimension(
ldab, * ) AB, integer LDAB, double precision, dimension( * ) X, double
precision SCALE, double precision, dimension( * ) CNORM, integer INFO)
DLATBS solves a triangular banded system of equations. no cap, that's literally the whole job description 💅
💖 Purpose
DLATBS solves one of the triangular systems
A *x = s*b or A**T*x = s*b
with scaling to prevent overflow, where A is an upper or lower triangular band matrix. Here A**T denotes the transpose of A, x and b are n-element vectors, and s is a scaling factor, usually less than or equal to 1, chosen so that the components of x will be less than the overflow threshold. If the unscaled problem will not cause overflow, the Level 2 BLAS routine DTBSV is called. If the matrix A is singular (A(j,j) = 0 for some j), then s is set to 0 and a non-trivial solution to A*x = 0 is returned.
bestie if A is singular it literally just hands you back a non-trivial solution toA*x = 0and setss = 0. that's not a bug that's the whole design. 🫶
🎀 Parameters
UPLO—UPLO is CHARACTER*1. Specifies whether the matrix A is upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—TRANS is CHARACTER*1. Specifies the operation applied to A.= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose = Transpose)
DIAG—DIAG is CHARACTER*1. Specifies whether or not the matrix A is unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—NORMIN is CHARACTER*1. Specifies whetherCNORMhas been set or not.= 'Y':CNORMcontains the column norms on entry= 'N':CNORMis not set on entry. On exit, the norms will be computed and stored inCNORM.
N—N is INTEGER. The order of the matrix A.N >= 0.KD—KD is INTEGER. The number of subdiagonals or superdiagonals in the triangular matrix A.KD >= 0.AB—AB is DOUBLE PRECISION array, dimension (LDAB,N). The upper or lower triangular band matrix A, stored in the firstKD+1rows of the array. The j-th column of A is stored in the j-th column of the arrayABas follows:
if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
LDAB—LDAB is INTEGER. The leading dimension of the arrayAB.LDAB >= KD+1.X—X is DOUBLE PRECISION array, dimension (N). On entry, the right hand side b of the triangular system. On exit,Xis overwritten by the solution vector x. 🦋SCALE—SCALE is DOUBLE PRECISION. The scaling factor s for the triangular system
A * x = s*b or A**T* x = s*b.
If SCALE = 0, the matrix A is singular or badly scaled, and the vector x is an exact or approximate solution to A*x = 0.
CNORM—CNORM is DOUBLE PRECISION array, dimension (N)
If NORMIN = 'Y', CNORM is an input argument and CNORM(j) contains the norm of the off-diagonal part of the j-th column of A. If TRANS = 'N', CNORM(j) must be greater than or equal to the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j) must be greater than or equal to the 1-norm.
If NORMIN = 'N', CNORM is an output argument and CNORM(j) returns the 1-norm of the offdiagonal part of the j-th column of A.
INFO—INFO is INTEGER= 0: successful exit< 0: ifINFO = -k, the k-th argument had an illegal value
👑 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
✨ Further Details:
A rough bound on x is computed; if that is less than overflow, DTBSV is called, otherwise, specific code is used which checks for possible overflow or divide-by-zero at every operation.
A columnwise scheme is used for solving A*x = b. The basic algorithm if A is lower triangular is
x[1:n] := b[1:n]
for j = 1, ..., n
x(j) := x(j) / A(j,j)
x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
end
Define bounds on the components of x after j iterations of the loop:
M(j) = bound on x[1:j]
G(j) = bound on x[j+1:n]
Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
Then for iteration j+1 we have
M(j+1) <= G(j) / | A(j+1,j+1) |
G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
<= G(j) ( 1 + CNORM(j+1) / | A(j+1,j+1) | )
where CNORM(j+1) is greater than or equal to the infinity-norm of column j+1 of A, not counting the diagonal. Hence
G(j) <= G(0) product ( 1 + CNORM(i) / | A(i,i) | )
1<=i<=j
and
|x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + CNORM(i) / |A(i,i)| )
1<=i< j
Since |x(j)| <= M(j), we use the Level 2 BLAS routine DTBSV if the reciprocal of the largest M(j), j=1,..,n, is larger than max(underflow, 1/overflow).
The bound on x(j) is also used to determine when a step in the columnwise method can be performed without fear of overflow. If the computed bound is greater than a large constant, x is scaled to prevent overflow, but if the bound overflows, x is set to 0, x(j) to 1, and scale to 0, and a non-trivial solution to A*x = 0 is found.
Similarly, a row-wise scheme is used to solve A**T*x = b. The basic algorithm for A upper triangular is
for j = 1, ..., n
x(j) := ( b(j) - A[1:j-1,j]**T * x[1:j-1] ) / A(j,j)
end
We simultaneously compute two bounds
G(j) = bound on ( b(i) - A[1:i-1,i]**T * x[1:i-1] ), 1<=i<=j
M(j) = bound on x(i), 1<=i<=j
The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1. Then the bound on x(j) is
M(j) <= M(j-1) * ( 1 + CNORM(j) ) / | A(j,j) |
<= M(0) * product ( ( 1 + CNORM(i) ) / |A(i,i)| )
1<=i<=j
and we can safely call DTBSV if 1/M(n) and 1/G(n) are both greater than max(underflow, 1/overflow).
🌈 dlatdf — the reciprocal Dif-estimate contributor
subroutine dlatdf (integer IJOB, integer N, double precision, dimension(
ldz, * ) Z, integer LDZ, double precision, dimension( * ) RHS, double
precision RDSUM, double precision RDSCAL, integer, dimension( * ) IPIV,
integer, dimension( * ) JPIV)
DLATDF uses the LU factorization of the n-by-n matrix computed by sgetc2 and computes a contribution to the reciprocal Dif-estimate. iykyk 💜
💫 Purpose
DLATDF uses the LU factorization of the n-by-n matrix Z computed by DGETC2 and computes a contribution to the reciprocal Dif-estimate by solving Z * x = b for x, and choosing the r.h.s. b such that the norm of x is as large as possible. On entry RHS = b holds the contribution from earlier solved sub-systems, and on return RHS = x.
The factorization of Z returned by DGETC2 has the form Z = P*L*U*Q, where P and Q are permutation matrices. L is lower triangular with unit diagonal elements and U is upper triangular.
🍓 Parameters
IJOB—IJOB is INTEGERIJOB = 2: First compute an approximative null-vector e of Z usingDGECON, e is normalized and solve forZx = +-e - fwith the sign giving the greater value of 2-norm(x). About 5 times as expensive as Default.IJOB .ne. 2: Local look ahead strategy where all entries of the r.h.s. b is chosen as either+1or-1(Default).
N—N is INTEGER. The number of columns of the matrix Z.Z—Z is DOUBLE PRECISION array, dimension (LDZ, N). On entry, the LU part of the factorization of the n-by-n matrix Z computed byDGETC2:Z = P * L * U * QLDZ—LDZ is INTEGER. The leading dimension of the array Z.LDA >= max(1, N).RHS—RHS is DOUBLE PRECISION array, dimension (N). On entry,RHScontains contributions from other subsystems. On exit,RHScontains the solution of the subsystem with entries according to the value ofIJOB(see above).RDSUM—RDSUM is DOUBLE PRECISION. On entry, the sum of squares of computed contributions to the Dif-estimate under computation byDTGSYL, where the scaling factorRDSCAL(see below) has been factored out. On exit, the corresponding sum of squares updated with the contributions from the current sub-system. IfTRANS = 'T'RDSUMis not touched.
NOTE:RDSUMonly makes sense whenDTGSY2is called bySTGSYL.
RDSCAL—RDSCAL is DOUBLE PRECISION. On entry, scaling factor used to prevent overflow inRDSUM. On exit,RDSCALis updated w.r.t. the current contributions inRDSUM. IfTRANS = 'T',RDSCALis not touched.
NOTE:RDSCALonly makes sense whenDTGSY2is called byDTGSYL.
IPIV—IPIV is INTEGER array, dimension (N).The pivot indices; for1 <= i <= N, row i of the matrix has been interchanged with rowIPIV(i).JPIV—JPIV is INTEGER array, dimension (N).The pivot indices; for1 <= j <= N, column j of the matrix has been interchanged with columnJPIV(j).
🌸 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🔥 Further Details:
This routine is a further developed implementation of algorithm BSOLVE in [1] using complete pivoting in the LU factorization.
🧚 Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.
📚 References 📚
- [1] Bo Kagstrom and Lars Westin, Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation, IEEE Transactions on Automatic Control, Vol. 34, No. 7, July 1989, pp 745-751.
- [2] Peter Poromaa, On Efficient and Robust Estimators for the Separation between two Regular Matrix Pairs with Applications in Condition Estimation. Report IMINF-95.05, Departement of Computing Science, Umea University, S-901 87 Umea, Sweden, 1995.
🦋 dlatps 🦋
subroutine dlatps (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, double precision, dimension( * ) AP, double
precision, dimension( * ) X, double precision SCALE, double precision,
dimension( * ) CNORM, integer INFO)
DLATPS solves a triangular system of equations with the matrix held in packed storage. cute lil compressed matrix, she's frugal 💅
Purpose ✨
DLATPS solves one of the triangular systems
A *x = s*b or A**T*x = s*b
with scaling to prevent overflow, where A is an upper or lower triangular matrix stored in packed form. Here A**T denotes the transpose of A, x and b are n-element vectors, and s is a scaling factor, usually less than or equal to 1, chosen so that the components of x will be less than the overflow threshold. If the unscaled problem will not cause overflow, the Level 2 BLAS routine DTPSV is called. If the matrix A is singular (A(j,j) = 0 for some j), then s is set to 0 and a non-trivial solution to A*x = 0 is returned. no cap, that's the whole vibe 🌈
Parameters 🌸
UPLO—CHARACTER*1. Specifies whether the matrix A is upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—CHARACTER*1. Specifies the operation applied to A.= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose = Transpose)
DIAG—CHARACTER*1. Specifies whether or not the matrix A is unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—CHARACTER*1. Specifies whether CNORM has been set or not.= 'Y': CNORM contains the column norms on entry= 'N': CNORM is not set on entry. On exit, the norms will be computed and stored in CNORM.
N—INTEGER. The order of the matrix A.N >= 0.AP—DOUBLE PRECISION array, dimension (N*(N+1)/2). The upper or lower triangular matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows:- if
UPLO = 'U',AP(i + (j-1)*j/2) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP(i + (j-1)*(2n-j)/2) = A(i,j)forj<=i<=n.
- if
X—DOUBLE PRECISION array, dimension (N). On entry, the right hand side b of the triangular system. On exit, X is overwritten by the solution vector x. bye b, hello x 👋SCALE—DOUBLE PRECISION. The scaling factor s for the triangular system
A * x = s*b or A**T* x = s*b.
If SCALE = 0, the matrix A is singular or badly scaled, and the vector x is an exact or approximate solution to A*x = 0.
CNORM—DOUBLE PRECISION array, dimension (N)
If NORMIN = 'Y', CNORM is an input argument and CNORM(j) contains the norm of the off-diagonal part of the j-th column of A. If TRANS = 'N', CNORM(j) must be greater than or equal to the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j) must be greater than or equal to the 1-norm.
If NORMIN = 'N', CNORM is an output argument and CNORM(j) returns the 1-norm of the offdiagonal part of the j-th column of A.
INFO—INTEGER= 0: successful exit< 0: ifINFO = -k, the k-th argument had an illegal value
Author 💖
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details 🧚
A rough bound on x is computed; if that is less than overflow, DTPSV is called, otherwise, specific code is used which checks for possible overflow or divide-by-zero at every operation.
A columnwise scheme is used for solving A*x = b. The basic algorithm if A is lower triangular is
x[1:n] := b[1:n]
for j = 1, ..., n
x(j) := x(j) / A(j,j)
x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
end
Define bounds on the components of x after j iterations of the loop:
M(j) = bound on x[1:j]
G(j) = bound on x[j+1:n]
Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
Then for iteration j+1 we have
M(j+1) <= G(j) / | A(j+1,j+1) |
G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
<= G(j) ( 1 + CNORM(j+1) / | A(j+1,j+1) | )
where CNORM(j+1) is greater than or equal to the infinity-norm of column j+1 of A, not counting the diagonal. Hence
G(j) <= G(0) product ( 1 + CNORM(i) / | A(i,i) | )
1<=i<=j
and
|x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + CNORM(i) / |A(i,i)| )
1<=i< j
Since |x(j)| <= M(j), we use the Level 2 BLAS routine DTPSV if the reciprocal of the largest M(j), j=1,..,n, is larger than max(underflow, 1/overflow).
The bound on x(j) is also used to determine when a step in the columnwise method can be performed without fear of overflow. If the computed bound is greater than a large constant, x is scaled to prevent overflow, but if the bound overflows, x is set to 0, x(j) to 1, and scale to 0, and a non-trivial solution to A*x = 0 is found. 😭
Similarly, a row-wise scheme is used to solve A**T*x = b. The basic algorithm for A upper triangular is
for j = 1, ..., n
x(j) := ( b(j) - A[1:j-1,j]**T * x[1:j-1] ) / A(j,j)
end
We simultaneously compute two bounds
G(j) = bound on ( b(i) - A[1:i-1,i]**T * x[1:i-1] ), 1<=i<=j
M(j) = bound on x(i), 1<=i<=j
The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1. Then the bound on x(j) is
M(j) <= M(j-1) * ( 1 + CNORM(j) ) / | A(j,j) |
<= M(0) * product ( ( 1 + CNORM(i) ) / |A(i,i)| )
1<=i<=j
and we can safely call DTPSV if 1/M(n) and 1/G(n) are both greater than max(underflow, 1/overflow). math girlies stay winning ✨
🎀 dlatrd 🎀
subroutine dlatrd (character UPLO, integer N, integer NB, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( * ) E,
double precision, dimension( * ) TAU, double precision, dimension( ldw,
* ) W, integer LDW)
DLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal form by an orthogonal similarity transformation. she's a transformer fr fr 🦋
Purpose ✨
DLATRD reduces NB rows and columns of a real symmetric matrix A to symmetric tridiagonal form by an orthogonal similarity transformation Q**T * A * Q, and returns the matrices V and W which are needed to apply the transformation to the unreduced part of A.
If UPLO = 'U', DLATRD reduces the last NB rows and columns of a matrix, of which the upper triangle is supplied; if UPLO = 'L', DLATRD reduces the first NB rows and columns of a matrix, of which the lower triangle is supplied.
This is an auxiliary routine called by DSYTRD. just a lil helper bestie 💅
Parameters 🌸
UPLO—CHARACTER*1. Specifies whether the upper or lower triangular part of the symmetric matrix A is stored:= 'U': Upper triangular= 'L': Lower triangular
N—INTEGER. The order of the matrix A.NB—INTEGER. The number of rows and columns to be reduced.A—DOUBLE PRECISION array, dimension (LDA,N). On entry, the symmetric matrix A. IfUPLO = 'U', the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced.
On exit:
- if
UPLO = 'U', the last NB columns have been reduced to tridiagonal form, with the diagonal elements overwriting the diagonal elements of A; the elements above the diagonal with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors; - if
UPLO = 'L', the first NB columns have been reduced to tridiagonal form, with the diagonal elements overwriting the diagonal elements of A; the elements below the diagonal with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors.
See Further Details. 👀
LDA—INTEGER. The leading dimension of the array A.LDA >= (1,N).E—DOUBLE PRECISION array, dimension (N-1). IfUPLO = 'U',E(n-nb:n-1)contains the superdiagonal elements of the last NB columns of the reduced matrix; ifUPLO = 'L',E(1:nb)contains the subdiagonal elements of the first NB columns of the reduced matrix.TAU—DOUBLE PRECISION array, dimension (N-1). The scalar factors of the elementary reflectors, stored inTAU(n-nb:n-1)ifUPLO = 'U', and inTAU(1:nb)ifUPLO = 'L'. See Further Details.W—W— a DOUBLE PRECISION array, dimension(LDW,NB). This is the n-by-nb matrix W, and bestie it's the whole reason we're here: you need it to update the unreduced part of A. No W, no update. Periodt. 💅LDW— INTEGER. The leading dimension of the array W. Constraint:LDW >= max(1,N). Respect it or the vibes (and your memory) get wrecked. 🫶
✨ Author ✨
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
(yeah, the whole squad is credited, iconic behavior honestly 🎀)
💖 Further Details:
If UPLO = 'U', the matrix Q is represented as a product of elementary reflectors
Q = H(n) H(n-1) . . . H(n-nb+1).
Each H(i) has the form
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(i:n) = 0 and v(i-1) = 1; v(1:i-1) is stored on exit in A(1:i-1,i), and tau in TAU(i-1).
If UPLO = 'L', the matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(nb).
Each H(i) has the form
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+1:n) is stored on exit in A(i+1:n,i), and tau in TAU(i).
The elements of the vectors v together form the n-by-nb matrix V which is needed, with W, to apply the transformation to the unreduced part of the matrix, using a symmetric rank-2k update of the form: A := A - V*W**T - W*V**T.
The contents of A on exit are illustrated by the following examples with n = 5 and nb = 2:
if UPLO = 'U': if UPLO = 'L':
( a a a v4 v5 ) ( d )
( a a v4 v5 ) ( 1 d )
( a 1 v5 ) ( v1 1 a )
( d 1 ) ( v1 v2 a a )
( d ) ( v1 v2 a a a )
where d denotes a diagonal element of the reduced matrix, a denotes an element of the original matrix that is unchanged, and vi denotes an element of the vector defining H(i).
(ngl staring at those little diagrams until it clicks is a rite of passage 🌸)
🦋 subroutine dlatrs
subroutine dlatrs (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, double precision, dimension( lda, * ) A,
integer LDA, double precision, dimension( * ) X, double precision SCALE,
double precision, dimension( * ) CNORM, integer INFO)
DLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
Purpose:
DLATRS solves one of the triangular systems
A *x = s*b or A**T *x = s*b
with scaling to prevent overflow. Here A is an upper or lower triangular matrix, A**T denotes the transpose of A, x and b are n-element vectors, and s is a scaling factor, usually less than or equal to 1, chosen so that the components of x will be less than the overflow threshold. If the unscaled problem will not cause overflow, the Level 2 BLAS routine DTRSV is called. If the matrix A is singular (A(j,j) = 0 for some j), then s is set to 0 and a non-trivial solution to A*x = 0 is returned.
Parameters
UPLO— CHARACTER*1. Specifies whether the matrix A is upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS— CHARACTER*1. Specifies the operation applied to A.= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose = Transpose)
DIAG— CHARACTER*1. Specifies whether or not the matrix A is unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN— CHARACTER*1. Specifies whether CNORM has been set or not.= 'Y': CNORM contains the column norms on entry= 'N': CNORM is not set on entry. On exit, the norms will be computed and stored in CNORM.
N— INTEGER. The order of the matrix A. Constraint:N >= 0.A— DOUBLE PRECISION array, dimension(LDA,N). The triangular matrix A. IfUPLO = 'U', the leading n by n upper triangular part of the array A contains the upper triangular matrix, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading n by n lower triangular part of the array A contains the lower triangular matrix, and the strictly upper triangular part of A is not referenced. IfDIAG = 'U', the diagonal elements of A are also not referenced and are assumed to be 1.LDA— INTEGER. The leading dimension of the array A. Constraint:LDA >= max (1,N).X— DOUBLE PRECISION array, dimension(N). On entry, the right hand side b of the triangular system. On exit, X is overwritten by the solution vector x. 💅SCALE— DOUBLE PRECISION. The scaling factor s for the triangular system
A * x = s*b or A**T* x = s*b.
If SCALE = 0, the matrix A is singular or badly scaled, and the vector x is an exact or approximate solution to A*x = 0.
CNORM— DOUBLE PRECISION array, dimension(N).
If NORMIN = 'Y', CNORM is an input argument and CNORM(j) contains the norm of the off-diagonal part of the j-th column of A. If TRANS = 'N', CNORM(j) must be greater than or equal to the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j) must be greater than or equal to the 1-norm.
If NORMIN = 'N', CNORM is an output argument and CNORM(j) returns the 1-norm of the offdiagonal part of the j-th column of A.
INFO— INTEGER.= 0: successful exit< 0: ifINFO = -k, the k-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
💜 Further Details:
A rough bound on x is computed; if that is less than overflow, DTRSV is called, otherwise, specific code is used which checks for possible overflow or divide-by-zero at every operation.
A columnwise scheme is used for solving A*x = b. The basic algorithm if A is lower triangular is
x[1:n] := b[1:n]
for j = 1, ..., n
x(j) := x(j) / A(j,j)
x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
end
Define bounds on the components of x after j iterations of the loop:
M(j) = bound on x[1:j]
G(j) = bound on x[j+1:n]
Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
Then for iteration j+1 we have
M(j+1) <= G(j) / | A(j+1,j+1) |
G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
<= G(j) ( 1 + CNORM(j+1) / | A(j+1,j+1) | )
where CNORM(j+1) is greater than or equal to the infinity-norm of column j+1 of A, not counting the diagonal. Hence
G(j) <= G(0) product ( 1 + CNORM(i) / | A(i,i) | )
1<=i<=j
and
|x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + CNORM(i) / |A(i,i)| )
1<=i< j
Since |x(j)| <= M(j), we use the Level 2 BLAS routine DTRSV if the reciprocal of the largest M(j), j=1,..,n, is larger than max(underflow, 1/overflow).
The bound on x(j) is also used to determine when a step in the columnwise method can be performed without fear of overflow. If the computed bound is greater than a large constant, x is scaled to prevent overflow, but if the bound overflows, x is set to 0, x(j) to 1, and scale to 0, and a non-trivial solution to A*x = 0 is found.
Similarly, a row-wise scheme is used to solve A**T*x = b. The basic algorithm for A upper triangular is
for j = 1, ..., n
x(j) := ( b(j) - A[1:j-1,j]**T * x[1:j-1] ) / A(j,j)
end
We simultaneously compute two bounds
G(j) = bound on ( b(i) - A[1:i-1,i]**T * x[1:i-1] ), 1<=i<=j
M(j) = bound on x(i), 1<=i<=j
The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1. Then the bound on x(j) is
M(j) <= M(j-1) * ( 1 + CNORM(j) ) / | A(j,j) |
<= M(0) * product ( ( 1 + CNORM(i) ) / |A(i,i)| )
1<=i<=j
and we can safely call DTRSV if 1/M(n) and 1/G(n) are both greater than max(underflow, 1/overflow).
🌈 subroutine dlatrs3
subroutine dlatrs3 (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, integer NRHS, double precision, dimension(
lda, * ) A, integer LDA, double precision, dimension( ldx, * ) X,
integer LDX, double precision, dimension( * ) SCALE, double precision,
dimension( * ) CNORM, double precision, dimension( * ) WORK, integer
LWORK, integer INFO)
DLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow.
Purpose:
DLATRS3 solves one of the triangular systems
A * X = B * diag(scale) or A**T * X = B * diag(scale)
with scaling to prevent overflow. Here A is an upper or lower triangular matrix, A**T denotes the transpose of A. X and B are n by nrhs matrices and scale is an nrhs element vector of scaling factors. A scaling factor scale(j) is usually less than or equal to 1, chosen such that X(:,j) is less than the overflow threshold. If the matrix A is singular (A(j,j) = 0 for some j), then a non-trivial solution to A*X = 0 is returned. If the system is so badly scaled that the solution cannot be represented as (1/scale(k))*X(:,k), then x(:,k) = 0 and scale(k) is returned.
This is a BLAS-3 version of LATRS for solving several right hand sides simultaneously. 🔥
Parameters
UPLO— CHARACTER*1. Specifies whether the matrix A is upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—TRANS— this one's aCHARACTER*1and it picks which operation gets applied to A, bestie. The options are:= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose = Transpose)
DIAG—CHARACTER*1, and it's the vibe check on whether A is a unit triangular matrix or not:= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—CHARACTER*1, and it's literally just "hasCNORMbeen set or not":= 'Y':CNORMcontains the column norms on entry= 'N':CNORMis not set on entry. On exit, the norms will be computed and stored inCNORM.
N—INTEGER, the order of the matrix A.N >= 0. Not negotiable. 🙅NRHS—INTEGER, the number of columns of X.NRHS >= 0.A—DOUBLE PRECISION array, dimension (LDA,N). It's the triangular matrix A, and here's the tea: ifUPLO = 'U', the leading n by n upper triangular part of the array A contains the upper triangular matrix, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading n by n lower triangular part of the array A contains the lower triangular matrix, and the strictly upper triangular part of A is not referenced. And ifDIAG = 'U', the diagonal elements of A are also not referenced and are assumed to be 1. They said "ignore that part" and meant it. 💅LDA—INTEGER, the leading dimension of the array A.LDA >= max (1,N).X—DOUBLE PRECISION array, dimension (LDX,NRHS). On entry, it's the right hand side B of the triangular system. On exit, X is overwritten by the solution matrix X. glow up moment ✨LDX—INTEGER, the leading dimension of the array X.LDX >= max (1,N).SCALE—DOUBLE PRECISION array, dimension (NRHS). The scaling factors(k)is for the triangular systemA * x(:,k) = s(k)*b(:,k)orA**T* x(:,k) = s(k)*b(:,k). IfSCALE = 0, the matrix A is singular or badly scaled. IfA(j,j) = 0is encountered, a non-trivial vectorx(:,k)that is an exact or approximate solution toA*x(:,k) = 0is returned. If the system so badly scaled that solution cannot be presented asx(:,k) * 1/s(k), thenx(:,k) = 0is returned. Yeah. It's giving "we tried our best". 😭CNORM—DOUBLE PRECISION array, dimension (N).
If NORMIN = 'Y', CNORM is an input argument and CNORM(j) contains the norm of the off-diagonal part of the j-th column of A. If TRANS = 'N', CNORM(j) must be greater than or equal to the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j) must be greater than or equal to the 1-norm.
If NORMIN = 'N', CNORM is an output argument and CNORM(j) returns the 1-norm of the offdiagonal part of the j-th column of A.
WORK—DOUBLE PRECISION array, dimension (LWORK). On exit, ifINFO = 0,WORK(1)returns the optimal size ofWORK.LWORK—LWORKisINTEGERLWORK >= MAX(1, 2*NBA * MAX(NBA, MIN(NRHS, 32)),whereNBA = (N + NB - 1)/NBandNBis the optimal block size.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal dimensions of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. It's the "just tell me how much room I need, I'm not moving in yet" mode. 🫶
Parameters 👑
INFO—INTEGER= 0: successful exit 🎉< 0: ifINFO = -k, the k-th argument had an illegal value
Author ✍️
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
That's the whole section, bestie. Nothing under this heading in the source — no extra lore. Moving on.
✨ subroutine dlauu2 ✨
subroutine dlauu2 (character UPLO, integer N, double precision, dimension( lda, * ) A, integer LDA, integer INFO)
DLAUU2 computes the product UUH or LHL, where U and L are upper or lower triangular matrices (unblocked algorithm).
Purpose:
DLAUU2 computes the product U * U**T or L**T * L, where the triangular factor U or L is stored in the upper or lower triangular part of the array A.
If UPLO = 'U' or 'u' then the upper triangle of the result is stored, overwriting the factor U in A.
If UPLO = 'L' or 'l' then the lower triangle of the result is stored, overwriting the factor L in A.
This is the unblocked form of the algorithm, calling Level 2 BLAS. It's the small-batch, hand-crafted artisanal version. 🧚
Parameters
UPLO—CHARACTER*1. Specifies whether the triangular factor stored in the array A is upper or lower triangular:= 'U': Upper triangular= 'L': Lower triangular
N—INTEGER. The order of the triangular factor U or L.N >= 0.A—DOUBLE PRECISION array, dimension (LDA,N). On entry, the triangular factor U or L. On exit, ifUPLO = 'U', the upper triangle of A is overwritten with the upper triangle of the productU * U**T; ifUPLO = 'L', the lower triangle of A is overwritten with the lower triangle of the productL**T * L.LDA—INTEGER. The leading dimension of the array A.LDA >= max(1,N).INFO—INTEGER= 0: successful exit< 0: ifINFO = -k, the k-th argument had an illegal value
Author ✍️
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
✨ subroutine dlauum ✨
subroutine dlauum (character UPLO, integer N, double precision, dimension( lda, * ) A, integer LDA, integer INFO)
DLAUUM computes the product UUH or LHL, where U and L are upper or lower triangular matrices (blocked algorithm).
Purpose:
DLAUUM computes the product U * U**T or L**T * L, where the triangular factor U or L is stored in the upper or lower triangular part of the array A.
If UPLO = 'U' or 'u' then the upper triangle of the result is stored, overwriting the factor U in A.
If UPLO = 'L' or 'l' then the lower triangle of the result is stored, overwriting the factor L in A.
This is the blocked form of the algorithm, calling Level 3 BLAS. Same energy, but it eats bigger bites at a time. 🔥
Parameters
UPLO—CHARACTER*1. Specifies whether the triangular factor stored in the array A is upper or lower triangular:= 'U': Upper triangular= 'L': Lower triangular
N—INTEGER. The order of the triangular factor U or L.N >= 0.A—DOUBLE PRECISION array, dimension (LDA,N). On entry, the triangular factor U or L. On exit, ifUPLO = 'U', the upper triangle of A is overwritten with the upper triangle of the productU * U**T; ifUPLO = 'L', the lower triangle of A is overwritten with the lower triangle of the productL**T * L.LDA—INTEGER. The leading dimension of the array A.LDA >= max(1,N).INFO—INTEGER= 0: successful exit< 0: ifINFO = -k, the k-th argument had an illegal value
Author ✍️
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 subroutine drscl 🦋
subroutine drscl (integer N, double precision SA, double precision, dimension( * ) SX, integer INCX)
DRSCL multiplies a vector by the reciprocal of a real scalar. Math but make it fashion.
Purpose:
DRSCL multiplies an n-element real vector x by the real scalar 1/a.
This is done without overflow or underflow as long as the final result x/a does not overflow or underflow. Iconic behaviour honestly. 💅
Parameters
N—INTEGER. The number of components of the vector x.SA—DOUBLE PRECISION. The scalar a which is used to divide each component of x.SAmust be>= 0, or the subroutine will divide by zero. 👀 read that again, bestie.SX—DOUBLE PRECISION array, dimension (1+(N-1)*abs(INCX)). The n-element vector x.INCX—INTEGER. The increment between successive values of the vectorSX.> 0:SX(1) = X(1)andSX(1+(i-1)*INCX) = x(i), 1< i<= n
Author ✍️
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🌈 subroutine dtprfb 🌈
subroutine dtprfb (character SIDE, character TRANS, character DIRECT, character STOREV, integer M, integer N, integer K, integer L, double precision, dimension( ldv, * ) V, integer LDV, double precision, dimension( ldt, * ) T, integer LDT, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( ldb, * ) B, integer LDB, double precision, dimension( ldwork, * ) WORK, integer LDWORK)
DTPRFB applies a real 'triangular-pentagonal' block reflector to a real matrix, which is composed of two blocks. Yeah, two blocks. It's a whole thing and we're here for it. 🎀
Purpose:
DTPRFB applies a real 'triangular-pentagonal' block reflector H or its transpose H**T to a real matrix C, which is composed of two blocks A and B, either from the left or right.
Parameters
SIDE—CHARACTER*1= 'L': apply H orH**Tfrom the Left= 'R': apply H orH**Tfrom the Right
TRANS—CHARACTER*1= 'N': apply H (No transpose)= 'T': applyH**T(Transpose)
DIRECT—CHARACTER*1. Indicates how H is formed from a product of elementary reflectors= 'F':H = H(1) H(2) . . . H(k)(Forward)= 'B':H = H(k) . . . H(2) H(1)(Backward)
STOREV—CHARACTER*1. Indicates how the vectors which define the elementary reflectors are stored:= 'C': Columns= 'R': Rows
M—INTEGER. The number of rows of the matrix B.M >= 0.N—Nis INTEGER. it's the number of columns of the matrix B, and like…N >= 0, bestie. no negatives here 💅K—Kis INTEGER. this is the order of the matrix T, i.e. the number of elementary reflectors whose product defines the block reflector.K >= 0. yes queen, zero is allowed.L—Lis INTEGER. the order of the trapezoidal part of V. and the rule isK >= L >= 0. go read Further Details if you're confused, i got you 🫶V—Vis DOUBLE PRECISION array, dimension(LDV,K)ifSTOREV = 'C'(LDV,M)ifSTOREV = 'R'andSIDE = 'L'(LDV,N)ifSTOREV = 'R'andSIDE = 'R'
this is the pentagonal matrix V, and it's carrying the elementary reflectors H(1), H(2), ..., H(K). See Further Details. it's giving main character energy honestly ✨
LDV—LDVis INTEGER. the leading dimension of the array V. so:- if
STOREV = 'C'andSIDE = 'L', thenLDV >= max(1,M); - if
STOREV = 'C'andSIDE = 'R', thenLDV >= max(1,N); - if
STOREV = 'R', thenLDV >= K.
- if
T—Tis DOUBLE PRECISION array, dimension(LDT,K). it's the triangular K-by-K matrix T in the representation of the block reflector. she's triangular and she knows it 👑LDT—LDTis INTEGER. the leading dimension of the array T. andLDT >= K, periodt.A—Ais DOUBLE PRECISION array, dimension(LDA,N)ifSIDE = 'L'or(LDA,K)ifSIDE = 'R'
on entry, it's the K-by-N or M-by-K matrix A. on exit, A is overwritten by the corresponding block of H*C or H**T*C or C*H or C*H**T. See Further Details. yes bestie, overwritten, she's gone, don't come crying 😭
LDA—LDAis INTEGER. the leading dimension of the array A.- If
SIDE = 'L',LDA >= max(1,K); - If
SIDE = 'R',LDA >= max(1,M).
- If
B—Bis DOUBLE PRECISION array, dimension(LDB,N). on entry, the M-by-N matrix B. on exit, B is overwritten by the corresponding block ofH*CorH**T*CorC*HorC*H**T. See Further Details. same fate as A, sorry babe 🥀LDB—LDBis INTEGER. the leading dimension of the array B. andLDB >= max(1,M).WORK—WORKis DOUBLE PRECISION array, dimension(LDWORK,N)ifSIDE = 'L',(LDWORK,K)ifSIDE = 'R'.
LDWORK—LDWORKis INTEGER. the leading dimension of the array WORK.- If
SIDE = 'L',LDWORK >= K; - if
SIDE = 'R',LDWORK >= M.
- If
👑 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 Further Details
The matrix C is a composite matrix formed from blocks A and B. The block B is of size M-by-N; if SIDE = 'R', A is of size M-by-K, and if SIDE = 'L', A is of size K-by-N.
If SIDE = 'R' and DIRECT = 'F', C = [A B].
If SIDE = 'L' and DIRECT = 'F', C = [A]
[B].
If SIDE = 'R' and DIRECT = 'B', C = [B A].
If SIDE = 'L' and DIRECT = 'B', C = [B]
[A].
The pentagonal matrix V is composed of a rectangular block V1 and a trapezoidal block V2. The size of the trapezoidal block is determined by the parameter L, where 0<=L<=K. If L=K, the V2 block of V is triangular; if L=0, there is no trapezoidal block, thus V = V1 is rectangular.
If DIRECT = 'F' and STOREV = 'C': V = [V1]
[V2]
- V2 is upper trapezoidal (first L rows of K-by-K upper triangular)
If DIRECT = 'F' and STOREV = 'R': V = [V1 V2]
- V2 is lower trapezoidal (first L columns of K-by-K lower triangular)
If DIRECT = 'B' and STOREV = 'C': V = [V2]
[V1]
- V2 is lower trapezoidal (last L rows of K-by-K lower triangular)
If DIRECT = 'B' and STOREV = 'R': V = [V2 V1]
- V2 is upper trapezoidal (last L columns of K-by-K upper triangular)
If STOREV = 'C' and SIDE = 'L', V is M-by-K with V2 L-by-K.
If STOREV = 'C' and SIDE = 'R', V is N-by-K with V2 L-by-K.
If STOREV = 'R' and SIDE = 'L', V is K-by-M with V2 K-by-L.
If STOREV = 'R' and SIDE = 'R', V is K-by-N with V2 K-by-L.
🧚 subroutine slatrd
subroutine slatrd (character UPLO, integer N, integer NB, real, dimension(
lda, * ) A, integer LDA, real, dimension( * ) E, real, dimension( * )
TAU, real, dimension( ldw, * ) W, integer LDW)
SLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal form by an orthogonal similarity transformation.
✨ Purpose
SLATRD reduces NB rows and columns of a real symmetric matrix A to symmetric tridiagonal form by an orthogonal similarity transformation Q**T * A * Q, and returns the matrices V and W which are needed to apply the transformation to the unreduced part of A.
If UPLO = 'U', SLATRD reduces the last NB rows and columns of a matrix, of which the upper triangle is supplied; if UPLO = 'L', SLATRD reduces the first NB rows and columns of a matrix, of which the lower triangle is supplied.
This is an auxiliary routine called by SSYTRD. yeah she's the support act but she's lowkey the moment 💅
🌸 Parameters
UPLO—UPLOis CHARACTER*1. specifies whether the upper or lower triangular part of the symmetric matrix A is stored:= 'U': Upper triangular= 'L': Lower triangular
N—Nis INTEGER. the order of the matrix A.NB—NBis INTEGER. the number of rows and columns to be reduced.A—Ais REAL array, dimension(LDA,N). on entry, the symmetric matrix A. IfUPLO = 'U', the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. IfUPLO = 'L', the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced.
On exit:
- if
UPLO = 'U', the last NB columns have been reduced to tridiagonal form, with the diagonal elements overwriting the diagonal elements of A; the elements above the diagonal with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors; - if
UPLO = 'L', the first NB columns have been reduced to tridiagonal form, with the diagonal elements overwriting the diagonal elements of A; the elements below the diagonal with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors.
See Further Details.
LDA—LDAis INTEGER. the leading dimension of the array A.LDA >= (1,N).E—Eis REAL array, dimension(N-1). IfUPLO = 'U',E(n-nb:n-1)contains the superdiagonal elements of the last NB columns of the reduced matrix; ifUPLO = 'L',E(1:nb)contains the subdiagonal elements of the first NB columns of the reduced matrix.TAU—TAUis REAL array, dimension(N-1). the scalar factors of the elementary reflectors, stored inTAU(n-nb:n-1)ifUPLO = 'U', and inTAU(1:nb)ifUPLO = 'L'. See Further Details.W—Wis REAL array, dimension(LDW,NB). the n-by-nb matrix W required to update the unreduced part of A.LDW—LDWis INTEGER. the leading dimension of the array W.LDW >= max(1,N).
👑 Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
🦋 Further Details
If UPLO = 'U', the matrix Q is represented as a product of elementary reflectors
Q = H(n) H(n-1) . . . H(n-nb+1).
Each H(i) has the form
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(i:n) = 0 and v(i-1) = 1; v(1:i-1) is stored on exit in A(1:i-1,i), and tau in TAU(i-1).
If UPLO = 'L', the matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(nb).
Each H(i) has the form
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+1:n) is stored on exit in A(i+1:n,i), and tau in TAU(i).
The elements of the vectors v together form the n-by-nb matrix V which is needed, with W, to apply the transformation to the unreduced part of the matrix, using a symmetric rank-2k update of the form: A := A - V*W**T - W*V**T.
The contents of A on exit are illustrated by the following examples with n = 5 and nb = 2:
if UPLO = 'U': if UPLO = 'L':
( a a a v4 v5 ) ( d )
( a a v4 v5 ) ( 1 d )
( a 1 v5 ) ( v1 1 a )
( d 1 ) ( v1 v2 a a )
( d ) ( v1 v2 a a a )
where d denotes a diagonal element of the reduced matrix, a denotes an element of the original matrix that is unchanged, and vi denotes an element of the vector defining H(i).
🦋 subroutine slatrs3
subroutine slatrs3 (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, integer NRHS, real, dimension( lda, * ) A,
integer LDA, real, dimension( ldx, * ) X, integer LDX, real, dimension(
* ) SCALE, real, dimension( * ) CNORM, real, dimension( * ) WORK,
integer LWORK, integer INFO)
SLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow.
✨ Purpose
SLATRS3 solves one of the triangular systems
A * X = B * diag(scale) or A**T * X = B * diag(scale)
...with scaling to prevent overflow, bestie. So like, here A is an upper or lower triangular matrix, A**T denotes the transpose of A. X and B are n by nrhs matrices and scale is an nrhs-element vector of scaling factors. A scaling factor scale(j) is usually less than or equal to 1, chosen such that X(:,j) is less than the overflow threshold. If the matrix A is singular (A(j,j) = 0 for some j), then a non-trivial solution to A*X = 0 is returned. If the system is so badly scaled that the solution cannot be represented as (1/scale(k))*X(:,k), then x(:,k) = 0 and scale(k) is returned. 💅
And like, this is a BLAS-3 version of LATRS for solving several right hand sides simultaneously. Periodt. ✨
🌸 Parameters 🌸
UPLO—UPLOisCHARACTER*1. Tells you whether the matrixAis upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—TRANSisCHARACTER*1. Specifies the operation applied toA.= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose = Transpose)
DIAG—DIAGisCHARACTER*1. Specifies whether or not the matrixAis unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—NORMINisCHARACTER*1. Specifies whetherCNORMhas been set or not.= 'Y':CNORMcontains the column norms on entry= 'N':CNORMis not set on entry. On exit, the norms will be computed and stored inCNORM.
N—NisINTEGER. The order of the matrixA.N >= 0.NRHS—NRHSisINTEGER. The number of columns ofX.NRHS >= 0.A—AisREALarray, dimension(LDA,N). The triangular matrixA. IfUPLO = 'U', the leadingnbynupper triangular part of the arrayAcontains the upper triangular matrix, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leadingnbynlower triangular part of the arrayAcontains the lower triangular matrix, and the strictly upper triangular part ofAis not referenced. IfDIAG = 'U', the diagonal elements ofAare also not referenced and are assumed to be 1.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max (1,N).X—XisREALarray, dimension(LDX,NRHS). On entry, the right hand sideBof the triangular system. On exit,Xis overwritten by the solution matrixX.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDX >= max (1,N).SCALE—SCALEisREALarray, dimension(NRHS). The scaling factors(k)is for the triangular systemA * x(:,k) = s(k)*b(:,k)orA**T* x(:,k) = s(k)*b(:,k). IfSCALE = 0, the matrixAis singular or badly scaled. IfA(j,j) = 0is encountered, a non-trivial vectorx(:,k)that is an exact or approximate solution toA*x(:,k) = 0is returned. If the system so badly scaled that solution cannot be presented asx(:,k) * 1/s(k), thenx(:,k) = 0is returned.CNORM—CNORMisREALarray, dimension(N).- If
NORMIN = 'Y',CNORMis an input argument andCNORM(j)contains the norm of the off-diagonal part of thej-th column ofA. IfTRANS = 'N',CNORM(j)must be greater than or equal to the infinity-norm, and ifTRANS = 'T'or'C',CNORM(j)must be greater than or equal to the 1-norm. - If
NORMIN = 'N',CNORMis an output argument andCNORM(j)returns the 1-norm of the offdiagonal part of thej-th column ofA.
- If
WORK—WORKisREALarray, dimension(LWORK). On exit, ifINFO = 0,WORK(1)returns the optimal size ofWORK.LWORK—LWORKisINTEGER.LWORK >= MAX(1, 2*NBA * MAX(NBA, MIN(NRHS, 32)), whereNBA = (N + NB - 1)/NBandNBis the optimal block size.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal dimensions of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. 👑
Parameters
INFO—INFOisINTEGER.= 0: successful exit< 0: ifINFO = -k, thek-th argument had an illegal value
💖 Author 💖
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
🦋 subroutine zlatrs3 🦋
subroutine zlatrs3 (character UPLO, character TRANS, character DIAG,
character NORMIN, integer N, integer NRHS, complex*16, dimension( lda, * )
A, integer LDA, complex*16, dimension( ldx, * ) X, integer LDX, double
precision, dimension( * ) SCALE, double precision, dimension( * ) CNORM,
double precision, dimension( * ) WORK, integer LWORK, integer INFO)
ZLATRS3 solves a triangular system of equations with the scale factors set to prevent overflow. 💅✨
🌈 Purpose: 🌈
ZLATRS3 solves one of the triangular systems
A * X = B * diag(scale), A**T * X = B * diag(scale), or
A**H * X = B * diag(scale)
with scaling to prevent overflow, bestie. So like, here A is an upper or lower triangular matrix, A**T denotes the transpose of A, A**H denotes the conjugate transpose of A. X and B are n-by-nrhs matrices and scale is an nrhs-element vector of scaling factors. A scaling factor scale(j) is usually less than or equal to 1, chosen such that X(:,j) is less than the overflow threshold. If the matrix A is singular (A(j,j) = 0 for some j), then a non-trivial solution to A*X = 0 is returned. If the system is so badly scaled that the solution cannot be represented as (1/scale(k))*X(:,k), then x(:,k) = 0 and scale(k) is returned. 😭
And like, this is a BLAS-3 version of LATRS for solving several right hand sides simultaneously. Iconic. ✨
🎀 Parameters 🎀
UPLO—UPLOisCHARACTER*1. Tells you whether the matrixAis upper or lower triangular.= 'U': Upper triangular= 'L': Lower triangular
TRANS—TRANSisCHARACTER*1. Specifies the operation applied toA.= 'N': SolveA * x = s*b(No transpose)= 'T': SolveA**T* x = s*b(Transpose)= 'C': SolveA**T* x = s*b(Conjugate transpose)
DIAG—DIAGisCHARACTER*1. Specifies whether or not the matrixAis unit triangular.= 'N': Non-unit triangular= 'U': Unit triangular
NORMIN—NORMINisCHARACTER*1. Specifies whetherCNORMhas been set or not.= 'Y':CNORMcontains the column norms on entry= 'N':CNORMis not set on entry. On exit, the norms will be computed and stored inCNORM.
N—NisINTEGER. The order of the matrixA.N >= 0.NRHS—NRHSisINTEGER. The number of columns ofX.NRHS >= 0.A—AisCOMPLEX*16array, dimension(LDA,N). The triangular matrixA. IfUPLO = 'U', the leadingnbynupper triangular part of the arrayAcontains the upper triangular matrix, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leadingnbynlower triangular part of the arrayAcontains the lower triangular matrix, and the strictly upper triangular part ofAis not referenced. IfDIAG = 'U', the diagonal elements ofAare also not referenced and are assumed to be 1.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max (1,N).X—XisCOMPLEX*16array, dimension(LDX,NRHS). On entry, the right hand sideBof the triangular system. On exit,Xis overwritten by the solution matrixX.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDX >= max (1,N).SCALE—SCALEisDOUBLE PRECISIONarray, dimension(NRHS). The scaling factors(k)is for the triangular systemA * x(:,k) = s(k)*b(:,k)orA**T* x(:,k) = s(k)*b(:,k). IfSCALE = 0, the matrixAis singular or badly scaled. IfA(j,j) = 0is encountered, a non-trivial vectorx(:,k)that is an exact or approximate solution toA*x(:,k) = 0is returned. If the system so badly scaled that solution cannot be presented asx(:,k) * 1/s(k), thenx(:,k) = 0is returned.CNORM—CNORMisDOUBLE PRECISIONarray, dimension(N).- If
NORMIN = 'Y',CNORMis an input argument andCNORM(j)contains the norm of the off-diagonal part of thej-th column ofA. IfTRANS = 'N',CNORM(j)must be greater than or equal to the infinity-norm, and ifTRANS = 'T'or'C',CNORM(j)must be greater than or equal to the 1-norm. - If
NORMIN = 'N',CNORMis an output argument andCNORM(j)returns the 1-norm of the offdiagonal part of thej-th column ofA.
- If
WORK—WORKisDOUBLE PRECISIONarray, dimension(LWORK). On exit, ifINFO = 0,WORK(1)returns the optimal size ofWORK.LWORK—LWORKisINTEGER.LWORK >= MAX(1, 2*NBA * MAX(NBA, MIN(NRHS, 32)), whereNBA = (N + NB - 1)/NBandNBis the optimal block size.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal dimensions of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. 👑
Parameters
INFO—INFOisINTEGER.= 0: successful exit< 0: ifINFO = -k, thek-th argument had an illegal value
💜 Author 💜
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
…and last but never least, the closing credits give a lil shoutout to NAG Ltd. 💖 yup, they're in the building, they're part of the story, iconic behavior.
🌸 Further Details 🌸
okay so this heading is literally here ✨ and the actual details are the ones we already spilled above, bestie — nothing new gets dropped under this label, it's just the vibe check at the end of the function docs. no cap, that's the whole section. 🫶
🎀 Author 🎀
Generated automatically by Doxygen for LAPACK from the source code. 🤖✨
so like… nobody hand-wrote this bad boy, Doxygen just read the LAPACK source and went "i got you, bestie" and generated the whole page. machine-made, still ate. 💅
lowkey a whole mood that this entire man page is auto-generated and still this detailed. main character energy from a doc tool, fr fr. 😭👑
and that's a wrap on doubleOTHERauxiliary(3) babes!! 🦋🌸 this page came to you from LAPACK, version 3.11.0, dated Sun Nov 27 2022 — screenshot it, cite it, love it, and go read some source code. mwah. 💖✨🎀🫶
📦 where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms