doubleGEcomputational(3)
π doubleGEcomputational(3) π
okay so bestie, welcome to doubleGEcomputational(3) β that's the LAPACK manual page, section 3, and if you ever forget what it's called, the whole name is literally just double. no notes, it's giving minimalism. π
β¨ NAME β¨
doubleGEcomputational β double π
like. that's it. that's the name. we move.
πΈ SYNOPSIS πΈ
π¦ Functions π¦
okay so here's the whole squad, one by one, signatures verbatim because we do not play with parameter lists around here:
cgelqtβsubroutine cgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO)β CGELQTcgelqt3βrecursive subroutine cgelqt3 (M, N, A, LDA, T, LDT, INFO)β CGELQT3cgemlqtβsubroutine cgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)β CGEMLQTdgebakβsubroutine dgebak (JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, INFO)β DGEBAKdgebalβsubroutine dgebal (JOB, N, A, LDA, ILO, IHI, SCALE, INFO)β DGEBALdgebd2βsubroutine dgebd2 (M, N, A, LDA, D, E, TAUQ, TAUP, WORK, INFO)β DGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.dgebrdβsubroutine dgebrd (M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO)β DGEBRDdgeconβsubroutine dgecon (NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK, INFO)β DGECONdgeequβsubroutine dgeequ (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO)β DGEEQUdgeequbβsubroutine dgeequb (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO)β DGEEQUBdgehd2βsubroutine dgehd2 (N, ILO, IHI, A, LDA, TAU, WORK, INFO)β DGEHD2 reduces a general square matrix to upper Hessenberg form using an unblocked algorithm.dgehrdβsubroutine dgehrd (N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO)β DGEHRDdgelq2βsubroutine dgelq2 (M, N, A, LDA, TAU, WORK, INFO)β DGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.dgelqfβsubroutine dgelqf (M, N, A, LDA, TAU, WORK, LWORK, INFO)β DGELQFdgelqtβsubroutine dgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO)β DGELQTdgelqt3βrecursive subroutine dgelqt3 (M, N, A, LDA, T, LDT, INFO)β DGELQT3 recursively computes a LQ factorization of a general real or complex matrix using the compact WY representation of Q.dgemlqtβsubroutine dgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)β DGEMLQTdgemqrtβsubroutine dgemqrt (SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)β DGEMQRTdgeql2βsubroutine dgeql2 (M, N, A, LDA, TAU, WORK, INFO)β DGEQL2 computes the QL factorization of a general rectangular matrix using an unblocked algorithm.dgeqlfβsubroutine dgeqlf (M, N, A, LDA, TAU, WORK, LWORK, INFO)β DGEQLFdgeqp3βsubroutine dgeqp3 (M, N, A, LDA, JPVT, TAU, WORK, LWORK, INFO)β DGEQP3dgeqr2βsubroutine dgeqr2 (M, N, A, LDA, TAU, WORK, INFO)β DGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.dgeqr2pβsubroutine dgeqr2p (M, N, A, LDA, TAU, WORK, INFO)β DGEQR2P computes the QR factorization of a general rectangular matrix with non-negative diagonal elements using an unblocked algorithm.dgeqrfβsubroutine dgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)β DGEQRFdgeqrfpβsubroutine dgeqrfp (M, N, A, LDA, TAU, WORK, LWORK, INFO)β DGEQRFPdgeqrtβsubroutine dgeqrt (M, N, NB, A, LDA, T, LDT, WORK, INFO)β DGEQRTdgeqrt2βsubroutine dgeqrt2 (M, N, A, LDA, T, LDT, INFO)β DGEQRT2 computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.dgeqrt3βrecursive subroutine dgeqrt3 (M, N, A, LDA, T, LDT, INFO)β DGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.dgerfsβsubroutine dgerfs (TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)β DGERFSdgerfsxβsubroutine dgerfsx (TRANS, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO)β DGERFSXdgerq2βsubroutine dgerq2 (M, N, A, LDA, TAU, WORK, INFO)β DGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm.dgerqfβsubroutine dgerqf (M, N, A, LDA, TAU, WORK, LWORK, INFO)β DGERQFdgesvjβsubroutine dgesvj (JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V, LDV, WORK, LWORK, INFO)β DGESVJdgetf2βsubroutine dgetf2 (M, N, A, LDA, IPIV, INFO)β DGETF2 computes the LU factorization of a general m-by-n matrix using partial pivoting with row interchanges (unblocked algorithm).dgetrfβsubroutine dgetrf (M, N, A, LDA, IPIV, INFO)β DGETRFdgetrf2βrecursive subroutine dgetrf2 (M, N, A, LDA, IPIV, INFO)β DGETRF2dgetriβsubroutine dgetri (N, A, LDA, IPIV, WORK, LWORK, INFO)β DGETRIdgetrsβsubroutine dgetrs (TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)β DGETRSdhgeqzβsubroutine dhgeqz (JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, INFO)β DHGEQZdla_geamvβsubroutine dla_geamv (TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)β DLA_GEAMV computes a matrix-vector product using a general matrix to calculate error bounds.dla_gercondβdouble precision function dla_gercond (TRANS, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)β DLA_GERCOND estimates the Skeel condition number for a general matrix.dla_gerfsx_extendedβsubroutine dla_gerfsx_extended (PREC_TYPE, TRANS_TYPE, N, NRHS, A, LDA, AF, LDAF, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERRS_N, ERRS_C, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)β DLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.dla_gerpvgrwβdouble precision function dla_gerpvgrw (N, NCOLS, A, LDA, AF, LDAF)β DLA_GERPVGRWdlaorhr_col_getrfnpβsubroutine dlaorhr_col_getrfnp (M, N, A, LDA, D, INFO)β DLAORHR_COL_GETRFNPdlaorhr_col_getrfnp2βrecursive subroutine dlaorhr_col_getrfnp2 (M, N, A, LDA, D, INFO)β DLAORHR_COL_GETRFNP2dlaqz0βrecursive subroutine dlaqz0 (WANTS, WANTQ, WANTZ, N, ILO, IHI, A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, REC, INFO)β DLAQZ0dlaqz1βsubroutine dlaqz1 (A, LDA, B, LDB, SR1, SR2, SI, BETA1, BETA2, V)β DLAQZ1dlaqz2βsubroutine dlaqz2 (ILQ, ILZ, K, ISTARTM, ISTOPM, IHI, A, LDA, B, LDB, NQ, QSTART, Q, LDQ, NZ, ZSTART, Z, LDZ)β DLAQZ2dlaqz3βrecursive subroutine dlaqz3 (ILSCHUR, ILQ, ILZ, N, ILO, IHI, NW, A, LDA, B, LDB, Q, LDQ, Z, LDZ, NS, ND, ALPHAR, ALPHAI, BETA, QC, LDQC, ZC, LDZC, WORK, LWORK, REC, INFO)β DLAQZ3dlaqz4βsubroutine dlaqz4 (ILSCHUR, ILQ, ILZ, N, ILO, IHI, NSHIFTS, NBLOCK_DESIRED, SR, SI, SS, A, LDA, B, LDB, Q, LDQ, Z, LDZ, QC, LDQC, ZC, LDZC, WORK, LWORK, INFO)β DLAQZ4dtgevcβsubroutine dtgevc (SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL, LDVL, VR, LDVR, MM, M, WORK, INFO)β DTGEVCdtgexcβsubroutine dtgexc (WANTQ, WANTZ, N, A, LDA, B, LDB, Q, LDQ, Z, LDZ, IFST, ILST, WORK, LWORK, INFO)β DTGEXCsgelqtβsubroutine sgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO)β SGELQTsgelqt3βrecursive subroutine sgelqt3 (M, N, A, LDA, T, LDT, INFO)β SGELQT3sgemlqtβsubroutine sgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)β SGEMLQTslaqz0βrecursive subroutine slaqz0 (WANTS, WANTQ, WANTZ, N, ILO, IHI, A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, REC, INFO)β SLAQZ0slaqz1βsubroutine slaqz1 (A, LDA, B, LDB, SR1, SR2, SI, BETA1, BETA2, V)β SLAQZ1slaqz2βsubroutine slaqz2 (ILQ, ILZ, K, ISTARTM, ISTOPM, IHI, A, LDA, B, LDB, NQ, QSTART, Q, LDQ, NZ, ZSTART, Z, LDZ)β SLAQZ2slaqz3βrecursive subroutine slaqz3 (ILSCHUR, ILQ, ILZ, N, ILO, IHI, NW, A, LDA, B, LDB, Q, LDQ, Z, LDZ, NS, ND, ALPHAR, ALPHAI, BETA, QC, LDQC, ZC, LDZC, WORK, LWORK, REC, INFO)β SLAQZ3slaqz4βsubroutine slaqz4 (ILSCHUR, ILQ, ILZ, N, ILO, IHI, NSHIFTS, NBLOCK_DESIRED, SR, SI, SS, A, LDA, B, LDB, Q, LDQ, Z, LDZ, QC, LDQC, ZC, LDZC, WORK, LWORK, INFO)β SLAQZ4zgelqtβsubroutine zgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO)β ZGELQTzgelqt3βrecursive subroutine zgelqt3 (M, N, A, LDA, T, LDT, INFO)β ZGELQT3 recursively computes a LQ factorization of a general real or complex matrix using the compact WY representation of Q.zgemlqtβsubroutine zgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)β ZGEMLQT
π« Detailed Description π«
okay so the vibe in one line: this is the group of double computational functions for GE matrices. that's the whole lore. GE matrices. double precision. computational. slay. β¨
π Function Documentation π
πΈ subroutine cgelqt (integer M, integer N, integer MB, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldt, * ) T, integer LDT, complex, dimension( * ) WORK, integer INFO) πΈ
CGELQT
π Purpose:
CGELQT computes a blocked LQ factorization of a complex M-by-N matrix A using the compact WY representation of Q. periodt. that's the whole job description and it does it flawlessly. π«Ά
π Parameters π
MβM is INTEGER. bestie, this is the number of rows of the matrixA. constraint:M >= 0.NβN is INTEGER. the number of columns of the matrixA. constraint:N >= 0.MBβMB is INTEGER. the block size to be used in the blocked QR. constraint:MIN(M,N) >= MB >= 1. it's giving "medium, but make it a block size." πAβA is COMPLEX array, dimension (LDA,N). on entry: theM-by-NmatrixA. on exit: the elements on and below the diagonal of the array contain theM-by-MIN(M,N)lower trapezoidal matrixL(Lis lower triangular ifM <= N); the elements above the diagonal are the rows ofV. so it comes in asA, leaves as two things at once. multitasking icon. πLDAβLDA is INTEGER. the leading dimension of the arrayA. constraint:LDA >= max(1,M).TβT is COMPLEX array, dimension (LDT,MIN(M,N)). the upper triangular block reflectors stored in compact form as a sequence of upper triangular blocks. see below for further details β yes, there's a whole section, we're getting there. πLDTβLDT is INTEGER. the leading dimension of the arrayT. constraint:LDT >= MB.WORKβWORK is COMPLEX array, dimension (MB*N). that's it. that's the whole description. no notes.INFOβINFO is INTEGER. the receipts:= 0: successful exit. we love to see it. π< 0: ifINFO = -i, the i-th argument had an illegal value. not the vibe. π
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the whole academic friend group showed up to write this. iconic. π
π¦ Further Details: π¦
the matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. for example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 )
look at her. the little staircase of ones. the v1 v1 v1 v1. it's giving structure. π§
and that's just the opener, bestie β there's a whole lineup still waiting backstage π
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. Let K=MIN(M,N). The number of blocks is B = ceiling(K/MB), where each block is of order MB except for the last block, which is of order IB = K - (B-1)*MB. For each of the B blocks, a upper triangular block reflector factor is computed: T1, T2, ..., TB. The MB-by-MB (and IB-by-IB for the last block) T's are stored in the MB-by-K matrix T as
T = (T1 T2 ... TB).
π¦ recursive subroutine cgelqt3
recursive subroutine cgelqt3 (integer M, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldt, * ) T, integer LDT, integer INFO)
CGELQT3
Purpose:
CGELQT3 recursively computes a LQ factorization of a complex M-by-N matrix A, using the compact WY representation of Q.
Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000.
Parameters
MβM is INTEGER. The number of rows of the matrixA.M =< N.NβN is INTEGER. The number of columns of the matrixA.N >= 0.AβA is COMPLEX array, dimension (LDA,N). On entry, the complexM-by-NmatrixA. On exit, the elements on and below the diagonal contain theN-by-Nlower triangular matrixL; the elements above the diagonal are the rows ofV. See below for further details. πLDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TβT is COMPLEX array, dimension (LDT,N). TheN-by-Nupper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflectorT; the elements below the diagonal are not used. See below for further details.LDTβLDT is INTEGER. The leading dimension of the arrayT.LDT >= max(1,N).INFOβINFO is INTEGER= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
For details of the algorithm, see Elmroth and Gustavson (cited above). π
π subroutine cgemlqt
subroutine cgemlqt (character SIDE, character TRANS, integer M, integer N, integer K, integer MB, complex, dimension( ldv, * ) V, integer LDV, complex, dimension( ldt, * ) T, integer LDT, complex, dimension( ldc, * ) C, integer LDC, complex, dimension( * ) WORK, integer INFO)
CGEMLQT
Purpose:
CGEMLQT overwrites the general complex M-by-N matrix C with
SIDE = 'L' SIDE = 'R'
TRANS = 'N': Q C C Q
TRANS = 'C': Q**H C C Q**H
where Q is a complex unitary matrix defined as the product of K elementary reflectors:
Q = H(1) H(2) . . . H(K) = I - V T V**H
generated using the compact WY representation as returned by CGELQT.
Q is of order M if SIDE = 'L' and of order N if SIDE = 'R'.
Parameters
SIDEβSIDE is CHARACTER*1= 'L': applyQorQ**Hfrom the Left;= 'R': applyQorQ**Hfrom the Right.
TRANSβTRANS is CHARACTER*1= 'N': No transpose, applyQ;= 'C': Conjugate transpose, applyQ**H.
MβM is INTEGER. The number of rows of the matrixC.M >= 0.NβN is INTEGER. The number of columns of the matrixC.N >= 0.KβK is INTEGER. The number of elementary reflectors whose product defines the matrixQ. IfSIDE = 'L',M >= K >= 0; ifSIDE = 'R',N >= K >= 0.MBβMB is INTEGER. The block size used for the storage ofT.K >= MB >= 1. This must be the same value ofMBused to generateTinCGELQT.VβV is COMPLEX array, dimension(LDV,M)ifSIDE = 'L',(LDV,N)ifSIDE = 'R'. Thei-th row must contain the vector which defines the elementary reflectorH(i), fori = 1,2,...,k, as returned byCGELQTin the firstKrows of its array argumentA.LDVβLDV is INTEGER. The leading dimension of the arrayV.LDV >= max(1,K).TβT is COMPLEX array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned byCGELQT, stored as aMB-by-Kmatrix.LDTβLDT is INTEGER. The leading dimension of the arrayT.LDT >= MB.CβC is COMPLEX array, dimension (LDC,N). On entry, theM-by-NmatrixC. On exit,Cis overwritten byQ C,Q**H C,C Q**HorC Q.LDCβLDC is INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORKβWORK is COMPLEX array. The dimension ofWORKisN*MBifSIDE = 'L', orM*MBifSIDE = 'R'.INFOβINFO is INTEGER= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
πΈ subroutine dgebak
subroutine dgebak (character JOB, character SIDE, integer N, integer ILO, integer IHI, double precision, dimension( * ) SCALE, integer M, double precision, dimension( ldv, * ) V, integer LDV, integer INFO)
DGEBAK
Purpose:
DGEBAK forms the right or left eigenvectors of a real general matrix by backward transformation on the computed eigenvectors of the balanced matrix output by DGEBAL. it's giving glow-up-in-reverse π
Parameters
JOBβJOB is CHARACTER*1. Specifies the type of backward transformation required:= 'N': do nothing, return immediately;= 'P': do backward transformation for permutation only;= 'S': do backward transformation for scaling only;= 'B': do backward transformations for both permutation and scaling.
JOB must be the same as the argument JOB supplied to DGEBAL.
SIDEβSIDE is CHARACTER*1= 'R':Vcontains right eigenvectors;= 'L':Vcontains left eigenvectors.
NβN is INTEGER. The number of rows of the matrixV.N >= 0.ILOβILO is INTEGERIHIβIHI is INTEGER. The integersILOandIHIdetermined byDGEBAL.1 <= ILO <= IHI <= N, ifN > 0;ILO=1andIHI=0, ifN=0.SCALEβSCALE is DOUBLE PRECISION array, dimension (N). Details of the permutation and scaling factors, as returned byDGEBAL.MβM is INTEGER. The number of columns of the matrixV.M >= 0.VβV is DOUBLE PRECISION array, dimension (LDV,M). On entry, the matrix of right or left eigenvectors to be transformed, as returned byDHSEINorDTREVC. On exit,Vis overwritten by the transformed eigenvectors.LDVβLDV is INTEGER. The leading dimension of the arrayV.LDV >= max(1,N).INFOβINFO is INTEGER= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π subroutine dgebal
subroutine dgebal (character JOB, integer N, double precision, dimension( lda, * ) A, integer LDA, integer ILO, integer IHI, double precision, dimension( * ) SCALE, integer INFO)
DGEBAL
Purpose:
DGEBAL balances a general real matrix A. This involves, first, permuting A by a similarity transformation to isolate eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements on the diagonal; and second, applying a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional. lowkey both are optional, highkey both are iconic π
Balancing may reduce the 1-norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors.
Parameters
JOBβJOB is CHARACTER*1. Specifies the operations to be performed onA:= 'N': none: simply setILO = 1,IHI = N,SCALE(I) = 1.0fori = 1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβN is INTEGER. The order of the matrixA.N >= 0.AβA is DOUBLE PRECISION array, dimension (LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced. See Further Details.LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).ILOβILO is INTEGERIHIβIHI is INTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0ifi > jandj = 1,...,ILO-1orI = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.SCALE
Details of the permutations and scaling factors applied to A. If P(j) is the index of the row and column interchanged with row and column j, and D(j) is the scaling factor applied to row and column j, then bestie, here's the whole tea:
SCALE(j) = P(j) for j = 1,...,ILO-1
= D(j) for j = ILO,...,IHI
= P(j) for j = IHI+1,...,N.
And the order in which the interchanges are made? That's N to IHI+1, then 1 to ILO-1. Not the other way around. Order matters, iykyk. π
INFOβINTEGER, the lil status report:= 0: successful exit. we ate, no notes π< 0: ifINFO = -i, thei-th argument had an illegal value. rude. π
πΈ Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ Further Details π¦
The permutations consist of row and column interchanges which put the matrix in the form
( T1 X Y )
P A P = ( 0 B Z )
( 0 0 T2 )
where T1 and T2 are upper triangular matrices whose eigenvalues lie along the diagonal. The column indices ILO and IHI mark the starting and ending columns of the submatrix B. Balancing consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1-norms of each row of B and its corresponding column nearly equal. The output matrix is
( T1 X*D Y )
( 0 inv(D)*B*D inv(D)*Z ).
( 0 0 T2 )
Information about the permutations P and the diagonal matrix D is returned in the vector SCALE.
This subroutine is based on the EISPACK routine BALANC. a classic, honestly, we stan a lineage β¨
Modified by Tzu-Yi Chen, Computer Science Division, University of California at Berkeley, USA.
π§ subroutine dgebd2 π§
subroutine dgebd2 (integer M, integer N, 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( * ) WORK, integer INFO)
DGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm. unblocked = it does the whole thing itself, no delegation, main character energy fr π
Purpose:
DGEBD2 reduces a real general m by n matrix A to upper or lower bidiagonal form B by an orthogonal transformation: Q**T * A * P = B.
If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
Parameters
MβINTEGER. The number of rows in the matrixA.M >= 0.NβINTEGER. The number of columns in the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the m by n general matrix to be reduced. On exit:- if
m >= n, the diagonal and the first superdiagonal are overwritten with the upper bidiagonal matrixB; the elements below the diagonal, with the arrayTAUQ, represent the orthogonal matrixQas a product of elementary reflectors, and the elements above the first superdiagonal, with the arrayTAUP, represent the orthogonal matrixPas a product of elementary reflectors; - if
m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrixB; the elements below the first subdiagonal, with the arrayTAUQ, represent the orthogonal matrixQas a product of elementary reflectors, and the elements above the diagonal, with the arrayTAUP, represent the orthogonal matrixPas a product of elementary reflectors. - See Further Details below. π
- if
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).DβDOUBLE PRECISIONarray, dimension(min(M,N)). The diagonal elements of the bidiagonal matrixB:D(i) = A(i,i).EβDOUBLE PRECISIONarray, dimension(min(M,N)-1). The off-diagonal elements of the bidiagonal matrixB:- if
m >= n,E(i) = A(i,i+1)fori = 1,2,...,n-1; - if
m < n,E(i) = A(i+1,i)fori = 1,2,...,m-1.
- if
TAUQβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrixQ. See Further Details. π«TAUPβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrixP. See Further Details. π«WORKβDOUBLE PRECISIONarray, dimension(max(M,N)).INFOβINTEGER:= 0: successful exit. slay π< 0: ifINFO = -i, thei-th argument had an illegal value. not slay π
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π Further Details π
The matrices Q and P are represented as products of elementary reflectors:
If m >= n,
Q = H(1) H(2) . . . H(n) and P = G(1) G(2) . . . G(n-1)
Each H(i) and G(i) has the 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; v(1:i-1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
If m < n,
Q = H(1) H(2) . . . H(m-1) and P = G(1) G(2) . . . G(m)
Each H(i) and G(i) has the 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; v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i); u(1:i-1) = 0, u(i) = 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).
The contents of A on exit are illustrated by the following examples: visual learner moment, we love to see it πΈ
m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n):
( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 )
( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 )
( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 )
( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 )
( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 )
( v1 v2 v3 v4 v5 )
where d and e denote diagonal and off-diagonal elements of B, vi denotes an element of the vector defining H(i), and ui an element of the vector defining G(i).
π subroutine dgebrd π
subroutine dgebrd (integer M, integer N, 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( * ) WORK, integer LWORK, integer INFO)
DGEBRD. That's it, that's the one-liner. no subtitle, just vibes π¦
Purpose:
DGEBRD reduces a general real M-by-N matrix A to upper or lower bidiagonal form B by an orthogonal transformation: Q**T * A * P = B.
If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
Parameters
MβINTEGER. The number of rows in the matrixA.M >= 0.NβINTEGER. The number of columns in the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N general matrix to be reduced. On exit:- if
m >= n, the diagonal and the first superdiagonal are overwritten with the upper bidiagonal matrixB; the elements below the diagonal, with the arrayTAUQ, represent the orthogonal matrixQas a product of elementary reflectors, and the elements above the first superdiagonal, with the arrayTAUP, represent the orthogonal matrixPas a product of elementary reflectors; - if
m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrixB; the elements below the first subdiagonal, with the arrayTAUQ, represent the orthogonal matrixQas a product of elementary reflectors, and the elements above the diagonal, with the arrayTAUP, represent the orthogonal matrixPas a product of elementary reflectors. - See Further Details. π
- if
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).DβDOUBLE PRECISIONarray, dimension(min(M,N)). The diagonal elements of the bidiagonal matrixB:D(i) = A(i,i).EβDOUBLE PRECISIONarray, dimension(min(M,N)-1). The off-diagonal elements of the bidiagonal matrixB:- if
m >= n,E(i) = A(i,i+1)fori = 1,2,...,n-1; - if
m < n,E(i) = A(i+1,i)fori = 1,2,...,m-1.
- if
TAUQβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrixQ. See Further Details. β¨TAUPβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrixP. See Further Details. β¨WORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. it tells you how much room it actually wanted, so considerate π«ΆLWORKβINTEGER. The length of the arrayWORK.LWORK >= max(1,M,N). For optimum performanceLWORK >= (M+N)*NB, whereNBis the optimal blocksize.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. the classic "just asking, not ordering" move π
INFOINFOβ it's anINTEGER, bestie, and it's the vibe check at the end:= 0: successful exit, we ate π< 0: ifINFO = -i, the i-th argument had an illegal value.
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π₯ Further Details: π₯
okay so the matrices Q and P are represented as products of elementary reflectors, and this is the part where you gotta lock in:
If m >= n,
Q = H(1) H(2) . . . H(n) and P = G(1) G(2) . . . G(n-1)
Each H(i) and G(i) has the 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;
v(1:i-1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i);
u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n);
tauq is stored in TAUQ(i) and taup in TAUP(i).
If m < n,
Q = H(1) H(2) . . . H(m-1) and P = G(1) G(2) . . . G(m)
Each H(i) and G(i) has the 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;
v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i);
u(1:i-1) = 0, u(i) = 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).
The contents of A on exit are illustrated by the following examples:
m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n):
( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 )
( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 )
( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 )
( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 )
( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 )
( v1 v2 v3 v4 v5 )
where d and e denote diagonal and off-diagonal elements of B, vi denotes an element of the vector defining H(i), and ui an element of the vector defining G(i).
πΈ subroutine dgecon πΈ
subroutine dgecon (character NORM, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision ANORM, double precision RCOND, double precision, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
DGECON β say hi to the condition-number girlie π
β¨ Purpose β¨
DGECON estimates the reciprocal of the condition number of a general real matrix A, in either the 1-norm or the infinity-norm, using the LU factorization computed by DGETRF.
An estimate is obtained for norm(inv(A)), and the reciprocal of the condition number is computed as
RCOND = 1 / ( norm(A) * norm(inv(A)) ).
π«Ά Parameters π«Ά
NORMβNORMisCHARACTER*1. It specifies whether the 1-norm condition number or the infinity-norm condition number is required:= '1'or'O': 1-norm;= 'I': Infinity-norm.
NβNisINTEGER. The order of the matrix A.N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). The factors L and U from the factorizationA = P*L*Uas computed byDGETRF.LDAβLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,N).ANORMβANORMisDOUBLE PRECISION. IfNORM = '1'or'O', the 1-norm of the original matrix A. IfNORM = 'I', the infinity-norm of the original matrix A.RCONDβRCONDisDOUBLE PRECISION. The reciprocal of the condition number of the matrix A, computed asRCOND = 1/(norm(A) * norm(inv(A))).WORKβWORKisDOUBLE PRECISIONarray, dimension(4*N).IWORKβIWORKisINTEGERarray, dimension(N).INFOβINFOisINTEGER:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π¦ subroutine dgeequ π¦
subroutine dgeequ (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) R, double precision, dimension( * ) C, double precision ROWCND, double precision COLCND, double precision AMAX, integer INFO)
DGEEQU β the equilibration era π«
β¨ Purpose β¨
DGEEQU computes row and column scalings intended to equilibrate an M-by-N matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
R(i) and C(j) are restricted to be between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice.
π«Ά Parameters π«Ά
MβMisINTEGER. The number of rows of the matrix A.M >= 0.NβNisINTEGER. The number of columns of the matrix A.N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). The M-by-N matrix whose equilibration factors are to be computed.LDAβLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).RβRisDOUBLE PRECISIONarray, dimension(M). IfINFO = 0orINFO > M, R contains the row scale factors for A.CβCisDOUBLE PRECISIONarray, dimension(N). IfINFO = 0, C contains the column scale factors for A.ROWCNDβROWCNDisDOUBLE PRECISION. IfINFO = 0orINFO > M, ROWCND contains the ratio of the smallestR(i)to the largestR(i). IfROWCND >= 0.1and AMAX is neither too large nor too small, it is not worth scaling by R.COLCNDβCOLCNDisDOUBLE PRECISION. IfINFO = 0, COLCND contains the ratio of the smallestC(i)to the largestC(i). IfCOLCND >= 0.1, it is not worth scaling by C.AMAXβAMAXisDOUBLE PRECISION. Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled.INFOβINFOisINTEGER:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i, and i is<= M: the i-th row of A is exactly zero> M: the (i-M)-th column of A is exactly zero
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π subroutine dgeequb π
subroutine dgeequb (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) R, double precision, dimension( * ) C, double precision ROWCND, double precision COLCND, double precision AMAX, integer INFO)
DGEEQUB β same energy as DGEEQU but make it radix-powered β‘
β¨ Purpose β¨
DGEEQUB computes row and column scalings intended to equilibrate an M-by-N matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most the radix.
R(i) and C(j) are restricted to be a power of the radix between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice.
This routine differs from DGEEQU by restricting the scaling factors to a power of the radix. Barring over- and underflow, scaling by these factors introduces no additional rounding errors. However, the scaled entries' magnitudes are no longer approximately 1 but lie between sqrt(radix) and 1/sqrt(radix).
π«Ά Parameters π«Ά
MβMisINTEGER. The number of rows of the matrix A.M >= 0.NβNisINTEGER. The number of columns of the matrix A.N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). The M-by-N matrix whose equilibration factors are to be computed.LDAβLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).RβRisDOUBLE PRECISIONarray, dimension(M). IfINFO = 0orINFO > M, R contains the row scale factors for A.CβCisDOUBLE PRECISIONarray, dimension(N). IfINFO = 0, C contains the column scale factors for A.ROWCNDβROWCNDisDOUBLE PRECISION. IfINFO = 0orINFO > M, ROWCND contains the ratio of the smallestR(i)to the largestR(i). IfROWCND >= 0.1and AMAX is neither too large nor too small, it is not worth scaling by R.COLCNDβCOLCNDisDOUBLE PRECISION. IfINFO = 0, COLCND contains the ratio of the smallestC(i)to the largestC(i). IfCOLCND >= 0.1, it is not worth scaling by C.AMAXβAMAXisDOUBLE PRECISION. Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled.INFOβINFOisINTEGER:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i, and i is<= M: the i-th row of A is exactly zero> M: the (i-M)-th column of A is exactly zero
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π subroutine dgehd2 π
subroutine dgehd2 (integer N, integer ILO, integer IHI, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
DGEHD2 reduces a general square matrix to upper Hessenberg form using an unblocked algorithm.
β¨ Purpose β¨
so, DGEHD2 is out here doing the absolute most: it takes a real general matrix A and reduces it to upper Hessenberg form H via an orthogonal similarity transformation, and the whole glow-up is literally:
Q**T * A * Q = H
iconic behavior, no notes. π
π Parameters (yes, all of them, bestie) π
NβNis INTEGER. It's the order of the matrixA, and she must beN >= 0. that's it, that's the vibe check.ILOβILOis INTEGER. that's the whole description fr.IHIβIHIis INTEGER. okay so the deal is: we're assumingAis already upper triangular in rows and columns1:ILO-1andIHI+1:N.ILOandIHIare normally handed to you by a previous call toDGEBALβ if you're not coming from there, just set them to1andNrespectively. See Further Details for the tea. And the constraint is1 <= ILO <= IHI <= max(1,N). πAβAis DOUBLE PRECISION array, dimension(LDA,N). On entry, it's the n by n general matrix that's about to get reduced. On exit, the upper triangle and the first subdiagonal ofAget overwritten with the upper Hessenberg matrixH, and the elements below the first subdiagonal β together with the arrayTAUβ represent the orthogonal matrixQas a product of elementary reflectors. See Further Details. she's a multitasker. β¨LDAβLDAis INTEGER. It's the leading dimension of the arrayA, andLDA >= max(1,N). no exceptions bestie.TAUβTAUis DOUBLE PRECISION array, dimension(N-1). The scalar factors of the elementary reflectors (again: see Further Details π«Ά).WORKβWORKis DOUBLE PRECISION array, dimension(N).INFOβINFOis INTEGER.= 0: successful exit, slay.< 0: ifINFO = -i, then the i-th argument had an illegal value. not her fault, it's your input. π
π 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 (ihi-ilo) elementary reflectors:
Q = H(ilo) H(ilo+1) . . . H(ihi-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(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on exit in A(i+2:ihi,i), and tau in TAU(i).
The contents of A are illustrated by the following example, with n = 7, ilo = 2 and ihi = 6:
on entry, on exit,
( a a a a a a a ) ( a a h h h h a )
( a a a a a a ) ( a h h h h a )
( a a a a a a ) ( h h h h h h )
( a a a a a a ) ( v2 h h h h h )
( a a a a a a ) ( v2 v3 h h h h )
( a a a a a a ) ( v2 v3 v4 h h h )
( 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).
okay next up, the glowed-up blocked version of the same energy. enter:
subroutine dgehrd (integer N, integer ILO, integer IHI, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEHRD π
Purpose:
DGEHRD reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H. same transformation, bigger budget, better performance. main character energy fr fr. π₯
Parameters:
NβNis INTEGER. The order of the matrixA.N >= 0.ILOβILOis INTEGER.IHIβIHIis INTEGER. It is assumed thatAis already upper triangular in rows and columns1:ILO-1andIHI+1:N.ILOandIHIare normally set by a previous call toDGEBAL; otherwise they should be set to1andNrespectively. See Further Details. And the rules are1 <= ILO <= IHI <= N, ifN > 0;ILO=1andIHI=0, ifN=0. yes, thatIHI=0case is real, don't come for me. π¦AβAis DOUBLE PRECISION array, dimension(LDA,N). On entry, the N-by-N general matrix to be reduced. On exit, the upper triangle and the first subdiagonal ofAare overwritten with the upper Hessenberg matrixH, and the elements below the first subdiagonal, with the arrayTAU, represent the orthogonal matrixQas a product of elementary reflectors. See Further Details.LDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).TAUβTAUis DOUBLE PRECISION array, dimension(N-1). The scalar factors of the elementary reflectors (see Further Details). Elements1:ILO-1andIHI:N-1ofTAUare set to zero. π«ΆWORKβWORKis DOUBLE PRECISION array, dimension(LWORK). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. she tells you what she wants.LWORKβLWORKis INTEGER. The length of the arrayWORK.LWORK >= max(1,N). For good performance,LWORKshould generally be larger. and ifLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. sneaky but iconic. β¨INFOβINFOis INTEGER.= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value. π
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
The matrix Q is represented as a product of (ihi-ilo) elementary reflectors:
Q = H(ilo) H(ilo+1) . . . H(ihi-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(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on exit in A(i+2:ihi,i), and tau in TAU(i).
The contents of A are illustrated by the following example, with n = 7, ilo = 2 and ihi = 6:
on entry, on exit,
( a a a a a a a ) ( a a h h h h a )
( a a a a a a ) ( a h h h h a )
( a a a a a a ) ( h h h h h h )
( a a a a a a ) ( v2 h h h h h )
( a a a a a a ) ( v2 v3 h h h h )
( a a a a a a ) ( v2 v3 v4 h h h )
( 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).
lowkey important lore: this file is a slight modification of LAPACK-3.0'sDGEHRDsubroutine incorporating improvements proposed by Quintana-Orti and Van de Geijn (2006). (SeeDLAHR2.) π
subroutine dgelq2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
DGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm. no blocking, just vibes and precision. π
Purpose:
DGELQ2 computes an LQ factorization of a real m-by-n matrix A:
A = ( L 0 ) * Q
where:
Qis a n-by-n orthogonal matrix;Lis a lower-triangular m-by-m matrix;0is a m-by-(n-m) zero matrix, ifm < n.
Parameters:
MβMis INTEGER. The number of rows of the matrixA.M >= 0.NβNis INTEGER. The number of columns of the matrixA.N >= 0.AβAis DOUBLE PRECISION array, dimension(LDA,N). On entry, the m by n matrixA. On exit, the elements on and below the diagonal of the array contain the m bymin(m,n)lower trapezoidal matrixL(Lis lower triangular ifm <= n); the elements above the diagonal, with the arrayTAU, represent the orthogonal matrixQas a product of elementary reflectors (see Further Details). πLDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβTAUis DOUBLE PRECISION array, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβWORKis DOUBLE PRECISION array, dimension(M).INFOβINFOis INTEGER.= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value. π
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
The matrix Q is represented as a product of elementary reflectors:
Q = H(k) . . . H(2) H(1), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), and tau in TAU(i). πΈ
subroutine dgelqf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGELQF β same LQ factorization energy as above, but now she's blocked and ready to go big. π
Purpose:
DGELQF computes an LQ factorization of a real M-by-N matrix A:
A = ( L 0 ) * Q
where:
Qis a N-by-N orthogonal matrix;Lis a lower-triangular M-by-M matrix;0is a M-by-(N-M) zero matrix, ifM < N.
Parameters:
MβMis INTEGER. The number of rows of the matrixA.M >= 0.NβNis INTEGER. The number of columns of the matrixA.N >= 0.AβAis DOUBLE PRECISION array, dimension(LDA,N). On entry, the M-by-N matrixA. On exit, the elements on and below the diagonal of the array contain the m-by-min(m,n)lower trapezoidal matrixL(Lis lower triangular ifm <= n); the elements above the diagonal, with the arrayTAU, represent the orthogonal matrixQas a product of elementary reflectors (see Further Details). β¨LDAβLDAis INTEGER.LDAβ anINTEGER, bestie. It's the leading dimension of the arrayA, and you needLDA >= max(1,M). that's the whole vibe. πTAUβDOUBLE PRECISIONarray, dimension(min(M,N)). These are the scalar factors of the elementary reflectors (peep Further Details below for the tea β).WORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0, thenWORK(1)hands you back the optimalLWORK. it's giving helpful fr π«ΆLWORKβ anINTEGER, the dimension of the arrayWORK.LWORK >= max(1,M). For optimum performance you wantLWORK >= M*NB, whereNBis the optimal blocksize.
ifLWORK = -1, then a workspace query is assumed β the routine ONLY calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. no cap. β¨
INFOβ anINTEGER, your little status report:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: π₯
The matrix Q is represented as a product of elementary reflectors
Q = H(k) . . . H(2) H(1), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), and tau in TAU(i).
β¨ subroutine dgelqt β¨
subroutine dgelqt (integer M, integer N, integer MB, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( ldt, *
) T, integer LDT, double precision, dimension( * ) WORK, integer INFO)
DGELQT π¦
Purpose:
DGELQT computes a blocked LQ factorization of a real M-by-N matrix A using the compact WY representation of Q. periodt. π
Parameters
Mβ anINTEGER. The number of rows of the matrixA.M >= 0.Nβ anINTEGER. The number of columns of the matrixA.N >= 0.MBβ anINTEGER. The block size to be used in the blocked QR.MIN(M,N) >= MB >= 1. (yes it says QR, we said what we said, moving on π)AβDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrixA. On exit, the elements on and below the diagonal of the array contain the M-by-MIN(M,N) lower trapezoidal matrixL(Lis lower triangular ifM <= N); the elements above the diagonal are the rows ofV. iconic behavior honestly πLDAβ anINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TβDOUBLE PRECISIONarray, dimension(LDT,MIN(M,N)). The upper triangular block reflectors stored in compact form as a sequence of upper triangular blocks. See below for further details. πLDTβ anINTEGER. The leading dimension of the arrayT.LDT >= MB.WORKβDOUBLE PRECISIONarray, dimension(MB*N).INFOβ anINTEGER, the vibes check:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: β
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A.
Let K=MIN(M,N). The number of blocks is B = ceiling(K/MB), where each block is of order MB except for the last block, which is of order IB = K - (B-1)*MB. For each of the B blocks, a upper triangular block reflector factor is computed: T1, T2, ..., TB. The MB-by-MB (and IB-by-IB for the last block) T's are stored in the MB-by-K matrix T as
T = (T1 T2 ... TB).
β¨ recursive subroutine dgelqt3 β¨
recursive subroutine dgelqt3 (integer M, integer N, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( ldt, *
) T, integer LDT, integer INFO)
DGELQT3 recursively computes a LQ factorization of a general real or complex matrix using the compact WY representation of Q. it's recursive bestie, it goes deep π§
Purpose:
DGELQT3 recursively computes a LQ factorization of a real M-by-N matrix A, using the compact WY representation of Q.
Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000. π
Parameters
Mβ anINTEGER. The number of rows of the matrixA.M =< N.Nβ anINTEGER. The number of columns of the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the real M-by-N matrixA. On exit, the elements on and below the diagonal contain the N-by-N lower triangular matrixL; the elements above the diagonal are the rows ofV. See below for further details. πLDAβ anINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TβDOUBLE PRECISIONarray, dimension(LDT,N). The N-by-N upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflectorT; the elements below the diagonal are not used. See below for further details. π«ΆLDTβ anINTEGER. The leading dimension of the arrayT.LDT >= max(1,N).INFOβ anINTEGER:= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π
Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: π
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A.
The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
For details of the algorithm, see Elmroth and Gustavson (cited above). π
β¨ subroutine dgemlqt β¨
subroutine dgemlqt (character SIDE, character TRANS, integer M, integer N,
integer K, integer MB, double precision, dimension( ldv, * ) V, integer
LDV, double precision, dimension( ldt, * ) T, integer LDT, double
precision, dimension( ldc, * ) C, integer LDC, double precision,
dimension( * ) WORK, integer INFO)
DGEMLQT π¦
Purpose:
DGEMLQT overwrites the general real M-by-N matrix C with
SIDE = 'L' SIDE = 'R'
TRANS = 'N': Q C C Q
TRANS = 'T': Q**T C C Q**T
where Q is a real orthogonal matrix defined as the product of K elementary reflectors:
Q = H(1) H(2) . . . H(K) = I - V T V**T
generated using the compact WY representation as returned by DGELQT.
Q is of order M if SIDE = 'L' and of order N if SIDE = 'R'. β¨
Parameters
SIDEβCHARACTER*1:= 'L': applyQorQ**Tfrom the Left;= 'R': applyQorQ**Tfrom the Right.
TRANSβCHARACTER*1:= 'N': No transpose, applyQ;= 'C': Transpose, applyQ**T.
Mβ anINTEGER. The number of rows of the matrixC.M >= 0.Nβ anINTEGER. The number of columns of the matrixC.N >= 0.Kβ anINTEGER. The number of elementary reflectors whose product defines the matrixQ. IfSIDE = 'L',M >= K >= 0; ifSIDE = 'R',N >= K >= 0.MBβ anINTEGER. The block size used for the storage ofT.K >= MB >= 1. This must be the same value ofMBused to generateTinDGELQT. β οΈ do not mix these up bestie.VβDOUBLE PRECISIONarray, dimension
(LDV,M) if SIDE = 'L',
(LDV,N) if SIDE = 'R'
The i-th row must contain the vector which defines the elementary reflector H(i), for i = 1,2,...,k, as returned by DGELQT in the first K rows of its array argument A.
LDVβ anINTEGER. The leading dimension of the arrayV.LDV >= max(1,K).TβDOUBLE PRECISIONarray, dimension(LDT,K). The upper triangular factors of the block reflectors as returned byDGELQT, stored as a MB-by-K matrix. πLDTβ anINTEGER. The leading dimension of the arrayT.LDT >= MB.CβDOUBLE PRECISIONarray, dimension(LDC,N). On entry, the M-by-N matrixC. On exit,Cis overwritten byQ C,Q**T C,C Q**TorC Q. π₯LDCβ anINTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORKβDOUBLE PRECISIONarray. The dimension ofWORKisN*MBifSIDE = 'L', orM*MBifSIDE = 'R'.INFOβ anINTEGER:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
β¨ subroutine dgemqrt β¨
subroutine dgemqrt (character SIDE, character TRANS, integer M, integer N,
integer K, integer NB, double precision, dimension( ldv, * ) V, integer
LDV, double precision, dimension( ldt, * ) T, integer LDT, double
precision, dimension( ldc, * ) C, integer LDC, double precision,
dimension( * ) WORK, integer INFO)
DGEMQRT π¦
...and bestie, this one's not done yet β hold that thought, there's more coming π
Purpose β¨
Okay bestie, real talk β DGEMQRT takes your general real M-by-N matrix C and just... overwrites it. Rude? Maybe. Iconic? Absolutely. Here's the vibe:
SIDE = 'L' SIDE = 'R'
TRANS = 'N': Q C C Q
TRANS = 'T': Q**T C C Q**T
where Q is a real orthogonal matrix, and it's built as the product of K elementary reflectors:
Q = H(1) H(2) . . . H(K) = I - V T V**T
generated using the compact WY representation as returned by DGEQRT. No cap, that's the whole flex.
And Q is of order M if SIDE = 'L', and of order N if SIDE = 'R'. Slay. π
Parameters π
SIDEβ it's aCHARACTER*1, and it's giving direction:= 'L': applyQorQ**Tfrom the Left;= 'R': applyQorQ**Tfrom the Right.
TRANSβ alsoCHARACTER*1, the glow-up question:= 'N': No transpose, applyQ;= 'C': Transpose, applyQ**T.
MβINTEGER. The number of rows of the matrixC.M >= 0.NβINTEGER. The number of columns of the matrixC.N >= 0.KβINTEGER. The number of elementary reflectors whose product defines the matrixQ.- If
SIDE = 'L',M >= K >= 0; - if
SIDE = 'R',N >= K >= 0.
- If
NBβINTEGER. The block size used for the storage ofT.K >= NB >= 1.
Heads up bestie: this must be the same value ofNBused to generateTinDGEQRT. Matching fits only, okay? π«Ά
VβDOUBLE PRECISIONarray, dimension(LDV,K). The i-th column must contain the vector which defines the elementary reflectorH(i), fori = 1,2,...,k, as returned byDGEQRTin the firstKcolumns of its array argumentA.LDVβINTEGER. The leading dimension of the arrayV.- If
SIDE = 'L',LDA >= max(1,M); - if
SIDE = 'R',LDA >= max(1,N).
- If
TβDOUBLE PRECISIONarray, dimension(LDT,K). The upper triangular factors of the block reflectors as returned byDGEQRT, stored as aNB-by-Nmatrix.LDTβINTEGER. The leading dimension of the arrayT.LDT >= NB.CβDOUBLE PRECISIONarray, dimension(LDC,N).- On entry, the M-by-N matrix
C. - On exit,
Cis overwritten byQ C,Q**T C,C Q**TorC Q. (told you it gets overwritten, she does not ask permission π)
- On entry, the M-by-N matrix
LDCβINTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORKβDOUBLE PRECISIONarray. The dimension ofWORKisN*NBifSIDE = 'L', orM*NBifSIDE = 'R'.INFOβINTEGER, the receipts:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ subroutine dgeql2 π¦
subroutine dgeql2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
DGEQL2 computes the QL factorization of a general rectangular matrix using an unblocked algorithm.
Purpose β¨
DGEQL2 computes a QL factorization of a real m by n matrix A:
A = Q * L.
Parameters π
MβINTEGER. The number of rows of the matrixA.M >= 0.NβINTEGER. The number of columns of the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N).- On entry, the m by n matrix
A. - On exit, if
m >= n, the lower triangle of the subarrayA(m-n+1:m,1:n)contains the n by n lower triangular matrixL; - if
m <= n, the elements on and below the (n-m)-th superdiagonal contain the m by n lower trapezoidal matrixL; - the remaining elements, with the array
TAU, represent the orthogonal matrixQas a product of elementary reflectors (see Further Details).
- On entry, the m by n matrix
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβDOUBLE PRECISIONarray, dimension(N).INFOβINTEGER:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details π¦
The matrix Q is represented as a product of elementary reflectors
Q = H(k) . . . H(2) H(1), where k = min(m,n).
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(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in A(1:m-k+i-1,n-k+i), and tau in TAU(i).
π subroutine dgeqlf π
subroutine dgeqlf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEQLF
Purpose β¨
DGEQLF computes a QL factorization of a real M-by-N matrix A:
A = Q * L.
Parameters π
MβINTEGER. The number of rows of the matrixA.M >= 0.NβINTEGER. The number of columns of the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N).- On entry, the M-by-N matrix
A. - On exit,
- if
m >= n, the lower triangle of the subarrayA(m-n+1:m,1:n)contains the N-by-N lower triangular matrixL; - if
m <= n, the elements on and below the (n-m)-th superdiagonal contain the M-by-N lower trapezoidal matrixL; - the remaining elements, with the array
TAU, represent the orthogonal matrixQas a product of elementary reflectors (see Further Details).
- if
- On entry, the M-by-N matrix
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N). For optimum performanceLWORK >= N*NB, whereNBis the optimal blocksize.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. (it's a lil peek, not a whole computation, bestie β¨)
INFOβINTEGER:= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details π¦
The matrix Q is represented as a product of elementary reflectors
Q = H(k) . . . H(2) H(1), where k = min(m,n).
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(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in A(1:m-k+i-1,n-k+i), and tau in TAU(i).
β subroutine dgeqp3 β
subroutine dgeqp3 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) JPVT, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEQP3
Purpose β¨
DGEQP3 computes a QR factorization with column pivoting of a matrix A:
A*P = Q*R using Level 3 BLAS.
Column pivoting AND Level 3 BLAS?? Main character energy fr fr. π
Parameters π
MβINTEGER. The number of rows of the matrixA.M >= 0.NβINTEGER. The number of columns of the matrixA.N >= 0.AβDOUBLE PRECISIONarray, dimension(LDA,N).- On entry, the M-by-N matrix
A. - On exit, the upper triangle of the array contains the
min(M,N)-by-N upper trapezoidal matrixR; the elements below the diagonal, together with the arrayTAU, represent the orthogonal matrixQas a product ofmin(M,N)elementary reflectors.
- On entry, the M-by-N matrix
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).JPVTβINTEGERarray, dimension(N).- On entry, if
JPVT(J).ne.0, the J-th column ofAis permuted to the front ofA*P(a leading column); ifJPVT(J)=0, the J-th column ofAis a free column. - On exit, if
JPVT(J)=K, then the J-th column ofA*Pwas the K-th column ofA.
- On entry, if
TAUβDOUBLE PRECISIONarray, dimension(min(M,N)). The scalar factors of the elementary reflectors.WORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK)). On exit, ifINFO=0,WORK(1)returns the optimalLWORK.LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= 3*N+1. For optimal performanceLWORK >= 2*N+( N+1 )*NB, whereNBis the optimal blocksize.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. (same lil peek energy, different routine π«Ά)
INFOβINTEGER:= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
...product of elementary reflectors, and bestie, that's literally the whole vibe:
Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) is giving:
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real/complex vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). no notes, just math. π
Contributors: β¨
- G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- X. Sun, Computer Science Dept., Duke University, USA
πΈ subroutine dgeqr2 πΈ
subroutine dgeqr2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
okay so DGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm. it's the chill, no-blocking, do-it-directly version and honestly? we respect her. π«Ά
Purpose
DGEQR2 computes a QR factorization of a real m-by-n matrix A:
A = Q * ( R ),
( 0 )
where:
Qis a m-by-m orthogonal matrix;Ris an upper-triangular n-by-n matrix;0is a (m-n)-by-n zero matrix, if m > n.
Parameters
MβMis INTEGER. The number of rows of the matrix A.M >= 0.NβNis INTEGER. The number of columns of the matrix A.N >= 0.AβAis DOUBLE PRECISION array, dimension (LDA,N). On entry, the m by n matrix A. On exit, the elements on and above the diagonal of the array contain the min(m,n) by n upper trapezoidal matrix R (R is upper triangular if m >= n); 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 >= max(1,M).TAUβTAUis DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβWORKis DOUBLE PRECISION array, dimension (N).INFOβINFOis INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
π¦ subroutine dgeqr2p π¦
subroutine dgeqr2p (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
DGEQR2P computes the QR factorization of a general rectangular matrix with non-negative diagonal elements using an unblocked algorithm. yes bestie, the P is for the nonnegativity glow-up. π
Purpose
DGEQR2P computes a QR factorization of a real m-by-n matrix A:
A = Q * ( R ),
( 0 )
where:
Qis a m-by-m orthogonal matrix;Ris an upper-triangular n-by-n matrix with nonnegative diagonal entries;0is a (m-n)-by-n zero matrix, if m > n.
Parameters
MβMis INTEGER. The number of rows of the matrix A.M >= 0.NβNis INTEGER. The number of columns of the matrix A.N >= 0.AβAis DOUBLE PRECISION array, dimension (LDA,N). On entry, the m by n matrix A. On exit, the elements on and above the diagonal of the array contain the min(m,n) by n upper trapezoidal matrix R (R is upper triangular if m >= n). The diagonal entries of R are nonnegative; 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 >= max(1,M).TAUβTAUis DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβWORKis DOUBLE PRECISION array, dimension (N).INFOβINFOis INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
π See Lapack Working Note 203 for details.
π subroutine dgeqrf π
subroutine dgeqrf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEQRF β the main character of QR factorizations. periodt. π
Purpose
DGEQRF computes a QR factorization of a real M-by-N matrix A:
A = Q * ( R ),
( 0 )
where:
Qis a M-by-M orthogonal matrix;Ris an upper-triangular N-by-N matrix;0is a (M-N)-by-N zero matrix, if M > N.
Parameters
MβMis INTEGER. The number of rows of the matrix A.M >= 0.NβNis INTEGER. The number of columns of the matrix A.N >= 0.AβAis DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).LDAβLDAis INTEGER. The leading dimension of the array A.LDA >= max(1,M).TAUβTAUis DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβWORKis DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimal LWORK. β¨LWORKβLWORKis INTEGER. The dimension of the array WORK.LWORK >= 1, ifMIN(M,N) = 0, andLWORK >= N, otherwise. For optimum performanceLWORK >= N*NB, whereNBis the optimal blocksize.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. (it's giving "don't @ me, I'm just peeking at the size" energy π«£)
INFOβINFOis INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
π subroutine dgeqrfp π
subroutine dgeqrfp (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGEQRFP β the non-negative-diagonal sibling, but make it blocked. slay. π
Purpose
DGEQR2P computes a QR factorization of a real M-by-N matrix A:
A = Q * ( R ),
( 0 )
where:
Qis a M-by-M orthogonal matrix;Ris an upper-triangular N-by-N matrix with nonnegative diagonal entries;0is a (M-N)-by-N zero matrix, if M > N.
Parameters
MβMis INTEGER. The number of rows of the matrix A.M >= 0.NβNis INTEGER. The number of columns of the matrix A.N >= 0.AβAis DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n). The diagonal entries of R are nonnegative; the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).LDAβLDAis INTEGER. The leading dimension of the array A.LDA >= max(1,M).TAUβTAUis DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβWORKis DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimal LWORK. β¨LWORKβLWORKis INTEGER. The dimension of the array WORK.LWORK >= max(1,N). For optimum performanceLWORK >= N*NB, whereNBis the optimal blocksize.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
INFOINFOβINFO is INTEGER, the little status report bestie= 0: successful exit π everything slayed< 0: ifINFO = -i, the i-th argument had an illegal value π (yes, it's counting which one, she's petty like that)
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 elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
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-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
See Lapack Working Note 203 for details
subroutine dgeqrt π
subroutine dgeqrt (integer M, integer N, integer NB, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( ldt, *
) T, integer LDT, double precision, dimension( * ) WORK, integer INFO)
DGEQRT β okay so this one is the moment, the main character β¨
Purpose: π
DGEQRT computes a blocked QR factorization of a real M-by-N matrix A using the compact WY representation of Q.
Parameters π¦
MβM is INTEGER. The number of rows of the matrix A.M >= 0.NβN is INTEGER. The number of columns of the matrix A.N >= 0.NBβNB is INTEGER. The block size to be used in the blocked QR.MIN(M,N) >= NB >= 1.AβA is DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular ifM >= N); the elements below the diagonal are the columns of V. πLDAβLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).TβT is DOUBLE PRECISION array, dimension (LDT,MIN(M,N)). The upper triangular block reflectors stored in compact form as a sequence of upper triangular blocks. See below for further details. πLDTβLDT is INTEGER. The leading dimension of the array T.LDT >= NB.WORKβWORK is DOUBLE PRECISION array, dimension (NB*N)INFOβINFO is INTEGER= 0: successful exit π₯³< 0: ifINFO = -i, the i-th argument had an illegal value π
Author βοΈ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: πΈ
The matrix V stores the elementary reflectors H(i) in the i-th column below the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 )
( v1 1 )
( v1 v2 1 )
( v1 v2 v3 )
( v1 v2 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A.
Let K=MIN(M,N). The number of blocks is B = ceiling(K/NB), where each block is of order NB except for the last block, which is of order IB = K - (B-1)*NB. For each of the B blocks, a upper triangular block reflector factor is computed: T1, T2, ..., TB. The NB-by-NB (and IB-by-IB for the last block) T's are stored in the NB-by-K matrix T as
T = (T1 T2 ... TB).
subroutine dgeqrt2 π
subroutine dgeqrt2 (integer M, integer N, double precision, dimension( lda,
* ) A, integer LDA, double precision, dimension( ldt, * ) T, integer
LDT, integer INFO)
DGEQRT2 computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
Purpose: π§
DGEQRT2 computes a QR factorization of a real M-by-N matrix A, using the compact WY representation of Q.
Parameters π
MβM is INTEGER. The number of rows of the matrix A.M >= N.NβN is INTEGER. The number of columns of the matrix A.N >= 0.AβA is DOUBLE PRECISION array, dimension (LDA,N). On entry, the real M-by-N matrix A. On exit, the elements on and above the diagonal contain the N-by-N upper triangular matrix R; the elements below the diagonal are the columns of V. See below for further details. β¨LDAβLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).TβT is DOUBLE PRECISION array, dimension (LDT,N). The N-by-N upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflector T; the elements below the diagonal are not used. See below for further details. πLDTβLDT is INTEGER. The leading dimension of the array T.LDT >= max(1,N).INFOβINFO is INTEGER= 0: successful exit π₯³< 0: ifINFO = -i, the i-th argument had an illegal value π
Author βοΈ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: π¦
The matrix V stores the elementary reflectors H(i) in the i-th column below the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 )
( v1 1 )
( v1 v2 1 )
( v1 v2 v3 )
( v1 v2 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
recursive subroutine dgeqrt3 π
recursive subroutine dgeqrt3 (integer M, integer N, double precision,
dimension( lda, * ) A, integer LDA, double precision, dimension( ldt, *
) T, integer LDT, integer INFO)
DGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
Purpose: β
DGEQRT3 recursively computes a QR factorization of a real M-by-N matrix A, using the compact WY representation of Q.
Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000.
Parameters π₯
MβM is INTEGER. The number of rows of the matrix A.M >= N.NβN is INTEGER. The number of columns of the matrix A.N >= 0.AβA is DOUBLE PRECISION array, dimension (LDA,N). On entry, the real M-by-N matrix A. On exit, the elements on and above the diagonal contain the N-by-N upper triangular matrix R; the elements below the diagonal are the columns of V. See below for further details. πLDAβLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).TβT is DOUBLE PRECISION array, dimension (LDT,N). The N-by-N upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflector T; the elements below the diagonal are not used. See below for further details. πLDTβLDT is INTEGER. The leading dimension of the array T.LDT >= max(1,N).INFOβINFO is INTEGER= 0: successful exit π₯³< 0: ifINFO = -i, the i-th argument had an illegal value π
Author βοΈ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: πΈ
The matrix V stores the elementary reflectors H(i) in the i-th column below the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 )
( v1 1 )
( v1 v2 1 )
( v1 v2 v3 )
( v1 v2 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
For details of the algorithm, see Elmroth and Gustavson (cited above).
subroutine dgerfs π«Ά
subroutine dgerfs (character TRANS, integer N, integer NRHS, double
precision, dimension( lda, * ) A, integer LDA, double precision,
dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV,
double precision, dimension( ldb, * ) B, integer LDB, double precision,
dimension( ldx, * ) X, integer LDX, double precision, dimension( * )
FERR, double precision, dimension( * ) BERR, double precision,
dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
DGERFS
Purpose: π
DGERFS improves the computed solution to a system of linear equations and provides error bounds and backward error estimates for the solution.
bestie this is the glow-up routine, it takes your kinda-okay answer and makes it cuter π
Parameters π
TRANSβTRANS is CHARACTER*1. Specifies the form of the system of equations:= 'N':A * X = B(No transpose)= 'T':A**T * X = B(Transpose)= 'C':A**H * X = B(Conjugate transpose = Transpose)
NβN is INTEGER. The order of the matrix A.N >= 0.NRHSβNRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X.NRHS >= 0.AβA is DOUBLE PRECISION array, dimension (LDA,N). The original N-by-N matrix A.LDAβLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,N).AFβAF is DOUBLE PRECISION array, dimension (LDAF,N). The factors L and U from the factorizationA = P*L*Uas computed byDGETRF.LDAFβLDAF is INTEGER. The leading dimension of the array AF.LDAF >= max(1,N).IPIVβIPIV is INTEGER array, dimension (N). The pivot indices fromDGETRF; for1<=i<=N, row i of the matrix was interchanged with rowIPIV(i).BBβ DOUBLE PRECISION array, dimension (LDB,NRHS). It's the right hand side matrix B, bestie. The whole "= " of your "Ax = B" moment. πLDBβ INTEGER. The leading dimension of the arrayB. Rule of the land:LDB >= max(1,N). Don't test her.Xβ DOUBLE PRECISION array, dimension (LDX,NRHS). On entry, this is your solution matrixX, exactly asDGETRShanded it to you. On exit? It's the improved solution matrixX. Glow up, literally. β¨LDXβ INTEGER. The leading dimension of the arrayX.LDX >= max(1,N), no cap.FERRβ DOUBLE PRECISION array, dimension (NRHS). The estimated forward error bound for each solution vectorX(j)(that's the j-th column of the solution matrixX, iykyk).
So if XTRUE is the true solution matching X(j), then FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j) - XTRUE) divided by the magnitude of the largest element in X(j). The estimate is exactly as reliable as the estimate for RCOND, and β real talk β it's almost always a slight overestimate of the true error. She's dramatic, she overshoots, we love her. π
BERRβ DOUBLE PRECISION array, dimension (NRHS). The componentwise relative backward error of each solution vectorX(j). Translation: the smallest relative change in any element ofAorBthat would makeX(j)an exact solution. Like, how much would reality have to shift for you to be right? π«ΆWORKβ DOUBLE PRECISION array, dimension (3*N). Scratch space. Do not perceive her.IWORKβ INTEGER array, dimension (N). Also scratch. Also do not perceive.INFOβ INTEGER. The vibe check at the end:= 0: successful exit. Slay. β< 0: ifINFO = -i, the i-th argument had an illegal value. Not slay. One of your inputs was giving chaos. π
Internal Parameters: π
ITMAXis the maximum number of steps of iterative refinement. She'll keep polishing the solution, but onlyITMAXtimes. Periodt.
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine dgerfsx π
subroutine dgerfsx (character TRANS, character EQUED, integer N, integer
NRHS, double precision, dimension( lda, * ) A, integer LDA, double
precision, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( *
) IPIV, double precision, dimension( * ) R, double precision, dimension(
* ) C, double precision, dimension( ldb, * ) B, integer LDB, double
precision, dimension( ldx , * ) X, integer LDX, double precision RCOND,
double precision, dimension( * ) BERR, integer N_ERR_BNDS, double
precision, dimension( nrhs, * ) ERR_BNDS_NORM, double precision,
dimension( nrhs, * ) ERR_BNDS_COMP, integer NPARAMS, double precision,
dimension( * ) PARAMS, double precision, dimension( * ) WORK, integer,
dimension( * ) IWORK, integer INFO)
DGERFSX
Purpose: π
DGERFSX improves the computed solution to a system of linear equations and provides error bounds and backward error estimates for the solution. In addition to the normwise error bound, the code provides a maximum componentwise error bound</p> if possible. Peep the comments for ERR_BNDS_NORM and ERR_BNDS_COMP for the deets on the error bounds. π
The original system of linear equations may have been equilibrated before calling this routine, as described by arguments EQUED, R and C below. In that case, the solution and error bounds returned are for the original unequilibrated system. So she's reporting on the before-times, not the glow-up. πΈ
Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. And if the defaults are acceptable? Users can pass NPARAMS = 0, which prevents the source code from accessing the PARAMS argument entirely. Efficient. Iconic. π
Parameters π
TRANSβ CHARACTER*1. Specifies the form of the system of equations:= 'N':A * X = B(No transpose)= 'T':A**T * X = B(Transpose)= 'C':A**H * X = B(Conjugate transpose = Transpose)
EQUEDβ CHARACTER*1. Specifies the form of equilibration that was done toAbefore calling this routine. This is needed to compute the solution and error bounds correctly. Like, you gotta tell her what was done toAor she's guessing, and guessing is not the vibe.= 'N': No equilibration= 'R': Row equilibration, i.e.,Ahas been premultiplied bydiag(R).= 'C': Column equilibration, i.e.,Ahas been postmultiplied bydiag(C).= 'B': Both row and column equilibration, i.e.,Ahas been replaced bydiag(R) * A * diag(C). The right hand sideBhas been changed accordingly.
Nβ INTEGER. The order of the matrixA.N >= 0.NRHSβ INTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.Aβ DOUBLE PRECISION array, dimension (LDA,N). The original N-by-N matrixA. The one from before the whole saga.LDAβ INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβ DOUBLE PRECISION array, dimension (LDAF,N). The factorsLandUfrom the factorizationA = P*L*U, as computed byDGETRF.LDAFβ INTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβ INTEGER array, dimension (N). The pivot indices fromDGETRF; for1<=i<=N, rowiof the matrix was interchanged with rowIPIV(i). The receipts of every swap. π§ΎRβ DOUBLE PRECISION array, dimension (N). The row scale factors forA. IfEQUED = 'R'or'B',Ais multiplied on the left bydiag(R); ifEQUED = 'N'or'C',Ris not accessed.
IfRis accessed, each element ofRshould be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable. Bestie, heed this one. π
Cβ DOUBLE PRECISION array, dimension (N). The column scale factors forA. IfEQUED = 'C'or'B',Ais multiplied on the right bydiag(C); ifEQUED = 'N'or'R',Cis not accessed.
IfCis accessed, each element ofCshould be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable. Same warning, same energy, she is not playing. π
Bβ DOUBLE PRECISION array, dimension (LDB,NRHS). The right hand side matrixB.LDBβ INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).Xβ DOUBLE PRECISION array, dimension (LDX,NRHS). On entry, the solution matrixX, as computed byDGETRS. On exit, the improved solution matrixX. Same girl, better version. πLDXβ INTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDβ DOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrixAafter equilibration (if done). If this is less than the machine precision β in particular, if it is zero β the matrix is singular to working precision.
Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. So don't spiral if RCOND looks scary, okay? She said what she said. π«Ά
BERRβ DOUBLE PRECISION array, dimension (NRHS). Componentwise relative backward error. This is the componentwise relative backward error of each solution vectorX(j), i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution.N_ERR_BNDSβ INTEGER. Number of error bounds to return for each right hand side and each type (normwise or componentwise). SeeERR_BNDS_NORMandERR_BNDS_COMPbelow. Spoiler alert: they're coming. πERR_BNDS_NORMβ DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows:
Normwise relative error in the ith solution vector:
max_j (abs(XTRUE(j,i) - X(j,i)))
------------------------------
max_j abs(X(j,i))
The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned.
The first index in ERR_BNDS_NORM(i,:) corresponds to the ith right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains the following three fields:
err = 1β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon'). Literally a vibe check boolean, no cap. β /βerr = 2β 'Guaranteed' error bound: The estimated forward error, almost certainly within a factor of10of the true error, so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. So like, read the boolean first. Please. πerr = 3β Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*A, whereSscales each row by a power of the radix so all absolute row sums ofZare approximately1.
See Lapack Working Note 165 for further details and extra cautions. π
ERR_BNDS_COMPβERR_BNDS_COMPisDOUBLE PRECISION array, dimension(NRHS, N_ERR_BNDS). For every right-hand side, this array is carrying all the tea about various error bounds and condition numbers for the componentwise relative error, which is defined like this:
Componentwise relative error in the ith solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array is indexed by the right-hand side i (because the componentwise relative error depends on which right-hand side you're on, bestie), and then by the type of error info, which we're about to spill. Right now there are up to three pieces of info returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP is not accessed at all. And if N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries get returned.
The first index in ERR_BNDS_COMP(i,:) corresponds to the ith right-hand side. π
The second index in ERR_BNDS_COMP(:,err) contains these three fields:
err = 1β the 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β the 'Guaranteed' error bound: the estimated forward error, almost certainly within a factor of 10 of the true error, so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3β Reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side andSscales each row ofA*diag(x)by a power of the radix so all absolute row sums ofZare approximately 1.
See Lapack Working Note 165 for further details and extra cautions. π
NPARAMSβ isINTEGER. Specifies the number of parameters set inPARAMS. If<= 0, thePARAMSarray is never referenced and default values are used.PARAMSβ isDOUBLE PRECISION array, dimension(NPARAMS). Specifies algorithm parameters. If an entry is< 0.0, then that entry will be filled with the default value used for that parameter. Only positions up toNPARAMSare accessed; defaults are used for higher-numbered parameters.PARAMS(LA_LINRX_ITREF_I = 1)β Whether to perform iterative refinement or not. Default:1.0D+0= 0.0: No refinement is performed, and no error bounds are computed.= 1.0: Use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not supportDOUBLE PRECISION.- (other values are reserved for future use)
PARAMS(LA_LINRX_ITHRESH_I = 2)β Maximum number of residual computations allowed for refinement. Default:10Aggressive: Set to100to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy. β οΈPARAMS(LA_LINRX_CWISE_I = 3)β Flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false. Default:1.0(attempt componentwise convergence)
WORKβ isDOUBLE PRECISION array, dimension(4*N).IWORKβ isINTEGER array, dimension(N).INFOβ isINTEGER= 0: Successful exit. The solution to every right-hand side is guaranteed.< 0: IfINFO = -i, thei-th argument had an illegal value.> 0and<= N:U(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+J: The solution corresponding to theJth right-hand side is not guaranteed. The solutions corresponding to other right-hand sidesKwithK > Jmay not be guaranteed as well, but only the first such right-hand side is reported. If a small componentwise error is not requested (PARAMS(3) = 0.0) then theJth right-hand side is the first with a normwise error bound that is not guaranteed (the smallestJsuch thatERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) theJth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallestJsuch that eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides checkERR_BNDS_NORMorERR_BNDS_COMP.
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ subroutine dgerq2
subroutine dgerq2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer INFO)
DGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm. It's giving efficient, no cap.
β¨ Purpose
DGERQ2 computes an RQ factorization of a real m by n matrix A:
A = R * Q.
π Parameters
Mβ isINTEGER. The number of rows of the matrixA.M >= 0.Nβ isINTEGER. The number of columns of the matrixA.N >= 0.Aβ isDOUBLE PRECISION array, dimension(LDA,N). On entry, thembynmatrixA. On exit, ifm <= n, the upper triangle of the subarrayA(1:m,n-m+1:n)contains thembymupper triangular matrixR; ifm >= n, the elements on and above the(m-n)-th subdiagonal contain thembynupper trapezoidal matrixR; the remaining elements, with the arrayTAU, represent the orthogonal matrixQas a product of elementary reflectors (see Further Details).LDAβ isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβ isDOUBLE PRECISION array, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβ isDOUBLE PRECISION array, dimension(M).INFOβ isINTEGER= 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π Further Details
The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(m,n).
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(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in
A(m-k+i,1:n-k+i-1), and tau in TAU(i).
π subroutine dgerqf
subroutine dgerqf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGERQF β say hi to the blocked queen of RQ factorizations. π«Ά
β¨ Purpose
DGERQF computes an RQ factorization of a real M-by-N matrix A:
A = R * Q.
π Parameters
Mβ isINTEGER. The number of rows of the matrixA.M >= 0.Nβ isINTEGER. The number of columns of the matrixA.N >= 0.Aβ isDOUBLE PRECISION array, dimension(LDA,N). On entry, theM-by-NmatrixA. On exit, ifm <= n, the upper triangle of the subarrayA(1:m,n-m+1:n)contains theM-by-Mupper triangular matrixR; ifm >= n, the elements on and above the(m-n)-th subdiagonal contain theM-by-Nupper trapezoidal matrixR; the remaining elements, with the arrayTAU, represent the orthogonal matrixQas a product ofmin(m,n)elementary reflectors (see Further Details).LDAβ isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβ isDOUBLE PRECISION array, dimension(min(M,N)). The scalar factors of the elementary reflectors (see Further Details).WORKβ isDOUBLE PRECISION array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. β¨LWORKβ isINTEGER. The dimension of the arrayWORK.LWORK >= 1, ifMIN(M,N) = 0, andLWORK >= M, otherwise. For optimum performanceLWORK >= M*NB, whereNBis the optimal blocksize.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. π₯
INFOβINFOisINTEGER= 0: bestie it worked, successful exit π< 0: ifINFO = -i, then the i-th argument was out here committing crimes (had an illegal value) π
Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the academic Avengers fr fr, they literally wrote the book on this π«Ά
Further Details:
okay so the matrix Q is represented as a product of elementary reflectors β¨
Q = H(1) H(2) . . . H(k), where k = min(m,n).
and each H(i) has the form, no cap:
H(i) = I - tau * v * v**T
where tau is a real scalar, and v is a real vector with v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i). slay π
subroutine dgesvj π
subroutine dgesvj (character*1 JOBA, character*1 JOBU, character*1 JOBV,
integer M, integer N, double precision, dimension( lda, * ) A, integer
LDA, double precision, dimension( n ) SVA, integer MV, double precision,
dimension( ldv, * ) V, integer LDV, double precision, dimension( lwork )
WORK, integer LWORK, integer INFO)
DGESVJ β okay this one is the β¨main characterβ¨ of the whole SVD situation, let's go π¦
Purpose:
DGESVJ computes the singular value decomposition (SVD) of a real M-by-N matrix A, where M >= N. The SVD of A is written as
[++] [xx] [x0] [xx]
A = U * SIGMA * V^t, [++] = [xx] * [ox] * [xx]
[++] [xx]
where SIGMA is an N-by-N diagonal matrix, U is an M-by-N orthonormal matrix, and V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA are the singular values of A. The columns of U and V are the left and the right singular vectors of A, respectively. π
DGESVJ can sometimes compute tiny singular values and their singular vectors much more accurately than other SVD routines, see below under Further Details. lowkey iconic behaviour tbh π₯
Parameters
JOBAβJOBAisCHARACTER*1. It specifies the structure ofA:= 'L': the input matrixAis lower triangular;= 'U': the input matrixAis upper triangular;= 'G': the input matrixAis general M-by-N matrix,M >= N.
JOBUβJOBUisCHARACTER*1. It specifies whether to compute the left singular vectors (columns ofU):= 'U': the left singular vectors corresponding to the nonzero singular values are computed and returned in the leading columns ofA. See more details in the description ofA. The default numerical orthogonality threshold is set to approximatelyTOL=CTOL*EPS,CTOL=DSQRT(M),EPS=DLAMCH('E').= 'C': analogous toJOBU='U', except that user can control the level of numerical orthogonality of the computed left singular vectors.TOLcan be set toTOL = CTOL*EPS, whereCTOLis given on input in the arrayWORK. NoCTOLsmaller thanONEis allowed.CTOLgreater than1 / EPSis meaningless. The option'C'can be used ifM*EPSis satisfactory orthogonality of the computed left singular vectors, soCTOL=Mcould save few sweeps of Jacobi rotations. See the descriptions ofAandWORK(1).= 'N': the matrixUis not computed. However, see the description ofA.
JOBVβJOBVisCHARACTER*1. It specifies whether to compute the right singular vectors, that is, the matrixV:= 'V': the matrixVis computed and returned in the arrayV= 'A': the Jacobi rotations are applied to the MV-by-N arrayV. In other words, the right singular vector matrixVis not computed explicitly, instead it is applied to an MV-by-N matrix initially stored in the first MV rows ofV.= 'N': the matrixVis not computed and the arrayVis not referenced π
MβMisINTEGER. The number of rows of the input matrixA.1/DLAMCH('E') > M >= 0.NβNisINTEGER. The number of columns of the input matrixA.M >= N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrixA.
On exit:
If JOBU = 'U' .OR. JOBU = 'C':
- If
INFO = 0:RANKAorthonormal columns ofUare returned in the leadingRANKAcolumns of the arrayA. HereRANKA <= Nis the number of computed singular values ofAthat are above the underflow thresholdDLAMCH('S'). The singular vectors corresponding to underflowed or zero singular values are not computed. The value ofRANKAis returned in the arrayWORKasRANKA=NINT(WORK(2)). Also see the descriptions ofSVAandWORK. The computed columns ofUare mutually numerically orthogonal up to approximatelyTOL=DSQRT(M)*EPS(default); orTOL=CTOL*EPS(JOBU = 'C'), see the description ofJOBU. - If
INFO > 0: the procedureDGESVJdid not converge in the given number of iterations (sweeps). In that case, the computed columns ofUmay not be orthogonal up toTOL. The outputU(stored inA),SIGMA(given by the computed singular values inSVA(1:N)) andVis still a decomposition of the input matrixAin the sense that the residual||A-SCALE*U*SIGMA*V^T||_2 / ||A||_2is small.
If JOBU = 'N':
- If
INFO = 0: note that the left singular vectors are 'for free' in the one-sided Jacobi SVD algorithm. However, if only the singular values are needed, the level of numerical orthogonality ofUis not an issue and iterations are stopped when the columns of the iterated matrix are numerically orthogonal up to approximatelyM*EPS. Thus, on exit,Acontains the columns ofUscaled with the corresponding singular values. - If
INFO > 0: the procedureDGESVJdid not converge in the given number of iterations (sweeps).
LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).SVAβSVAisDOUBLE PRECISIONarray, dimension(N). On exit:- If
INFO = 0: depending on the valueSCALE = WORK(1), we have:- If
SCALE = ONE:SVA(1:N)contains the computed singular values ofA. During the computationSVAcontains the Euclidean column norms of the iterated matrices in the arrayA. - If
SCALE .NE. ONE: the singular values ofAareSCALE*SVA(1:N), and this factored representation is due to the fact that some of the singular values ofAmight underflow or overflow. π
- If
- If
INFO > 0: the procedureDGESVJdid not converge in the given number of iterations (sweeps) andSCALE*SVA(1:N)may not be accurate.
- If
MVβMVisINTEGER. IfJOBV = 'A', then the product of Jacobi rotations inDGESVJis applied to the firstMVrows ofV. See the description ofJOBV.VβVisDOUBLE PRECISIONarray, dimension(LDV,N).- If
JOBV = 'V', thenVcontains on exit the N-by-N matrix of the right singular vectors; - If
JOBV = 'A', thenVcontains the product of the computed right singular vector matrix and the initial matrix in the arrayV. - If
JOBV = 'N', thenVis not referenced.
- If
LDVβLDVisINTEGER. The leading dimension of the arrayV,LDV >= 1.- If
JOBV = 'V', thenLDV >= max(1,N). - If
JOBV = 'A', thenLDV >= max(1,MV).
- If
WORKβWORKisDOUBLE PRECISIONarray, dimension(LWORK).
On entry:
- If
JOBU = 'C':WORK(1) = CTOL, whereCTOLdefines the threshold for convergence. The process stops if all columns ofAare mutually orthogonal up toCTOL*EPS,EPS=DLAMCH('E'). It is required thatCTOL >= ONE, i.e. it is not allowed to force the routine to obtain orthogonality belowEPS.
On exit:
WORK(1) = SCALEis the scaling factor such thatSCALE*SVA(1:N)are the computed singular values ofA. (See description ofSVA().)WORK(2) = NINT(WORK(2))is the number of the computed nonzero singular values.WORK(3) = NINT(WORK(3))is the number of the computed singular values that are larger than the underflow threshold.WORK(4) = NINT(WORK(4))is the number of sweeps of Jacobi rotations needed for numerical convergence.WORK(5) = max_{i.NE.j} |COS(A(:,i),A(:,j))|in the last sweep. This is useful information in cases whenDGESVJdid not converge, as it can be used to estimate whether the output is still useful and for post festum analysis.WORK(6)= the largest absolute value over all sines of the Jacobi rotation angles in the last sweep. It can be useful for a post festum analysis.
LWORKβLWORKisINTEGER. length ofWORK,WORK >= MAX(6,M+N)INFOβINFOisINTEGER.= 0: successful exit.< 0: ifINFO = -i, then the i-th argument had an illegal value> 0:DGESVJdid not converge in the maximal allowed number (30) of sweeps. The output may still be useful. See the description ofWORK.
bestie if you getINFO > 0do NOT panic, the output might still be giving π just go readWORKlike the good little debugger you are π«Ά
β¨ Author β¨
The absolute legends who brought you this:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π«Ά Further Details:
Okay bestie, listen up, because this part is chef's kiss π
The orthogonal N-by-N matrix V is obtained as a product of Jacobi plane rotations. The rotations are implemented as fast scaled rotations of Anda and Park [1]. In the case of underflow of the Jacobi angle, a modified Jacobi transformation of Drmac [4] is used. Pivot strategy uses column interchanges of de Rijk [2]. The relative accuracy of the computed singular values and the accuracy of the computed singular vectors (in angle metric) is as guaranteed by the theory of Demmel and Veselic [3]. The condition number that determines the accuracy in the full rank case is essentially min_{D=diag} kappa(A*D), where kappa(.) is the spectral condition number. The best performance of this Jacobi SVD procedure is achieved if used in an accelerated version of Drmac and Veselic [5,6], and it is the kernel routine in the SIGMA library [7]. Some tuning parameters (marked with [TP]) are available for the implementer.
The computational range for the nonzero singular values is the machine number interval (UNDERFLOW, OVERFLOW). In extreme cases, even denormalized singular values can be computed with the corresponding gradual loss of accurate digits.
β οΈ heads up: that "gradual loss of accurate digits" is real, bestie β denormalized territory means your precision is lowkey evaporating.
π Contributors:
============
Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
π References:
- [1] A. A. Anda and H. Park: Fast plane rotations with dynamic scaling. SIAM J. matrix Anal. Appl., Vol. 15 (1994), pp. 162-174.
- [2] P. P. M. De Rijk: A one-sided Jacobi algorithm for computing the singular value decomposition on a vector computer. SIAM J. Sci. Stat. Comp., Vol. 10 (1998), pp. 359-371.
- [3] J. Demmel and K. Veselic: Jacobi method is more accurate than QR.
- [4] Z. Drmac: Implementation of Jacobi rotations for accurate singular value computation in floating point arithmetic. SIAM J. Sci. Comp., Vol. 18 (1997), pp. 1200-1222.
- [5] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm I. SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1322-1342. LAPACK Working note 169.
- [6] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm II. SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1343-1362. LAPACK Working note 170.
- [7] Z. Drmac: SIGMA - mathematical software library for accurate SVD, PSV, QSVD, (H,K)-SVD computations. Department of Mathematics, University of Zagreb, 2008.
π Bugs, examples and comments:
===========================
Please report all bugs and send interesting test examples and comments to drmac@math.hr. Thank you. π«Ά
πΈ subroutine dgetf2
subroutine dgetf2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
DGETF2 computes the LU factorization of a general m-by-n matrix using partial pivoting with row interchanges (unblocked algorithm). β¨
Purpose:
DGETF2 computes an LU factorization of a general m-by-n matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the right-looking Level 2 BLAS version of the algorithm.
Parameters
Mβ M is INTEGER. The number of rows of the matrix A.M >= 0.Nβ N is INTEGER. The number of columns of the matrix A.N >= 0.Aβ A is DOUBLE PRECISION array, dimension(LDA,N). On entry, the m by n matrix to be factored. On exit, the factors L and U from the factorizationA = P*L*U; the unit diagonal elements of L are not stored. (iconic storage savings, we love to see it)LDAβ LDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).IPIVβ IPIV is INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOβ INFO is INTEGER.= 0: successful exit π< 0: ifINFO = -k, the k-th argument had an illegal value> 0: ifINFO = k,U(k,k)is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. (not the vibe, bestie β do NOT solve with that)
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π subroutine dgetrf
subroutine dgetrf (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
DGETRF DGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
DGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
Purpose:
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the right-looking Level 3 BLAS version of the algorithm.
Parameters
Mβ M is INTEGER. The number of rows of the matrix A.M >= 0.Nβ N is INTEGER. The number of columns of the matrix A.N >= 0.Aβ A is DOUBLE PRECISION array, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorizationA = P*L*U; the unit diagonal elements of L are not stored.LDAβ LDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).IPIVβ IPIV is INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOβ INFO is INTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Purpose:
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the left-looking Level 3 BLAS version of the algorithm.
Parameters
Mβ M is INTEGER. The number of rows of the matrix A.M >= 0.Nβ N is INTEGER. The number of columns of the matrix A.N >= 0.Aβ A is DOUBLE PRECISION array, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorizationA = P*L*U; the unit diagonal elements of L are not stored.LDAβ LDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).IPIVβ IPIV is INTEGER array, dimension(min(M,N)). The pivot indices; for1 <= i <= min(M,N), row i of the matrix was interchanged with rowIPIV(i).INFOβ INFO is INTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Date
December 2016
Purpose:
DGETRF computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This code implements an iterative version of Sivan Toledo's recursive LU algorithm[1]. For square matrices, this iterative versions should be within a factor of two of the optimum number of memory transfers.
The pattern is as follows, with the large blocks of U being updated in one call to DTRSM, and the dotted lines denoting sections that have had all pending permutations applied:
1 2 3 4 5 6 7 8
+-+-+---+-------+------
| |1| | |
|.+-+ 2 | |
| | | | |
|.|.+-+-+ 4 |
| | | |1| |
| | |.+-+ |
| | | | | |
|.|.|.|.+-+-+---+ 8
| | | | | |1| |
| | | | |.+-+ 2 |
| | | | | | | |
| | | | |.|.+-+-+
| | | | | | | |1|
| | | | | | |.+-+
| | | | | | | | |
|.|.|.|.|.|.|.|.+-----
| | | | | | | | |
The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in the binary expansion of the current column. Each Schur update is applied as soon as the necessary portion of U is available.
[1] Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997), 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
Parameters
Mβ M is INTEGER. The number of rows of the matrix A.M >= 0.Nβ N is INTEGER. The number of columns of the matrix A.N >= 0.AAβDOUBLE PRECISION array, dimension (LDA,N). On entry, theM-by-Nmatrix to be factored. On exit, the factorsLandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored. bestie they literally skip storing them bc they're all 1s, it's giving efficient πLDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVβINTEGER array, dimension (min(M,N)). The pivot indices; for1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i). this is the receipts of every row swap that happened, keep up πINFOβINTEGER. the vibe check:= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value π> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. π¨ like genuinely, do not pass go
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Date
December 2016
π recursive subroutine dgetrf2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
okay so this is DGETRF2 and she's the same girl as DGETRF but recursive, main character energy honestly π
πΈ Purpose:
DGETRF2 computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).
This is the recursive version of the algorithm. It divides the matrix into four submatrices:
[ A11 | A12 ] where A11 is n1 by n1 and A22 is n2 by n2
A = [ -----|----- ] with n1 = min(m,n)/2
[ A21 | A22 ] n2 = n-n1
The subroutine calls itself to factor
[ A11 ]
The subroutine calls itself to factor [ --- ],
[ A12 ]
[ A12 ]
do the swaps on [ --- ], solve A12, update A22,
[ A22 ]
then calls itself to factor A22 and do the swaps on A21.
it's literally recursion, she contains multitudes π¦
π Parameters
MβINTEGER. The number of rows of the matrixA.M >= 0.NβINTEGER. The number of columns of the matrixA.N >= 0.AβDOUBLE PRECISION array, dimension (LDA,N). On entry, theM-by-Nmatrix to be factored. On exit, the factorsLandUfrom the factorizationA = P*L*U; the unit diagonal elements ofLare not stored.LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).IPIVβINTEGER array, dimension (min(M,N)). The pivot indices; for1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).INFOβINTEGER. the same trio as before, no cap:= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value π> 0: ifINFO = i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. π¨
π«Ά Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π subroutine dgetri (integer N, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DGETRI π
the inverse girlie
πΈ Purpose:
DGETRI computes the inverse of a matrix using the LU factorization computed by DGETRF.
This method inverts U and then computes inv(A) by solving the system inv(A)*L = inv(U) for inv(A).
π Parameters
NβINTEGER. The order of the matrixA.N >= 0.AβDOUBLE PRECISION array, dimension (LDA,N). On entry, the factorsLandUfrom the factorizationA = P*L*Uas computed byDGETRF. On exit, ifINFO = 0, the inverse of the original matrixA. she goes in as L and U and comes out as the whole inverse, glow up β¨LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).IPIVβINTEGER array, dimension (N). The pivot indices fromDGETRF; for1<=i<=N, rowiof the matrix was interchanged with rowIPIV(i).WORKβDOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO=0, thenWORK(1)returns the optimalLWORK.LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N). For optimal performanceLWORK >= N*NB, whereNBis the optimal blocksize returned byILAENV.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. so -1 is the "just tell me how much room u need bestie" move π
INFOβINTEGER.= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value π> 0: ifINFO = i,U(i,i)is exactly zero; the matrix is singular and its inverse could not be computed. π no inverse for u
π«Ά Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π§ subroutine dgetrs (character TRANS, integer N, integer NRHS, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, double precision, dimension( ldb, * ) B, integer LDB, integer INFO)
DGETRS π₯ the solver
πΈ Purpose:
DGETRS solves a system of linear equations
A * X = B or A**T * X = B
with a general N-by-N matrix A using the LU factorization computed by DGETRF.
π Parameters
TRANSβCHARACTER*1. Specifies the form of the system of equations:= 'N':A * X = B(No transpose)= 'T':A**T* X = B(Transpose)= 'C':A**T* X = B(Conjugate transpose = Transpose) β for real matrices these two are literally the same thing, so cute, same vibe π
NβINTEGER. The order of the matrixA.N >= 0.NRHSβINTEGER. The number of right hand sides, i.e., the number of columns of the matrixB.NRHS >= 0.AβDOUBLE PRECISION array, dimension (LDA,N). The factorsLandUfrom the factorizationA = P*L*Uas computed byDGETRF.LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).IPIVβINTEGER array, dimension (N). The pivot indices fromDGETRF; for1<=i<=N, rowiof the matrix was interchanged with rowIPIV(i).BβDOUBLE PRECISION array, dimension (LDB,NRHS). On entry, the right hand side matrixB. On exit, the solution matrixX. in goes B, out comes X, we love a transformation arc πLDBβINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).INFOβINTEGER.= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value π
π«Ά Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π subroutine dhgeqz (character JOB, character COMPQ, character COMPZ, integer N, integer ILO, integer IHI, double precision, dimension( ldh, * ) H, integer LDH, double precision, dimension( ldt, * ) T, integer LDT, double precision, dimension( * ) ALPHAR, double precision, dimension( * ) ALPHAI, double precision, dimension( * ) BETA, double precision, dimension( ldq, * ) Q, integer LDQ, double precision, dimension( ldz, * ) Z, integer LDZ, double precision, dimension( * ) WORK, integer LWORK, integer INFO)
DHGEQZ β the eigenvalues-of-a-matrix-pair girlie, she's doing the most and we're obsessed
πΈ Purpose:
DHGEQZ computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift QZ method. Matrix pairs of this type are produced by the reduction to generalized upper Hessenberg form of a real matrix pair (A,B):
A = Q1*H*Z1**T, B = Q1*T*Z1**T,
as computed by DGGHRD.
If JOB='S', then the Hessenberg-triangular pair (H,T) is also reduced to generalized Schur form,
H = Q*S*Z**T, T = Q*P*Z**T,
where Q and Z are orthogonal matrices, P is an upper triangular matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal blocks.
The 1-by-1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of eigenvalues. π¦ real ones get their own lil block, the complex conjugate cuties pair up
Additionally, the 2-by-2 upper triangular diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0, P(j,j) > 0, and P(j+1,j+1) > 0.
Optionally, the orthogonal matrix Q from the generalized Schur factorization may be postmultiplied into an input matrix Q1, and the orthogonal matrix Z may be postmultiplied into an input matrix Z1. If Q1 and Z1 are the orthogonal matrices from DGGHRD that reduced the matrix pair (A,B) to generalized upper Hessenberg form, then the output matrices Q1*Q and Z1*Z are the orthogonal factors from the generalized Schur factorization of (A,B):
A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently, of (A,B)) are computed as a pair of values (alpha,beta), where alpha is complex and beta real. If beta is nonzero, lambda = alpha / beta is an eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP)
A*x = lambda*B*x
and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the alternate form of the GNEP
mu*A*y = B*y.
Real eigenvalues can be read directly from the generalized Schur form:
alpha = S(i,i), beta = P(i,i).
so you literally just peek at the diagonal, iykyk πΈ
Ref: C.B. Moler & G.W. Stewart, 'An Algorithm for Generalized Matrix Eigenvalue Problems', SIAM J. Numer. Anal., 10(1973), pp. 241--256.
β¨ Parameters β¨
okay bestie, hereβs the tea on every single argument for this routine. no skips, no skips, periodt. π
JOBβ itβs aCHARACTER*1, and it decides how much of the Schur form youβre getting.= 'E': bestie, you only want the eigenvalues. thatβs it. Compute eigenvalues only;= 'S': you want the whole package. Compute eigenvalues and the Schur form.
COMPQβCHARACTER*1, controls the left Schur vectorsQ.= 'N': Left Schur vectors (Q) are not computed;= 'I':Qis initialized to the unit matrix and the matrixQof left Schur vectors of(H,T)is returned;= 'V':Qmust contain an orthogonal matrixQ1on entry and the productQ1*Qis returned.
COMPZβCHARACTER*1, controls the right Schur vectorsZ.= 'N': Right Schur vectors (Z) are not computed;= 'I':Zis initialized to the unit matrix and the matrixZof right Schur vectors of(H,T)is returned;= 'V':Zmust contain an orthogonal matrixZ1on entry and the productZ1*Zis returned.
NβINTEGER. The order of the matricesH,T,Q, andZ.N >= 0.ILOβINTEGER. (yes, thatβs the whole description. iconic minimalism.)IHIβINTEGER.ILOandIHImark the rows and columns ofHwhich are in Hessenberg form. It is assumed thatAis already upper triangular in rows and columns1:ILO-1andIHI+1:N. IfN > 0,1 <= ILO <= IHI <= N; ifN = 0,ILO=1andIHI=0.HβDOUBLE PRECISION array, dimension (LDH, N). On entry, theN-by-Nupper Hessenberg matrixH. On exit, ifJOB = 'S',Hcontains the upper quasi-triangular matrixSfrom the generalized Schur factorization. IfJOB = 'E', the diagonal blocks ofHmatch those ofS, but the rest ofHis unspecified.LDHβINTEGER. The leading dimension of the arrayH.LDH >= max( 1, N ).TβDOUBLE PRECISION array, dimension (LDT, N). On entry, theN-by-Nupper triangular matrixT. On exit, ifJOB = 'S',Tcontains the upper triangular matrixPfrom the generalized Schur factorization;2-by-2diagonal blocks ofPcorresponding to2-by-2blocks ofSare reduced to positive diagonal form, i.e., ifH(j+1,j)is non-zero, thenT(j+1,j) = T(j,j+1) = 0,T(j,j) > 0, andT(j+1,j+1) > 0. IfJOB = 'E', the diagonal blocks ofTmatch those ofP, but the rest ofTis unspecified.LDTβINTEGER. The leading dimension of the arrayT.LDT >= max( 1, N ).ALPHARβDOUBLE PRECISION array, dimension (N). The real parts of each scalar alpha defining an eigenvalue of GNEP.ALPHAIβDOUBLE PRECISION array, dimension (N). The imaginary parts of each scalar alpha defining an eigenvalue of GNEP. IfALPHAI(j)is zero, then thej-th eigenvalue is real; if positive, then thej-th and(j+1)-st eigenvalues are a complex conjugate pair, withALPHAI(j+1) = -ALPHAI(j).BETAβDOUBLE PRECISION array, dimension (N). The scalars beta that define the eigenvalues of GNEP. Together, the quantitiesalpha = (ALPHAR(j),ALPHAI(j))andbeta = BETA(j)represent thej-th eigenvalue of the matrix pair(A,B), in one of the formslambda = alpha/betaormu = beta/alpha. Since eitherlambdaormumay overflow, they should not, in general, be computed.QβDOUBLE PRECISION array, dimension (LDQ, N). On entry, ifCOMPQ = 'V', the orthogonal matrixQ1used in the reduction of(A,B)to generalized Hessenberg form. On exit, ifCOMPQ = 'I', the orthogonal matrix of left Schur vectors of(H,T), and ifCOMPQ = 'V', the orthogonal matrix of left Schur vectors of(A,B). Not referenced ifCOMPQ = 'N'.LDQβINTEGER. The leading dimension of the arrayQ.LDQ >= 1. IfCOMPQ='V'or'I', thenLDQ >= N.ZβDOUBLE PRECISION array, dimension (LDZ, N). On entry, ifCOMPZ = 'V', the orthogonal matrixZ1used in the reduction of(A,B)to generalized Hessenberg form. On exit, ifCOMPZ = 'I', the orthogonal matrix of right Schur vectors of(H,T), and ifCOMPZ = 'V', the orthogonal matrix of right Schur vectors of(A,B). Not referenced ifCOMPZ = 'N'.LDZβINTEGER. The leading dimension of the arrayZ.LDZ >= 1. IfCOMPZ='V'or'I', thenLDZ >= N.WORKβDOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO >= 0,WORK(1)returns the optimalLWORK.LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N).
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
INFOβINTEGER.= 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value= 1,...,N: the QZ iteration did not converge.(H,T)is not in Schur form, butALPHAR(i),ALPHAI(i), andBETA(i),i=INFO+1,...,Nshould be correct.= N+1,...,2*N: the shift calculation failed.(H,T)is not in Schur form, butALPHAR(i),ALPHAI(i), andBETA(i),i=INFO-N+1,...,Nshould be correct.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ Further Details: π¦
Iteration counters:
JITER-- counts iterations.IITER-- counts iterations run sinceILASTwas last changed. This is therefore reset only when a1-by-1or2-by-2block deflates off the bottom.
π subroutine dla_geamv π
subroutine dla_geamv (integer TRANS, integer M, integer N, double precision
ALPHA, double precision, dimension( lda, * ) A, integer LDA, double
precision, dimension( * ) X, integer INCX, double precision BETA, double
precision, dimension( * ) Y, integer INCY)
DLA_GEAMV computes a matrix-vector product using a general matrix to calculate error bounds.
π Purpose: π
DLA_GEAMV performs one of the matrix-vector operations
y := alpha*abs(A)*abs(x) + beta*abs(y),
or y := alpha*abs(A)**T*abs(x) + beta*abs(y),
where alpha and beta are scalars, x and y are vectors and A is an m by n matrix.
This function is primarily used in calculating error bounds. To protect against underflow during evaluation, components in the resulting vector are perturbed away from zero by (N+1) times the underflow threshold. To prevent unnecessarily large errors for block-structure embedded in general matrices, 'symbolically' zero components are not perturbed. A zero entry is considered 'symbolic' if all multiplications involved in computing that entry have at least one zero multiplicand.
πΈ Parameters πΈ
TRANSβINTEGER. On entry,TRANSspecifies the operation to be performed as follows:BLAS_NO_TRANS:y := alpha*abs(A)*abs(x) + beta*abs(y)BLAS_TRANS:y := alpha*abs(A**T)*abs(x) + beta*abs(y)BLAS_CONJ_TRANS:y := alpha*abs(A**T)*abs(x) + beta*abs(y)
Unchanged on exit.
MβINTEGER. On entry,Mspecifies the number of rows of the matrixA.Mmust be at least zero. Unchanged on exit.NβINTEGER. On entry,Nspecifies the number of columns of the matrixA.Nmust be at least zero. Unchanged on exit.ALPHAβDOUBLE PRECISION. On entry,ALPHAspecifies the scalar alpha. Unchanged on exit.AβDOUBLE PRECISION array, dimension ( LDA, n ). Before entry, the leadingmbynpart of the arrayAmust contain the matrix of coefficients. Unchanged on exit.LDAβINTEGER. On entry,LDAspecifies the first dimension ofAas declared in the calling (sub) program.LDAmust be at leastmax( 1, m ). Unchanged on exit.XβDOUBLE PRECISION array, dimension ( 1 + ( n - 1 )*abs( INCX ) )whenTRANS = 'N'or'n'and at least( 1 + ( m - 1 )*abs( INCX ) )otherwise. Before entry, the incremented arrayXmust contain the vectorx. Unchanged on exit.INCXβINTEGER. On entry,INCXspecifies the increment for the elements ofX.INCXmust not be zero. Unchanged on exit.BETAβDOUBLE PRECISION. On entry,BETAspecifies the scalar beta. WhenBETAis supplied as zero thenYneed not be set on input. Unchanged on exit.YβDOUBLE PRECISION array, dimension at least ( 1 + ( m - 1 )*abs( INCY ) )whenTRANS = 'N'or'n'and at least( 1 + ( n - 1 )*abs( INCY ) )otherwise. Before entry withBETAnon-zero, the incremented arrayYmust contain the vectory. On exit,Yis overwritten by the updated vectory.INCYβINTEGER. On entry,INCYspecifies the increment for the elements ofY.INCYmust not be zero. Unchanged on exit.
Level 2 Blas routine.
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π double precision function dla_gercond π
okay bestie, here's the actual signature, character for character, no edits:
double precision function dla_gercond (character TRANS, integer N, double
precision, dimension( lda, * ) A, integer LDA, double precision,
dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV,
integer CMODE, double precision, dimension( * ) C, integer INFO, double
precision, dimension( * ) WORK, integer, dimension( * ) IWORK)
DLA_GERCOND estimates the Skeel condition number for a general matrix. that's the whole vibe.
Purpose:
DLA_GERCOND estimates the Skeel condition number of op(A) * op2(C), where op2 is determined by CMODE like this:
CMODE = 1βop2(C) = CCMODE = 0βop2(C) = ICMODE = -1βop2(C) = inv(C)
The Skeel condition number cond(A) = norminf( |inv(A)||A| ) is computed by computing scaling factors R such that diag(R)*A*op2(C) is row equilibrated, and then computing the standard infinity-norm condition number. that's it, that's the whole glow-up β¨
Parameters:
TRANSβTRANSisCHARACTER*1. Specifies the form of the system of equations:= 'N':A * X = B(No transpose)= 'T':A**T * X = B(Transpose)= 'C':A**H * X = B(Conjugate Transpose = Transpose)
NβNisINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). On entry, theN-by-NmatrixA.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisDOUBLE PRECISIONarray, dimension(LDAF,N). The factorsLandUfrom the factorizationA = P*L*Uas computed byDGETRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβIPIVisINTEGERarray, dimension(N). The pivot indices from the factorizationA = P*L*Uas computed byDGETRF; rowiof the matrix was interchanged with rowIPIV(i).CMODEβCMODEisINTEGER. Determinesop2(C)in the formulaop(A) * op2(C)like so:CMODE = 1βop2(C) = CCMODE = 0βop2(C) = ICMODE = -1βop2(C) = inv(C)
CβCisDOUBLE PRECISIONarray, dimension(N). The vectorCin the formulaop(A) * op2(C).INFOβINFOisINTEGER.= 0: Successful exit.i > 0: Theith argument is invalid.
WORKβWORKisDOUBLE PRECISIONarray, dimension(3*N). Workspace.IWORKβIWORKisINTEGERarray, dimension(N). Workspace.
Author:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ subroutine dla_gerfsx_extended π¦
the signature, exactly as it lives, no cap:
subroutine dla_gerfsx_extended (integer PREC_TYPE, integer TRANS_TYPE,
integer N, integer NRHS, double precision, dimension( lda, * ) A,
integer LDA, double precision, dimension( ldaf, * ) AF, integer LDAF,
integer, dimension( * ) IPIV, logical COLEQU, double precision,
dimension( * ) C, double precision, dimension( ldb, * ) B, integer LDB,
double precision, dimension( ldy, * ) Y, integer LDY, double precision,
dimension( * ) BERR_OUT, integer N_NORMS, double precision, dimension(
nrhs, * ) ERRS_N, double precision, dimension( nrhs, * ) ERRS_C, double
precision, dimension( * ) RES, double precision, dimension( * ) AYB,
double precision, dimension( * ) DY, double precision, dimension( * )
Y_TAIL, double precision RCOND, integer ITHRESH, double precision
RTHRESH, double precision DZ_UB, logical IGNORE_CWISE, integer INFO)
DLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution. it's giving extra, literally in the name π
Purpose:
DLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution. This subroutine is called by DGERFSX to perform iterative refinement. In addition to normwise error bound, the code provides maximum componentwise error bound if possible. See comments for ERRS_N and ERRS_C for details of the error bounds. Note that this subroutine is only responsible for setting the second fields of ERRS_N and ERRS_C.
Parameters:
PREC_TYPEβPREC_TYPEisINTEGER. Specifies the intermediate precision to be used in refinement. The value is defined byILAPREC(P)wherePis aCHARACTERandP = 'S': SingleP = 'D': DoubleP = 'I': IndigenousP = 'X'or'E': Extra
TRANS_TYPEβTRANS_TYPEisINTEGER. Specifies the transposition operation onA. The value is defined byILATRANS(T)whereTis aCHARACTERandT= 'N': No transpose= 'T': Transpose= 'C': Conjugate transpose
NβNisINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSβNRHSisINTEGER. The number of right-hand-sides, i.e., the number of columns of the matrixB.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). On entry, theN-by-NmatrixA.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisDOUBLE PRECISIONarray, dimension(LDAF,N). The factorsLandUfrom the factorizationA = P*L*Uas computed byDGETRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).IPIVβIPIVisINTEGERarray, dimension(N). The pivot indices from the factorizationA = P*L*Uas computed byDGETRF; rowiof the matrix was interchanged with rowIPIV(i).COLEQUβCOLEQUisLOGICAL. If.TRUE.then column equilibration was done toAbefore calling this routine. This is needed to compute the solution and error bounds correctly.CβCisDOUBLE PRECISIONarray, dimension(N). The column scale factors forA. IfCOLEQU = .FALSE.,Cis not accessed. IfCis input, each element ofCshould be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.BβBisDOUBLE PRECISIONarray, dimension(LDB,NRHS). The right-hand-side matrixB.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).YβYisDOUBLE PRECISIONarray, dimension(LDY,NRHS). On entry, the solution matrixX, as computed byDGETRS. On exit, the improved solution matrixY.LDYβLDYisINTEGER. The leading dimension of the arrayY.LDY >= max(1,N).BERR_OUTβBERR_OUTisDOUBLE PRECISIONarray, dimension(NRHS). On exit,BERR_OUT(j)contains the componentwise relative backward error for right-hand-sidejfrom the formula
max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
where abs(Z) is the componentwise absolute value of the matrix or vector Z. This is computed by DLA_LIN_BERR.
N_NORMSβN_NORMSisINTEGER. Determines which error bounds to return (seeERRS_NandERRS_C).- If
N_NORMS >= 1return normwise error bounds. - If
N_NORMS >= 2return componentwise error bounds.
- If
ERRS_NβERRS_NisDOUBLE PRECISIONarray, dimension(NRHS, N_ERR_BNDS). For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows:
Normwise relative error in the ith solution vector:
max_j (abs(XTRUE(j,i) - X(j,i)))
------------------------------
max_j abs(X(j,i))
The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned.
The first index in ERRS_N(i,:) corresponds to the ith right-hand side.
The second index in ERRS_N(:,err) contains the following three fields:
err = 1'Trust/don't trust'boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2'Guaranteed'error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the thresholdsqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * slamch('Epsilon')to determine if the error estimate is'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*A, whereSscales each row by a power of the radix so all absolute row sums ofZare approximately 1.
This subroutine is only responsible for setting the second field above.
See Lapack Working Note 165 for further details and extra cautions.
ERRS_CERRS_CisDOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array is holding all the info about the various error bounds and condition numbers that go with the componentwise relative error, which is defined like this:
Componentwise relative error in the ith solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array gets indexed by the right-hand side i (because the componentwise relative error depends on it, obvi), and by the type of error info as described below. As of rn there are up to three pieces of info returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERRS_C doesn't get accessed at all. And if N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries are returned.
The first index in ERRS_C(i,:) corresponds to the ith right-hand side. π«
The second index in ERRS_C(:,err) contains these three fields:
err = 1β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β 'Guaranteed' error bound: the estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the thresholdsqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3β Reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * slamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side andSscales each row ofA*diag(x)by a power of the radix so all absolute row sums ofZare approximately 1.
This subroutine is only responsible for setting the second field above. See Lapack Working Note 165 for further details and extra cautions. π
RESβRESisDOUBLE PRECISION array, dimension (N). Workspace to hold the intermediate residual.AYBβAYBisDOUBLE PRECISION array, dimension (N). Workspace. This can be the same workspace passed forY_TAIL.DYβDYisDOUBLE PRECISION array, dimension (N). Workspace to hold the intermediate solution.Y_TAILβY_TAILisDOUBLE PRECISION array, dimension (N). Workspace to hold the trailing bits of the intermediate solution.RCONDβRCONDisDOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrixAafter equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Heads up tho: the error may still be small even if this number is very small and the matrix appears ill-conditioned. πITHRESHβITHRESHisINTEGER. The maximum number of residual computations allowed for refinement. The default is10. For 'aggressive' set to100to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inERRS_NandERRS_Cmay no longer be trustworthy. πRTHRESHβRTHRESHisDOUBLE PRECISION. Determines when to stop refinement if the error estimate stops decreasing. Refinement will stop when the next solution no longer satisfiesnorm(dx_{i+1}) < RTHRESH * norm(dx_i)wherenorm(Z)is the infinity norm ofZ.RTHRESHsatisfies0 < RTHRESH <= 1. The default value is0.5. For 'aggressive' set to0.9to permit convergence on extremely ill-conditioned matrices. See LAWN 165 for more details.DZ_UBβDZ_UBisDOUBLE PRECISION. Determines when to start considering componentwise convergence. Componentwise convergence is only considered after each component of the solutionYis stable, which we define as the relative change in each component being less thanDZ_UB. The default value is0.25, requiring the first bit to be stable. See LAWN 165 for more details.IGNORE_CWISEβIGNORE_CWISEisLOGICAL. If.TRUE.then ignore componentwise convergence. Default value is.FALSE..INFOβINFOisINTEGER= 0: Successful exit.< 0: ifINFO = -i, the ith argument toDGETRShad an illegal value
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β¨ double precision function dla_gerpvgrw (integer N, integer NCOLS, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( ldaf, * ) AF, integer LDAF)
πΈ DLA_GERPVGRW
π«Ά Purpose:
DLA_GERPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U). The 'max absolute element' norm is used. If this is much less than 1, the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable. π
π Parameters
NβNisINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NCOLSβNCOLSisINTEGER. The number of columns of the matrixA.NCOLS >= 0.AβAisDOUBLE PRECISION array, dimension (LDA,N). On entry, theN-by-NmatrixA.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAFisDOUBLE PRECISION array, dimension (LDAF,N). The factorsLandUfrom the factorizationA = P*L*Uas computed byDGETRF.LDAFβLDAFisINTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β¨ subroutine dlaorhr_col_getrfnp (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) D, integer INFO)
πΈ DLAORHR_COL_GETRFNP
π«Ά Purpose:
DLAORHR_COL_GETRFNP computes the modified LU factorization without pivoting of a real general M-by-N matrix A. The factorization has the form:
A - S = L * U,
where:
Sis am-by-ndiagonal sign matrix with the diagonalD, so thatD(i) = S(i,i),1 <= i <= min(M,N). The diagonalDis constructed asD(i)=-SIGN(A(i,i)), whereA(i,i)is the value after performingi-1steps of Gaussian elimination. This means that the diagonal element at each step of 'modified' Gaussian elimination is at least one in absolute value (so that division-by-zero not not possible during the division by the diagonal element);Lis aM-by-Nlower triangular matrix with unit diagonal elements (lower trapezoidal ifM > N);- and
Uis aM-by-Nupper triangular matrix (upper trapezoidal ifM < N).
This routine is an auxiliary routine used in the Householder reconstruction routine DORHR_COL. In DORHR_COL, this routine is applied to an M-by-N matrix A with orthonormal columns, where each element is bounded by one in absolute value. With the choice of the matrix S above, one can show that the diagonal element at each step of Gaussian elimination is the largest (in absolute value) in the column on or below the diagonal, so that no pivoting is required for numerical stability [1]. π₯
For more details on the Householder reconstruction algorithm, including the modified LU factorization, see [1].
This is the blocked right-looking version of the algorithm, calling Level 3 BLAS to update the submatrix. To factorize a block, this routine calls the recursive routine DLAORHR_COL_GETRFNP2.
[1] 'Reconstructing Householder vectors from tall-skinny QR', G. Ballard, J. Demmel, L. Grigori, M. Jacquelin, H.D. Nguyen, E. Solomonik, J. Parallel Distrib. Comput., vol. 85, pp. 3-31, 2015.
π Parameters
MβMisINTEGER. The number of rows of the matrixA.M >= 0.NβNisINTEGER. The number of columns of the matrixA.N >= 0.AβAisDOUBLE PRECISION array, dimension (LDA,N). On entry, theM-by-Nmatrix to be factored. On exit, the factorsLandUfrom the factorizationA-S=L*U; the unit diagonal elements ofLare not stored.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).DβDisDOUBLE PRECISION array, dimension min(M,N). The diagonal elements of the diagonalM-by-Nsign matrixS,D(i) = S(i,i), where1 <= i <= min(M,N). The elements can be only plus or minus one.INFOβINFOisINTEGER= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π Contributors:
November 2019, Igor Kozachenko, Computer Science Division, University of California, Berkeley
β¨ recursive subroutine dlaorhr_col_getrfnp2 (integer M, integer N, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) D, integer INFO)
πΈ DLAORHR_COL_GETRFNP2
π«Ά Purpose:
bestie the page literally cuts off right here π more coming in the next part, stay tuned π¦
DLAORHR_COL_GETRFNP2 computes the modified LU factorization without pivoting of a real general M-by-N matrix A. The factorization has the form:
A - S = L * U,
where:
- S is a m-by-n diagonal sign matrix with the diagonal D, so that
D(i) = S(i,i),1 <= i <= min(M,N). The diagonal D is constructed asD(i)=-SIGN(A(i,i)), whereA(i,i)is the value after performingi-1steps of Gaussian elimination. This means that the diagonal element at each step of 'modified' Gaussian elimination is at least one in absolute value (so that division-by-zero not possible during the division by the diagonal element); - L is a M-by-N lower triangular matrix with unit diagonal elements (lower trapezoidal if
M > N); - and U is a M-by-N upper triangular matrix (upper trapezoidal if
M < N).
This routine is an auxiliary routine used in the Householder reconstruction routine DORHR_COL. In DORHR_COL, this routine is applied to an M-by-N matrix A with orthonormal columns, where each element is bounded by one in absolute value. With the choice of the matrix S above, one can show that the diagonal element at each step of Gaussian elimination is the largest (in absolute value) in the column on or below the diagonal, so that no pivoting is required for numerical stability [1].
For more details on the Householder reconstruction algorithm, including the modified LU factorization, see [1].
This is the recursive version of the LU factorization algorithm. Denote A - S by B. The algorithm divides the matrix B into four submatrices:
[ B11 | B12 ] where B11 is n1 by n1,
B = [ -----|----- ] B21 is (m-n1) by n1,
[ B21 | B22 ] B12 is n1 by n2,
B22 is (m-n1) by n2,
with n1 = min(m,n)/2, n2 = n-n1.
The subroutine calls itself to factor B11, solves for B21, solves for B12, updates B22, then calls itself to factor B22.
For more details on the recursive LU algorithm, see [2].
DLAORHR_COL_GETRFNP2 is called to factorize a block by the blocked routine DLAORHR_COL_GETRFNP, which uses blocked code calling Level 3 BLAS to update the submatrix. However, DLAORHR_COL_GETRFNP2 is self-sufficient and can be used without DLAORHR_COL_GETRFNP.
[1] 'Reconstructing Householder vectors from tall-skinny QR', G. Ballard, J. Demmel, L. Grigori, M. Jacquelin, H.D. Nguyen, E. Solomonik, J. Parallel Distrib. Comput., vol. 85, pp. 3-31, 2015.
[2] 'Recursion leads to automatic variable blocking for dense linear algebra algorithms', F. Gustavson, IBM J. of Res. and Dev., vol. 41, no. 6, pp. 737-755, 1997.
β¨ Parameters β¨
MβMisINTEGER. The number of rows of the matrix A.M >= 0. π«ΆNβNisINTEGER. The number of columns of the matrix A.N >= 0. π«AβAisDOUBLE PRECISIONarray, dimension(LDA,N). On entry, the M-by-N matrix to be factored. On exit, the factors L and U from the factorizationA-S=L*U; the unit diagonal elements of L are not stored.LDAβLDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).DβDisDOUBLE PRECISIONarray, dimensionmin(M,N). The diagonal elements of the diagonal M-by-N sign matrix S,D(i) = S(i,i), where1 <= i <= min(M,N). The elements can be only plus or minus one. βοΈINFOβINFOisINTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
πΈ Contributors: πΈ
November 2019, Igor Kozachenko, Computer Science Division, University of California, Berkeley
π¦ recursive subroutine dlaqz0 π¦
recursive subroutine dlaqz0 (character, intent(in) WANTS, character,
intent(in) WANTQ, character, intent(in) WANTZ, integer, intent(in) N,
integer, intent(in) ILO, integer, intent(in) IHI, double precision,
dimension( lda, * ), intent(inout) A, integer, intent(in) LDA, double
precision, dimension( ldb, * ), intent(inout) B, integer, intent(in)
LDB, double precision, dimension( * ), intent(inout) ALPHAR, double
precision, dimension( * ), intent(inout) ALPHAI, double precision,
dimension( * ), intent(inout) BETA, double precision, dimension( ldq, *
), intent(inout) Q, integer, intent(in) LDQ, double precision,
dimension( ldz, * ), intent(inout) Z, integer, intent(in) LDZ, double
precision, dimension( * ), intent(inout) WORK, integer, intent(in)
LWORK, integer, intent(in) REC, integer, intent(out) INFO)
π Purpose: π
DLAQZ0 computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift QZ method. Matrix pairs of this type are produced by the reduction to generalized upper Hessenberg form of a real matrix pair (A,B):
A = Q1*H*Z1**T, B = Q1*T*Z1**T,
as computed by DGGHRD.
If JOB='S', then the Hessenberg-triangular pair (H,T) is also reduced to generalized Schur form,
H = Q*S*Z**T, T = Q*P*Z**T,
where Q and Z are orthogonal matrices, P is an upper triangular matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal blocks.
The 1-by-1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of eigenvalues.
Additionally, the 2-by-2 upper triangular diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0, P(j,j) > 0, and P(j+1,j+1) > 0.
Optionally, the orthogonal matrix Q from the generalized Schur factorization may be postmultiplied into an input matrix Q1, and the orthogonal matrix Z may be postmultiplied into an input matrix Z1. If Q1 and Z1 are the orthogonal matrices from DGGHRD that reduced the matrix pair (A,B) to generalized upper Hessenberg form, then the output matrices Q1*Q and Z1*Z are the orthogonal factors from the generalized Schur factorization of (A,B):
A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently, of (A,B)) are computed as a pair of values (alpha,beta), where alpha is complex and beta real. If beta is nonzero, lambda = alpha / beta is an eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP)
A*x = lambda*B*x
and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the alternate form of the GNEP
mu*A*y = B*y.
Real eigenvalues can be read directly from the generalized Schur form:
alpha = S(i,i), beta = P(i,i).
Ref: C.B. Moler & G.W. Stewart, 'An Algorithm for Generalized Matrix Eigenvalue Problems', SIAM J. Numer. Anal., 10(1973), pp. 241--256.
Ref: B. Kagstrom, D. Kressner, 'Multishift Variants of the QZ Algorithm with Aggressive Early Deflation', SIAM J. Numer. Anal., 29(2006), pp. 199--227.
Ref: T. Steel, D. Camps, K. Meerbergen, R. Vandebril 'A multishift, multipole rational QZ method with agressive early deflation'
β¨ Parameters β¨
WANTSβWANTSisCHARACTER*1.= 'E': Compute eigenvalues only;= 'S': Compute eigenvalues and the Schur form.
WANTQβWANTQisCHARACTER*1.= 'N': Left Schur vectors (Q) are not computed;= 'I': Q is initialized to the unit matrix and the matrix Q of left Schur vectors of(A,B)is returned;= 'V': Q must contain an orthogonal matrix Q1 on entry and the productQ1*Qis returned.
WANTZβWANTZisCHARACTER*1.= 'N': Right Schur vectors (Z) are not computed;= 'I': Z is initialized to the unit matrix and the matrix Z of right Schur vectors of(A,B)is returned;= 'V': Z must contain an orthogonal matrix Z1 on entry and the productZ1*Zis returned.
NβNisINTEGER. The order of the matrices A, B, Q, and Z.N >= 0.ILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHImark the rows and columns of A which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns1:ILO-1andIHI+1:N. IfN > 0,1 <= ILO <= IHI <= N; ifN = 0,ILO=1andIHI=0.AβAisDOUBLE PRECISIONarray, dimension(LDA, N). On entry, the N-by-N upper Hessenberg matrix A. On exit, ifJOB = 'S', A contains the upper quasi-triangular matrix S from the generalized Schur factorization. IfJOB = 'E', the diagonal blocks of A match those of S, but the rest of A is unspecified.LDAβLDAisINTEGER. The leading dimension of the array A.LDA >= max( 1, N ).BβBisDOUBLE PRECISIONarray, dimension(LDB, N). On entry, the N-by-N upper triangular matrix B. On exit, ifJOB = 'S', B contains the upper triangular matrix P from the generalized Schur factorization; 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., ifA(j+1,j)is non-zero, thenB(j+1,j) = B(j,j+1) = 0,B(j,j) > 0, andB(j+1,j+1) > 0. IfJOB = 'E', the diagonal blocks of B match those of P, but the rest of B is unspecified.LDBβLDBisINTEGER. The leading dimension of the array B.LDB >= max( 1, N ).ALPHARβALPHARisDOUBLE PRECISIONarray, dimension(N). The real parts of each scalar alpha defining an eigenvalue of GNEP.ALPHAIALPHAIβDOUBLE PRECISIONarray, dimension(N)
The imaginary parts of each scalar alpha defining an eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if it's positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j). π¦
BETAβDOUBLE PRECISIONarray, dimension(N)
The scalars beta that define the eigenvalues of GNEP. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the matrix pair (A,B), in one of the forms lambda = alpha/beta or mu = beta/alpha. Since either lambda or mu may overflow, they should not, in general, be computed. bestie don't do it, it's giving disaster π
QβDOUBLE PRECISIONarray, dimension(LDQ, N)
On entry, if COMPQ = 'V', the orthogonal matrix Q1 used in the reduction of (A,B) to generalized Hessenberg form. On exit, if COMPQ = 'I', the orthogonal matrix of left Schur vectors of (A,B), and if COMPQ = 'V', the orthogonal matrix of left Schur vectors of (A,B). Not referenced if COMPQ = 'N'.
LDQβINTEGER
The leading dimension of the array Q. LDQ >= 1. If COMPQ='V' or 'I', then LDQ >= N. β¨
ZβDOUBLE PRECISIONarray, dimension(LDZ, N)
On entry, if COMPZ = 'V', the orthogonal matrix Z1 used in the reduction of (A,B) to generalized Hessenberg form. On exit, if COMPZ = 'I', the orthogonal matrix of right Schur vectors of (H,T), and if COMPZ = 'V', the orthogonal matrix of right Schur vectors of (A,B). Not referenced if COMPZ = 'N'.
LDZβINTEGER
The leading dimension of the array Z. LDZ >= 1. If COMPZ='V' or 'I', then LDZ >= N. π
WORKβDOUBLE PRECISIONarray, dimension(MAX(1,LWORK))
On exit, if INFO >= 0, WORK(1) returns the optimal LWORK. free real estate info, we love to see it
LWORKβINTEGER
The dimension of the array WORK. LWORK >= max(1,N).
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. iykyk π
RECβINTEGER
REC indicates the current recursion level. Should be set to 0 on first call.
INFOβINTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value= 1,...,N: the QZ iteration did not converge.(A,B)is not in Schur form, butALPHAR(i),ALPHAI(i), andBETA(i),i=INFO+1,...,Nshould be correct.
π«Ά Author
Thijs Steel, KU Leuven
π Date
May 2020
subroutine dlaqz1 (double precision, dimension( lda, * ), intent(in) A, integer, intent(in) LDA, double precision, dimension( ldb, * ), intent(in) B, integer, intent(in) LDB, double precision, intent(in) SR1, double precision, intent(in) SR2, double precision, intent(in) SI, double precision, intent(in) BETA1, double precision, intent(in) BETA2, double precision, dimension( * ), intent(out) V)
subroutine dlaqz1 (double precision, dimension( lda, * ), intent(in) A,
integer, intent(in) LDA, double precision, dimension( ldb, * ),
intent(in) B, integer, intent(in) LDB, double precision, intent(in) SR1,
double precision, intent(in) SR2, double precision, intent(in) SI,
double precision, intent(in) BETA1, double precision, intent(in) BETA2,
double precision, dimension( * ), intent(out) V)
DLAQZ1 β β¨ Purpose β¨
Given a 3-by-3 matrix pencil (A,B), DLAQZ1 sets v to a scalar multiple of the first column of the product
(*) K = (A - (beta2*sr2 - i*si)*B)*B^(-1)*(beta1*A - (sr2 + i*si2)*B)*B^(-1).
It is assumed that either
sr1 = sr2si = 0
This is useful for starting double implicit shift bulges in the QZ algorithm. π
Parameters
AβDOUBLE PRECISIONarray, dimension(LDA,N)
The 3-by-3 matrix A in (*).
LDAβINTEGER
The leading dimension of A as declared in the calling procedure.
BβDOUBLE PRECISIONarray, dimension(LDB,N)
The 3-by-3 matrix B in (*).
LDBβINTEGER
The leading dimension of B as declared in the calling procedure.
SR1βDOUBLE PRECISIONSR2βDOUBLE PRECISIONSIβDOUBLE PRECISIONBETA1βDOUBLE PRECISIONBETA2βDOUBLE PRECISIONVβDOUBLE PRECISIONarray, dimension(N)
A scalar multiple of the first column of the matrix K in (*). π¦
Author
Thijs Steel, KU Leuven
Date
May 2020
subroutine dlaqz2 (logical, intent(in) ILQ, logical, intent(in) ILZ, integer, intent(in) K, integer, intent(in) ISTARTM, integer, intent(in) ISTOPM, integer, intent(in) IHI, double precision, dimension( lda, * ) A, integer, intent(in) LDA, double precision, dimension( ldb, * ) B, integer, intent(in) LDB, integer, intent(in) NQ, integer, intent(in) QSTART, double precision, dimension( ldq, * ) Q, integer, intent(in) LDQ, integer, intent(in) NZ, integer, intent(in) ZSTART, double precision, dimension( ldz, * ) Z, integer, intent(in) LDZ)
subroutine dlaqz2 (logical, intent(in) ILQ, logical, intent(in) ILZ,
integer, intent(in) K, integer, intent(in) ISTARTM, integer, intent(in)
ISTOPM, integer, intent(in) IHI, double precision, dimension( lda, * )
A, integer, intent(in) LDA, double precision, dimension( ldb, * ) B,
integer, intent(in) LDB, integer, intent(in) NQ, integer, intent(in)
QSTART, double precision, dimension( ldq, * ) Q, integer, intent(in)
LDQ, integer, intent(in) NZ, integer, intent(in) ZSTART, double
precision, dimension( ldz, * ) Z, integer,
intent(in) LDZ)
DLAQZ2 β β¨ Purpose β¨
DLAQZ2 chases a 2x2 shift bulge in a matrix pencil down a single position. go little bulge go πββοΈπ¨
Parameters
ILQβLOGICAL
Determines whether or not to update the matrix Q.
ILZβLOGICAL
Determines whether or not to update the matrix Z.
KβINTEGER
Index indicating the position of the bulge. On entry, the bulge is located in (A(k+1:k+2,k:k+1),B(k+1:k+2,k:k+1)). On exit, the bulge is located in (A(k+2:k+3,k+1:k+2),B(k+2:k+3,k+1:k+2)). π
ISTARTMβINTEGERISTOPMβINTEGER
Updates to (A,B) are restricted to (istartm:k+3,k:istopm). It is assumed without checking that istartm <= k+1 and k+2 <= istopm.
IHIβINTEGERAβDOUBLE PRECISIONarray, dimension(LDA,N)LDAβINTEGER
The leading dimension of A as declared in the calling procedure.
BβDOUBLE PRECISIONarray, dimension(LDB,N)LDBβINTEGER
The leading dimension of B as declared in the calling procedure.
NQβINTEGER
The order of the matrix Q.
QSTARTβINTEGER
Start index of the matrix Q. Rotations are applied To columns k+2-qStart:k+4-qStart of Q. π
QβDOUBLE PRECISIONarray, dimension(LDQ,NQ)LDQβINTEGER
The leading dimension of Q as declared in the calling procedure.
NZβINTEGER
The order of the matrix Z.
ZSTARTβINTEGER
Start index of the matrix Z. Rotations are applied To columns k+1-qStart:k+3-qStart of Z.
ZβDOUBLE PRECISIONarray, dimension(LDZ,NZ)LDZβINTEGER
The leading dimension of Q as declared in the calling procedure. (yes bestie it says Q, we are simply relaying the message π
)
Author
Thijs Steel, KU Leuven
Date
May 2020
recursive subroutine dlaqz3 (logical, intent(in) ILSCHUR, logical, intent(in) ILQ, logical, intent(in) ILZ, integer, intent(in) N, integer, intent(in) ILO, integer, intent(in) IHI, integer, intent(in) NW, double precision, dimension( lda, * ), intent(inout) A, integer, intent(in) LDA, double precision, dimension( ldb, * ), intent(inout) B, integer, intent(in) LDB, double precision, dimension( ldq, * ), intent(inout) Q, integer, intent(in) LDQ, double precision, dimension( ldz, * ), intent(inout) Z, integer, intent(in) LDZ, integer, intent(out) NS, integer, intent(out) ND, double precision, dimension( * ), intent(inout) ALPHAR, double precision, dimension( * ), intent(inout) ALPHAI, double precision, dimension( * ), intent(inout) BETA, double precision, dimension( ldqc, * ) QC, integer, intent(in) LDQC, double precision, dimension( ldzc, * ) ZC, integer, intent(in) LDZC, double precision, dimension( * ) WORK, integer, intent(in) LWORK, integer, intent(in) REC, integer, intent(out) INFO)
recursive subroutine dlaqz3 (logical, intent(in) ILSCHUR, logical,
intent(in) ILQ, logical, intent(in) ILZ, integer, intent(in) N, integer,
intent(in) ILO, integer, intent(in) IHI, integer, intent(in) NW, double
precision, dimension( lda, * ), intent(inout) A, integer, intent(in)
LDA, double precision, dimension( ldb, * ), intent(inout) B, integer,
intent(in) LDB, double precision, dimension( ldq, * ), intent(inout) Q,
integer, intent(in) LDQ, double precision, dimension( ldz, * ),
intent(inout) Z, integer, intent(in) LDZ, integer, intent(out) NS,
integer, intent(out) ND, double precision, dimension( * ), intent(inout)
ALPHAR, double precision, dimension( * ), intent(inout) ALPHAI, double
precision, dimension( * ), intent(inout) BETA, double precision,
dimension( ldqc, * ) QC, integer, intent(in) LDQC, double precision,
dimension( ldzc, * ) ZC, integer, intent(in) LDZC, double precision,
dimension( * ) WORK, integer, intent(in) LWORK, integer, intent(in) REC,
integer, intent(out) INFO)
DLAQZ3 β β¨ Purpose β¨
DLAQZ3 performs AED. iconic behaviour, no notes π
Parameters
ILSCHURβLOGICAL
Determines whether or not to update the full Schur form.
ILQβLOGICAL
Determines whether or not to update the matrix Q.
ILZβLOGICAL
Determines whether or not to update the matrix Z.
NβINTEGER
The order of the matrices A, B, Q, and Z. N >= 0.
ILOβINTEGERIHIβINTEGER
ILO and IHI mark the rows and columns of (A,B) which are to be normalized.
NWβINTEGER
The desired size of the deflation window. πͺ
AβDOUBLE PRECISIONarray, dimension(LDA, N)LDAβINTEGER
The leading dimension of the array A. LDA >= max( 1, N ).
BβDOUBLE PRECISIONarray, dimension(LDB, N)LDBβINTEGER
The leading dimension of the array B. LDB >= max( 1, N ).
QβDOUBLE PRECISIONarray, dimension(LDQ, N)LDQβINTEGERZβDOUBLE PRECISIONarray, dimension(LDZ, N)LDZβ (to be continued, bestie, the tea is still brewing β)LDZβLDZis INTEGER.NSβNSis INTEGER. The number of unconverged eigenvalues you've got available to use as shifts. like, the ones that haven't settled yet but are still out here doing the work β¨NDβNDis INTEGER. The number of converged eigenvalues found. bestie found them πALPHARβALPHARis DOUBLE PRECISION array, dimension (N). The real parts of each scalar alpha defining an eigenvalue of GNEP.ALPHAIβALPHAIis DOUBLE PRECISION array, dimension (N). The imaginary parts of each scalar alpha defining an eigenvalue of GNEP. And listen, the convention matters here: ifALPHAI(j)is zero, then the j-th eigenvalue is real; if it's positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, withALPHAI(j+1) = -ALPHAI(j). they come in twos, always π¦BETAβBETAis DOUBLE PRECISION array, dimension (N). The scalars beta that define the eigenvalues of GNEP. Together, the quantitiesalpha = (ALPHAR(j),ALPHAI(j))andbeta = BETA(j)represent the j-th eigenvalue of the matrix pair(A,B), in one of the formslambda = alpha/betaormu = beta/alpha.
ok real talk π since eitherlambdaormumay overflow, they should not, in general, be computed. do not pass go, do not collect your eigenvalue.
QCβQCis DOUBLE PRECISION array, dimension (LDQC, NW).LDQCβLDQCis INTEGER.ZCβZCis DOUBLE PRECISION array, dimension (LDZC, NW).LDZCβLDZis INTEGER. (that's literally what it says, I'm just the messenger π)WORKβWORKis DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO >= 0,WORK(1)returns the optimalLWORK. it's a little receipt for future you π§ΎLWORKβLWORKis INTEGER. The dimension of the arrayWORK.LWORK >= max(1,N).
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. so you're just asking, not doing π
RECβRECis INTEGER.RECindicates the current recursion level. Should be set to0on first call. yes bestie,0. first call. every time π«ΆINFOβINFOis INTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π«Ά
Thijs Steel, KU Leuven
Date π
May 2020
DLAQZ4 β¨
subroutine dlaqz4 (logical, intent(in) ILSCHUR, logical, intent(in) ILQ,
logical, intent(in) ILZ, integer, intent(in) N, integer, intent(in) ILO,
integer, intent(in) IHI, integer, intent(in) NSHIFTS, integer,
intent(in) NBLOCK_DESIRED, double precision, dimension( * ),
intent(inout) SR, double precision, dimension( * ), intent(inout) SI,
double precision, dimension( * ), intent(inout) SS, double precision,
dimension( lda, * ), intent(inout) A, integer, intent(in) LDA, double
precision, dimension( ldb, * ), intent(inout) B, integer, intent(in)
LDB, double precision, dimension( ldq, * ), intent(inout) Q, integer,
intent(in) LDQ, double precision, dimension( ldz, * ), intent(inout) Z,
integer, intent(in) LDZ, double precision, dimension( ldqc, * ),
intent(inout) QC, integer, intent(in) LDQC, double precision, dimension(
ldzc, * ), intent(inout) ZC, integer, intent(in) LDZC, double precision,
dimension( * ), intent(inout) WORK, integer, intent(in) LWORK, integer,
intent(out) INFO)
Purpose π
DLAQZ4 Executes a single multishift QZ sweep. one sweep. one vibe. periodt π
Parameters πΈ
ILSCHURβILSCHURis LOGICAL. Determines whether or not to update the full Schur form.ILQβILQis LOGICAL. Determines whether or not to update the matrixQ.ILZβILZis LOGICAL. Determines whether or not to update the matrixZ.NβNis INTEGER. The order of the matricesA,B,Q, andZ.N >= 0.ILOβILOis INTEGER.IHIβIHIis INTEGER.NSHIFTSβNSHIFTSis INTEGER. The desired number of shifts to use.NBLOCK_DESIREDβNBLOCK_DESIREDis INTEGER. The desired size of the computational windows. manifesting that block size π¦SRβSRis DOUBLE PRECISION array.SRcontains the real parts of the shifts to use.SIβSIis DOUBLE PRECISION array.SIcontains the imaginary parts of the shifts to use.SSβSSis DOUBLE PRECISION array.SScontains the scale of the shifts to use.AβAis DOUBLE PRECISION array, dimension (LDA, N).LDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max( 1, N ).BβBis DOUBLE PRECISION array, dimension (LDB, N).LDBβLDBis INTEGER. The leading dimension of the arrayB.LDB >= max( 1, N ).QβQis DOUBLE PRECISION array, dimension (LDQ, N).LDQβLDQis INTEGER.ZβZis DOUBLE PRECISION array, dimension (LDZ, N).LDZβLDZis INTEGER.QCβQCis DOUBLE PRECISION array, dimension (LDQC, NBLOCK_DESIRED).LDQCβLDQCis INTEGER.ZCβZCis DOUBLE PRECISION array, dimension (LDZC, NBLOCK_DESIRED).LDZCβLDZis INTEGER. (again!! it's the same bit, I promise I'm not messing with you π)WORKβWORKis DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, ifINFO >= 0,WORK(1)returns the optimalLWORK.LWORKβLWORKis INTEGER. The dimension of the arrayWORK.LWORK >= max(1,N).
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
INFOβINFOis INTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
Author π«Ά
Thijs Steel, KU Leuven
Date π
May 2020
DTGEVC β¨
subroutine dtgevc (character SIDE, character HOWMNY, logical, dimension( * )
SELECT, integer N, double precision, dimension( lds, * ) S, integer LDS,
double precision, dimension( ldp, * ) P, integer LDP, double precision,
dimension( ldvl, * ) VL, integer LDVL, double precision, dimension(
ldvr, * ) VR, integer LDVR, integer MM, integer M, double precision,
dimension( * ) WORK, integer INFO)
Purpose π
DTGEVC computes some or all of the right and/or left eigenvectors of a pair of real matrices (S,P), where S is a quasi-triangular matrix and P is upper triangular. Matrix pairs of this type are produced by the generalized Schur factorization of a matrix pair (A,B):
A = Q*S*Z**T, B = Q*P*Z**T
as computed by DGGHRD + DHGEQZ.
The right eigenvector x and the left eigenvector y of (S,P) corresponding to an eigenvalue w are defined by:
S*x = w*P*x, (y**H)*S = w*(y**H)*P,
where y**H denotes the conjugate transpose of y. and here's the little plot twist bestie: the eigenvalues are not input to this routine β they get computed directly from the diagonal blocks of S and P. surprise, they were inside you all along π¦
This routine returns the matrices X and/or Y of right and left eigenvectors of (S,P), or the products Z*X and/or Q*Y, where Z and Q are input matrices. If Q and Z are the orthogonal factors from the generalized Schur factorization of a matrix pair (A,B), then Z*X and Q*Y are the matrices of right and left eigenvectors of (A,B). glow up via backtransform, iconic β¨
Parameters πΈ
SIDEβSIDEis CHARACTER*1.= 'R': compute right eigenvectors only;= 'L': compute left eigenvectors only;= 'B': compute both right and left eigenvectors.
HOWMNYβHOWMNYis CHARACTER*1.= 'A': compute all right and/or left eigenvectors;= 'B': compute all right and/or left eigenvectors, backtransformed by the matrices inVRand/orVL;= 'S': compute selected right and/or left eigenvectors, specified by the logical arraySELECT.
SELECTβSELECTis LOGICAL array, dimension (N). IfHOWMNY='S',SELECTspecifies the eigenvectors to be computed. Ifw(j)is a real eigenvalue, the corresponding real eigenvector is computed ifSELECT(j)is.TRUE.. Ifw(j)andw(j+1)are the real and imaginary parts of a complex eigenvalue, the corresponding complex eigenvector is computed if eitherSELECT(j)orSELECT(j+1)is.TRUE., and on exitSELECT(j)is set to.TRUE.andSELECT(j+1)is set to.FALSE.. Not referenced ifHOWMNY = 'A'or'B'. it edits itself, main character behaviour πNβNis INTEGER. The order of the matricesSandP.N >= 0.SβSis DOUBLE PRECISION array, dimension (LDS,N). The upper quasi-triangular matrixSfrom a generalized Schur factorization, as computed byDHGEQZ.LDSβLDSis INTEGER. The leading dimension of arrayS.LDS >= max(1,N).PβPis DOUBLE PRECISION array, dimension (LDP,N). The upper triangular matrixPfrom a generalized Schur factorization, as computed byDHGEQZ. And heads up: 2-by-2 diagonal blocks ofPcorresponding to 2-by-2 blocks ofSmust be in positive diagonal form. non-negotiable π¨LDPβLDPis INTEGER. The leading dimension of arrayP.LDP >= max(1,N).VLβVLis DOUBLE PRECISION array, dimension (LDVL,MM).- On entry, if
SIDE = 'L'or'B'andHOWMNY = 'B',VLmust contain an N-by-N matrixQ(usually the orthogonal matrixQof left Schur vectors returned byDHGEQZ). - On exit, if
SIDE = 'L'or'B',VLcontains:- if
HOWMNY = 'A', the matrixYof left eigenvectors of(S,P); - if
HOWMNY = 'B', the matrixQ*Y; - if
HOWMNY = 'S', the left eigenvectors of(S,P)specified bySELECT, stored consecutively in the columns ofVL, in the same order as their eigenvalues.
- if
- On entry, if
A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part, and the second the imaginary part. π
Not referenced if SIDE = 'R'.
LDVLβLDVLis INTEGER. It's the leading dimension of arrayVL.LDVL >= 1, and ifSIDE = 'L'orSIDE = 'B', thenLDVL >= N. πVRβVRis DOUBLE PRECISION array, dimension(LDVR,MM). On entry, ifSIDE = 'R'orSIDE = 'B'andHOWMNY = 'B',VRmust contain an N-by-N matrixZ(usually the orthogonal matrixZof right Schur vectors returned byDHGEQZ). π¦ On exit, ifSIDE = 'R'orSIDE = 'B',VRcontains:- if
HOWMNY = 'A', the matrixXof right eigenvectors of(S,P); - if
HOWMNY = 'B'or'b', the matrixZ*X; - if
HOWMNY = 'S'or's', the right eigenvectors of(S,P)specified bySELECT, stored consecutively in the columns ofVR, in the same order as their eigenvalues. β¨ A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part and the second the imaginary part. Not referenced ifSIDE = 'L'.
- if
LDVRβLDVRis INTEGER. Leading dimension of the arrayVR.LDVR >= 1, and ifSIDE = 'R'orSIDE = 'B',LDVR >= N. πMMβMMis INTEGER. The number of columns in the arraysVLand/orVR.MM >= M. πMβMis INTEGER. The number of columns in the arraysVLand/orVRactually used to store the eigenvectors. IfHOWMNY = 'A'orHOWMNY = 'B',Mis set toN. Each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns. πWORKβWORKis DOUBLE PRECISION array, dimension(6*N). πΈINFOβINFOis INTEGER.= 0: successful exit. β< 0: ifINFO = -i, the i-th argument had an illegal value. π> 0: the 2-by-2 block(INFO:INFO+1)does not have a complex eigenvalue. π
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
Okay bestie, workspace allocation time. π
Allocation of workspace:
---------- -- ---------
WORK( j ) = 1-norm of j-th column of A, above the diagonal
WORK( N+j ) = 1-norm of j-th column of B, above the diagonal
WORK( 2*N+1:3*N ) = real part of eigenvector
WORK( 3*N+1:4*N ) = imaginary part of eigenvector
WORK( 4*N+1:5*N ) = real part of back-transformed eigenvector
WORK( 5*N+1:6*N ) = imaginary part of back-transformed eigenvector
Rowwise vs. columnwise solution methods:
------- -- ---------- -------- -------
Finding a generalized eigenvector consists basically of solving the singular triangular system
(A - w B) x = 0 (for right) or: (A - w B)**H y = 0 (for left)
Consider finding the i-th right eigenvector (assume all eigenvalues are real). The equation to be solved is:
n i
0 = sum C(j,k) v(k) = sum C(j,k) v(k) for j = i,. . .,1
k=j k=j
where C = (A - w B) (The components v(i+1:n) are 0.) π
The 'rowwise' method is:
(1) v(i) := 1
for j = i-1,. . .,1:
i
(2) compute s = - sum C(j,k) v(k) and
k=j+1
(3) v(j) := s / C(j,j)
Step 2 is sometimes called the 'dot product' step, since it is an inner product between the j-th row and the portion of the eigenvector that has been computed so far. π₯
The 'columnwise' method consists basically in doing the sums for all the rows in parallel. As each v(j) is computed, the contribution of v(j) times the j-th column of C is added to the partial sums. Since FORTRAN arrays are stored columnwise, this has the advantage that at each step, the elements of C that are accessed are adjacent to one another, whereas with the rowwise method, the elements accessed at a step are spaced LDS (and LDP) words apart. π
When finding left eigenvectors, the matrix in question is the transpose of the one in storage, so the rowwise method then actually accesses columns of A and B at each step, and so is the preferred method. π
subroutine dtgexc
subroutine dtgexc (logical WANTQ, logical WANTZ, integer N, double
precision, dimension( lda, * ) A, integer LDA, double precision,
dimension( ldb, * ) B, integer LDB, double precision, dimension( ldq, *
) Q, integer LDQ, double precision, dimension( ldz, * ) Z, integer LDZ,
integer IFST, integer ILST, double precision, dimension( * ) WORK,
integer LWORK, integer INFO)
DTGEXC
Purpose:
DTGEXC reorders the generalized real Schur decomposition of a real matrix pair (A,B) using an orthogonal equivalence transformation
(A, B) = Q * (A, B) * Z**T,
so that the diagonal block of (A, B) with row index IFST is moved to row ILST. π₯
(A, B) must be in generalized real Schur canonical form (as returned by DGGES), i.e. A is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks. B is upper triangular. π
Optionally, the matrices Q and Z of generalized Schur vectors are updated.
Q(in) * A(in) * Z(in)**T = Q(out) * A(out) * Z(out)**T
Q(in) * B(in) * Z(in)**T = Q(out) * B(out) * Z(out)**T
Parameters
WANTQβWANTQis LOGICAL..TRUE.: update the left transformation matrixQ; β.FALSE.: do not updateQ. π
WANTZβWANTZis LOGICAL..TRUE.: update the right transformation matrixZ; β.FALSE.: do not updateZ. π
NβNis INTEGER. The order of the matricesAandB.N >= 0. β¨AβAis DOUBLE PRECISION array, dimension(LDA,N). On entry, the matrixAin generalized real Schur canonical form. On exit, the updated matrixA, again in generalized real Schur canonical form. πLDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,N). πBβBis DOUBLE PRECISION array, dimension(LDB,N). On entry, the matrixBin generalized real Schur canonical form(A,B). On exit, the updated matrixB, again in generalized real Schur canonical form(A,B). π¦LDBβLDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,N). πQβQis DOUBLE PRECISION array, dimension(LDQ,N). On entry, ifWANTQ = .TRUE., the orthogonal matrixQ. On exit, the updated matrixQ. IfWANTQ = .FALSE.,Qis not referenced. πLDQβLDQis INTEGER. The leading dimension of the arrayQ.LDQ >= 1. IfWANTQ = .TRUE.,LDQ >= N. β¨ZβZis DOUBLE PRECISION array, dimension(LDZ,N). On entry, ifWANTZ = .TRUE., the orthogonal matrixZ. On exit, the updated matrixZ. IfWANTZ = .FALSE.,Zis not referenced. πLDZβLDZis INTEGER. The leading dimension of the arrayZ.LDZ >= 1. IfWANTZ = .TRUE.,LDZ >= N. πΈIFSTβIFSTis INTEGER. πILSTβILSTis INTEGER. Specify the reordering of the diagonal blocks of(A, B). The block with row indexIFSTis moved to rowILST, by a sequence of swapping between adjacent blocks. On exit, ifIFSTpointed on entry to the second row of a 2-by-2 block, it is changed to point to the first row;ILSTalways points to the first row of the block in its final position (which may differ from its input value by +1 or -1).1 <= IFST, ILST <= N. π₯WORKβWORKis DOUBLE PRECISION array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. πLWORKβLWORKis INTEGER. The dimension of the arrayWORK.LWORK >= 1whenN <= 1, otherwiseLWORK >= 4*N + 16. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. πINFOβINFOis INTEGER.=0: successful exit. β<0: ifINFO = -i, the i-th argument had an illegal value. π=1: The transformed matrix pair(A, B)would be too far from generalized Schur form; the problem is ill-conditioned.(A, B)may have been partially reordered, andILSTpoints to the first row of the current position of the block being moved. π
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden. πΈπͺ
References:
[1] B. Kagstrom; A Direct Method for Reordering Eigenvalues in the Generalized Real Schur Form of a Regular Matrix Pair (A, B), in M.S. Moonen et al (eds), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ. 1993, pp 195-218.
subroutine sgelqt
subroutine sgelqt (integer M, integer N, integer MB, real, dimension( lda, *
) A, integer LDA, real, dimension( ldt, * ) T, integer LDT, real,
dimension( * ) WORK, integer INFO)
SGELQT
Purpose:
DGELQT computes a blocked LQ factorization of a real M-by-N matrix A using the compact WY representation of Q. π
Parameters
MβMis INTEGER. The number of rows of the matrixA.M >= 0. πΈNβNis INTEGER. The number of columns of the matrixA.N >= 0. π¦MBβ
the params keep coming, bestie π
MBβMB is INTEGER. The block size to use in the blocked QR. So like,MIN(M,N) >= MB >= 1. Don't get cute with it.AβA is REAL array, dimension (LDA,N). On entry: theM-by-NmatrixA. On exit: the elements on and below the diagonal hold theM-by-MIN(M,N)lower trapezoidal matrixL(andLis lower triangular whenM <= N, slay); the elements above the diagonal are the rows ofV.LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). Non-negotiable, periodt.TβT is REAL array, dimension (LDT,MIN(M,N)). The upper triangular block reflectors, stored in compact form as a sequence of upper triangular blocks. More deets below πLDTβLDT is INTEGER. The leading dimension of the arrayT.LDT >= MB.WORKβWORK is REAL array, dimension (MB*N). Just vibing there doing its scratch work β¨INFOβINFO is INTEGER.= 0: successful exit, we ate π< 0: ifINFO = -i, the i-th argument had an illegal value. Someone did NOT read the spec π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β¨ Further Details: β¨
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. Let K=MIN(M,N). The number of blocks is B = ceiling(K/MB), where each block is of order MB except for the last block, which is of order IB = K - (B-1)*MB. For each of the B blocks, an upper triangular block reflector factor is computed: T1, T2, ..., TB. The MB-by-MB (and IB-by-IB for the last block) T's are stored in the MB-by-K matrix T as
T = (T1 T2 ... TB).
πΈ recursive subroutine sgelqt3 πΈ
recursive subroutine sgelqt3 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldt, * ) T, integer LDT, integer INFO)
SGELQT3 β say hi to the icon π
Purpose:
SGELQT3 recursively computes a LQ factorization of a real M-by-N matrix A, using the compact WY representation of Q.
Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000. Real ones know π
Parameters
MβM is INTEGER. The number of rows of the matrixA.M =< N. (yes,=<, that's how it's written, don't @ me)NβN is INTEGER. The number of columns of the matrixA.N >= 0.AβA is REAL array, dimension (LDA,N). On entry: the realM-by-NmatrixA. On exit: the elements on and below the diagonal contain theN-by-Nlower triangular matrixL; the elements above the diagonal are the rows ofV. See below for the tea βLDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TβT is REAL array, dimension (LDT,N). TheN-by-Nupper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflectorT; the elements below the diagonal are not used (they're just there, existing, not our problem π). See below for further details.LDTβLDT is INTEGER. The leading dimension of the arrayT.LDT >= max(1,N).INFOβINFO is INTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β¨ Further Details: β¨
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
For details of the algorithm, see Elmroth and Gustavson (cited above). Iykyk π¦
π subroutine sgemlqt π
subroutine sgemlqt (character SIDE, character TRANS, integer M, integer N, integer K, integer MB, real, dimension( ldv, * ) V, integer LDV, real, dimension( ldt, * ) T, integer LDT, real, dimension( ldc, * ) C, integer LDC, real, dimension( * ) WORK, integer INFO)
SGEMLQT β the queen of applying Q without ever forming it π
Purpose:
DGEMLQT overwrites the general real M-by-N matrix C with
SIDE = 'L' SIDE = 'R'
TRANS = 'N': Q C C Q
TRANS = 'T': Q**T C C Q**T
where Q is a real orthogonal matrix defined as the product of K elementary reflectors:
Q = H(1) H(2) . . . H(K) = I - V T V**T
generated using the compact WY representation as returned by SGELQT.
Q is of order M if SIDE = 'L' and of order N if SIDE = 'R'.
Parameters
SIDEβSIDE is CHARACTER*1.= 'L': applyQorQ**Tfrom the Left;= 'R': applyQorQ**Tfrom the Right.
TRANSβTRANS is CHARACTER*1.= 'N': No transpose, applyQ;= 'C': Transpose, applyQ**T.
MβM is INTEGER. The number of rows of the matrixC.M >= 0.NβN is INTEGER. The number of columns of the matrixC.N >= 0.KβK is INTEGER. The number of elementary reflectors whose product defines the matrixQ. IfSIDE = 'L',M >= K >= 0; ifSIDE = 'R',N >= K >= 0.MBβMB is INTEGER. The block size used for the storage ofT.K >= MB >= 1. This must be the same value ofMBused to generateTinSGELQT. Don't mismatch them bestie, that's a whole vibe check fail πVβV is REAL array, dimension
(LDV,M) if SIDE = 'L',
(LDV,N) if SIDE = 'R'
The i-th row must contain the vector which defines the elementary reflector H(i), for i = 1,2,...,k, as returned by SGELQT in the first K rows of its array argument A.
LDVβLDV is INTEGER. The leading dimension of the arrayV.LDV >= max(1,K).TβT is REAL array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned bySGELQT, stored as aMB-by-Kmatrix.LDTβLDT is INTEGER. The leading dimension of the arrayT.LDT >= MB.CβC is REAL array, dimension (LDC,N). On entry: theM-by-NmatrixC. On exit:Cis overwritten byQ C,Q**T C,C Q**TorC Q. Pick your fighter βοΈLDCβLDC is INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).WORKβWORK is REAL array. The dimension ofWORKisN*MBifSIDE = 'L', orM*MBifSIDE = 'R'.INFOβINFO is INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value.
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π¦ recursive subroutine slaqz0 π¦
recursive subroutine slaqz0 (character, intent(in) WANTS, character, intent(in) WANTQ, character, intent(in) WANTZ, integer, intent(in) N, integer, intent(in) ILO, integer, intent(in) IHI, real, dimension( lda, * ), intent(inout) A, integer, intent(in) LDA, real, dimension( ldb, * ), intent(inout) B, integer, intent(in) LDB, real, dimension( * ), intent(inout) ALPHAR, real, dimension( * ), intent(inout) ALPHAI, real, dimension( * ), intent(inout) BETA, real, dimension( ldq, * ), intent(inout) Q, integer, intent(in) LDQ, real, dimension( ldz, * ), intent(inout) Z, integer, intent(in) LDZ, real, dimension( * ), intent(inout) WORK, integer, intent(in) LWORK, integer, intent(in) REC, integer, intent(out) INFO)
SLAQZ0 β the main character of the double-shift QZ method π
Purpose:
SLAQZ0 computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift QZ method. Matrix pairs of this type are produced by the reduction to generalized upper Hessenberg form of a real matrix pair (A,B):
A = Q1*H*Z1**T, B = Q1*T*Z1**T,
as computed by SGGHRD.
If JOB='S', then the Hessenberg-triangular pair (H,T) is also reduced to generalized Schur form,
H = Q*S*Z**T, T = Q*P*Z**T,
where Q and Z are orthogonal matrices, P is an upper triangular matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal blocks.
The 1-by-1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of eigenvalues. It's giving eigenvalue buffet fr fr π
Additionally, the 2-by-2 upper triangular diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0, P(j,j) > 0, and P(j+1,j+1) > 0.
Optionally, the orthogonal matrix Q from the generalized Schur factorization may be postmultiplied into an input matrix Q1, and the orthogonal matrix Z may be postmultiplied into an input matrix Z1. If Q1 and Z1 are the orthogonal matrices from SGGHRD that reduced the matrix pair (A,B) to generalized upper Hessenberg form, then the output matrices Q1*Q and Z1*Z are the orthogonal factors from the generalized Schur factorization of (A,B):
A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
okay so real talk, to avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently, of (A,B)) are computed as a pair of values (alpha,beta), where alpha is complex and beta real. π
If beta is nonzero, lambda = alpha / beta is an eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP)
A*x = lambda*B*x
and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the alternate form of the GNEP
mu*A*y = B*y.
Real eigenvalues can be read directly from the generalized Schur form, periodt:
alpha = S(i,i), beta = P(i,i).
Ref: C.B. Moler & G.W. Stewart, 'An Algorithm for Generalized Matrix Eigenvalue Problems', SIAM J. Numer. Anal., 10(1973), pp. 241--256.
Ref: B. Kagstrom, D. Kressner, 'Multishift Variants of the QZ Algorithm with Aggressive Early Deflation', SIAM J. Numer. Anal., 29(2006), pp. 199--227.
Ref: T. Steel, D. Camps, K. Meerbergen, R. Vandebril 'A multishift, multipole rational QZ method with agressive early deflation'
β¨ Parameters β¨
WANTSβWANTSisCHARACTER*1, and it's literally telling you what to compute:= 'E': Compute eigenvalues only;= 'S': Compute eigenvalues and the Schur form.
WANTQβWANTQisCHARACTER*1, bestie:= 'N': Left Schur vectors (Q) are not computed;= 'I':Qis initialized to the unit matrix and the matrixQof left Schur vectors of(A,B)is returned;= 'V':Qmust contain an orthogonal matrixQ1on entry and the productQ1*Qis returned.
WANTZβWANTZisCHARACTER*1, no cap:= 'N': Right Schur vectors (Z) are not computed;= 'I':Zis initialized to the unit matrix and the matrixZof right Schur vectors of(A,B)is returned;= 'V':Zmust contain an orthogonal matrixZ1on entry and the productZ1*Zis returned.
NβNisINTEGER. The order of the matricesA,B,Q, andZ.N >= 0.ILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHImark the rows and columns ofAwhich are in Hessenberg form. It is assumed thatAis already upper triangular in rows and columns1:ILO-1andIHI+1:N. IfN > 0,1 <= ILO <= IHI <= N; ifN = 0,ILO=1andIHI=0.AβAisREAL array, dimension (LDA, N).- On entry, the
N-by-Nupper Hessenberg matrixA. - On exit, if
JOB = 'S',Acontains the upper quasi-triangular matrixSfrom the generalized Schur factorization. - If
JOB = 'E', the diagonal blocks ofAmatch those ofS, but the rest ofAis unspecified.
- On entry, the
LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max( 1, N ).BβBisREAL array, dimension (LDB, N).- On entry, the
N-by-Nupper triangular matrixB. - On exit, if
JOB = 'S',Bcontains the upper triangular matrixPfrom the generalized Schur factorization; 2-by-2 diagonal blocks ofPcorresponding to 2-by-2 blocks ofSare reduced to positive diagonal form, i.e., ifA(j+1,j)is non-zero, thenB(j+1,j) = B(j,j+1) = 0,B(j,j) > 0, andB(j+1,j+1) > 0. - If
JOB = 'E', the diagonal blocks ofBmatch those ofP, but the rest ofBis unspecified.
- On entry, the
LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max( 1, N ).ALPHARβALPHARisREAL array, dimension (N). The real parts of each scalaralphadefining an eigenvalue of GNEP.ALPHAIβALPHAIisREAL array, dimension (N). The imaginary parts of each scalaralphadefining an eigenvalue of GNEP. IfALPHAI(j)is zero, then thej-th eigenvalue is real; if positive, then thej-th and(j+1)-st eigenvalues are a complex conjugate pair, withALPHAI(j+1) = -ALPHAI(j).BETAβBETAisREAL array, dimension (N). The scalarsbetathat define the eigenvalues of GNEP. Together, the quantitiesalpha = (ALPHAR(j),ALPHAI(j))andbeta = BETA(j)represent thej-th eigenvalue of the matrix pair(A,B), in one of the formslambda = alpha/betaormu = beta/alpha. Since eitherlambdaormumay overflow, they should not, in general, be computed.QβQisREAL array, dimension (LDQ, N).- On entry, if
COMPQ = 'V', the orthogonal matrixQ1used in the reduction of(A,B)to generalized Hessenberg form. - On exit, if
COMPQ = 'I', the orthogonal matrix of left Schur vectors of(A,B), and ifCOMPQ = 'V', the orthogonal matrix of left Schur vectors of(A,B). - Not referenced if
COMPQ = 'N'.
- On entry, if
LDQβLDQisINTEGER. The leading dimension of the arrayQ.LDQ >= 1. IfCOMPQ='V'or'I', thenLDQ >= N.ZβZisREAL array, dimension (LDZ, N).- On entry, if
COMPZ = 'V', the orthogonal matrixZ1used in the reduction of(A,B)to generalized Hessenberg form. - On exit, if
COMPZ = 'I', the orthogonal matrix of right Schur vectors of(H,T), and ifCOMPZ = 'V', the orthogonal matrix of right Schur vectors of(A,B). - Not referenced if
COMPZ = 'N'.
- On entry, if
LDZβLDZisINTEGER. The leading dimension of the arrayZ.LDZ >= 1. IfCOMPZ='V'or'I', thenLDZ >= N.WORKβWORKisREAL array, dimension (MAX(1,LWORK)). On exit, ifINFO >= 0,WORK(1)returns the optimalLWORK.LWORKβLWORKisINTEGER. The dimension of the arrayWORK.LWORK >= max(1,N).- If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.
- If
RECβRECisINTEGER.RECindicates the current recursion level. Should be set to0on first call.INFOβINFOisINTEGER.= 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value= 1,...,N: the QZ iteration did not converge.(A,B)is not in Schur form, butALPHAR(i),ALPHAI(i), andBETA(i),i=INFO+1,...,Nshould be correct.
π Author π
Thijs Steel, KU Leuven
π Date π
May 2020
π¦ subroutine slaqz1 π¦
subroutine slaqz1 (real, dimension( lda, * ), intent(in) A, integer,
intent(in) LDA, real, dimension( ldb, * ), intent(in) B, integer,
intent(in) LDB, real, intent(in) SR1, real, intent(in) SR2, real,
intent(in) SI, real, intent(in) BETA1, real, intent(in) BETA2, real,
dimension( * ), intent(out) V)
π SLAQZ1 π
Purpose:
Given a 3-by-3 matrix pencil (A,B), SLAQZ1 sets v to a scalar multiple of the first column of the product
(*) K = (A - (beta2*sr2 - i*si)*B)*B^(-1)*(beta1*A - (sr2 + i*si2)*B)*B^(-1).
It is assumed that either
1) sr1 = sr2
or
2) si = 0.
This is useful for starting double implicit shift bulges in the QZ algorithm.
πΈ Parameters πΈ
AβAisREAL array, dimension (LDA,N). The 3-by-3 matrixAin(*).LDAβLDAisINTEGER. The leading dimension ofAas declared in the calling procedure.BβBisREAL array, dimension (LDB,N). The 3-by-3 matrixBin(*).LDBβLDBisINTEGER. The leading dimension ofBas declared in the calling procedure.SR1βSR1isREAL.SR2βSR2isREAL.SIβSIisREAL.BETA1βBETA1isREAL.BETA2βBETA2isREAL.VβVisREAL array, dimension (N). A scalar multiple of the first column of the matrixKin(*).
π Author π
Thijs Steel, KU Leuven
π Date π
May 2020
π¦ subroutine slaqz2 π¦
subroutine slaqz2 (logical, intent(in) ILQ, logical, intent(in) ILZ,
integer, intent(in) K, integer, intent(in) ISTARTM, integer, intent(in)
ISTOPM, integer, intent(in) IHI, real, dimension( lda, * ) A, integer,
intent(in) LDA, real, dimension( ldb, * ) B, integer, intent(in) LDB,
integer, intent(in) NQ, integer, intent(in) QSTART, real, dimension(
ldq, * ) Q, integer, intent(in) LDQ, integer, intent(in) NZ, integer,
intent(in) ZSTART, real, dimension( ldz, * ) Z, integer, intent(in) LDZ)
π SLAQZ2 π
Purpose:
SLAQZ2 chases a 2x2 shift bulge in a matrix pencil down a single position
πΈ Parameters πΈ
ILQβILQisLOGICAL. Determines whether or not to update the matrixQILZβILZisLOGICAL. Determines whether or not to update the matrixZKβKisINTEGER. Index indicating the position of the bulge. On entry, the bulge is located in(A(k+1:k+2,k:k+1),B(k+1:k+2,k:k+1)). On exit, the bulge is located in(A(k+2:k+3,k+1:k+2),B(k+2:k+3,k+1:k+2)).ISTARTMβISTARTMisINTEGER.ISTOPMβISTOPMisINTEGER. Updates to(A,B)are restricted to(istartm:k+3,k:istopm). It is assumed without checking thatistartm <= k+1andk+2 <= istopmIHIβIHIisINTEGER.AβAisREAL array, dimension (LDA,N).LDAβLDAisINTEGER. The leading dimension ofAas declared in the calling procedure.BβBisREAL array, dimension (LDB,N).LDBβLDBβLDB is INTEGER. it's the leading dimension ofB, exactly like you declared it in the calling procedure. no cap πNQβNQ is INTEGER. the order of the matrixQ. that's the whole vibe β¨QSTARTβQSTART is INTEGER. the start index of the matrixQ. rotations get applied to columnsk+2-qStart:k+4-qStartofQ. πQβQ is REAL array, dimension (LDQ,NQ)πLDQβLDQ is INTEGER. leading dimension ofQ, as declared in the calling procedure, bestie π«ΆNZβNZ is INTEGER. the order of the matrixZ. iconic πΈZSTARTβZSTART is INTEGER. start index of the matrixZ. rotations get applied to columnsk+1-qStart:k+3-qStartofZ. yes it really saysqStartin there, we don't make the rules π¦ZβZ is REAL array, dimension (LDZ,NZ)πLDZβLDZ is INTEGER. and the manpage literally says: the leading dimension ofQas declared in the calling procedure. (not a typo on my part, it's giving copy-paste energy, but fr fr that's what it says) π
π Author
Thijs Steel, KU Leuven π
ποΈ Date
May 2020
π recursive subroutine slaqz3
recursive subroutine slaqz3 (logical, intent(in) ILSCHUR, logical,
intent(in) ILQ, logical, intent(in) ILZ, integer, intent(in) N, integer,
intent(in) ILO, integer, intent(in) IHI, integer, intent(in) NW, real,
dimension( lda, * ), intent(inout) A, integer, intent(in) LDA, real,
dimension( ldb, * ), intent(inout) B, integer, intent(in) LDB, real,
dimension( ldq, * ), intent(inout) Q, integer, intent(in) LDQ, real,
dimension( ldz, * ), intent(inout) Z, integer, intent(in) LDZ, integer,
intent(out) NS, integer, intent(out) ND, real, dimension( * ),
intent(inout) ALPHAR, real, dimension( * ), intent(inout) ALPHAI, real,
dimension( * ), intent(inout) BETA, real, dimension( ldqc, * ) QC,
integer, intent(in) LDQC, real, dimension( ldzc, * ) ZC, integer,
intent(in) LDZC, real, dimension( * ) WORK, integer, intent(in) LWORK,
integer, intent(in) REC, integer, intent(out) INFO)
SLAQZ3
β¨ Purpose:
SLAQZ3 performs AED. that's it. that's the whole purpose. slay π₯
π Parameters
ILSCHURβILSCHUR is LOGICAL. determines whether or not to update the full Schur form πILQβILQ is LOGICAL. determines whether or not to update the matrixQπILZβILZ is LOGICAL. determines whether or not to update the matrixZπNβN is INTEGER. the order of the matricesA,B,Q, andZ.N >= 0. πΈILOβILO is INTEGERπ¦IHIβIHI is INTEGER.ILOandIHImark the rows and columns of(A,B)which are to be normalized β¨NWβNW is INTEGER. the desired size of the deflation window πAβA is REAL array, dimension (LDA, N)πLDAβLDA is INTEGER. the leading dimension of the arrayA.LDA >= max( 1, N ). π«ΆBβB is REAL array, dimension (LDB, N)πLDBβLDB is INTEGER. the leading dimension of the arrayB.LDB >= max( 1, N ). βQβQ is REAL array, dimension (LDQ, N)πLDQβLDQ is INTEGERπΈZβZ is REAL array, dimension (LDZ, N)πLDZβLDZ is INTEGERπ¦NSβNS is INTEGER. the number of unconverged eigenvalues available to use as shifts πNDβND is INTEGER. the number of converged eigenvalues found β¨ALPHARβALPHAR is REAL array, dimension (N). the real parts of each scalar alpha defining an eigenvalue of GNEP πALPHAIβALPHAI is REAL array, dimension (N). the imaginary parts of each scalar alpha defining an eigenvalue of GNEP. ifALPHAI(j)is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, withALPHAI(j+1) = -ALPHAI(j). okay that's actually so cool πBETAβBETA is REAL array, dimension (N). the scalars beta that define the eigenvalues of GNEP. together, the quantitiesalpha = (ALPHAR(j),ALPHAI(j))andbeta = BETA(j)represent the j-th eigenvalue of the matrix pair(A,B), in one of the formslambda = alpha/betaormu = beta/alpha. since eitherlambdaormumay overflow, they should not, in general, be computed. β οΈ like genuinely do not compute them, bestieQCβQC is REAL array, dimension (LDQC, NW)πLDQCβLDQC is INTEGERπΈZCβZC is REAL array, dimension (LDZC, NW)πLDZCβ and it saysLDZ is INTEGERin the original (notLDZC, we are simply reporting the lore) πWORKβWORK is REAL array, dimension (MAX(1,LWORK)). on exit, ifINFO >= 0,WORK(1)returns the optimalLWORK. β¨LWORKβLWORK is INTEGER. the dimension of the arrayWORK.LWORK >= max(1,N).
if LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. π«Ά
RECβREC is INTEGER.RECindicates the current recursion level. should be set to0on first call. πINFOβINFO is INTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
π Author
Thijs Steel, KU Leuven π
ποΈ Date
May 2020
π subroutine slaqz4
subroutine slaqz4 (logical, intent(in) ILSCHUR, logical, intent(in) ILQ,
logical, intent(in) ILZ, integer, intent(in) N, integer, intent(in) ILO,
integer, intent(in) IHI, integer, intent(in) NSHIFTS, integer,
intent(in) NBLOCK_DESIRED, real, dimension( * ), intent(inout) SR, real,
dimension( * ), intent(inout) SI, real, dimension( * ), intent(inout)
SS, real, dimension( lda, * ), intent(inout) A, integer, intent(in) LDA,
real, dimension( ldb, * ), intent(inout) B, integer, intent(in) LDB,
real, dimension( ldq, * ), intent(inout) Q, integer, intent(in) LDQ,
real, dimension( ldz, * ), intent(inout) Z, integer, intent(in) LDZ,
real, dimension( ldqc, * ), intent(inout) QC, integer, intent(in) LDQC,
real, dimension( ldzc, * ), intent(inout) ZC, integer, intent(in) LDZC,
real, dimension( * ), intent(inout) WORK, integer, intent(in) LWORK,
integer, intent(out) INFO)
SLAQZ4
β¨ Purpose:
SLAQZ4 executes a single multishift QZ sweep. one sweep. main character energy π₯
π Parameters
ILSCHURβILSCHUR is LOGICAL. determines whether or not to update the full Schur form πILQβILQ is LOGICAL. determines whether or not to update the matrixQπILZβILZ is LOGICAL. determines whether or not to update the matrixZπNβN is INTEGER. the order of the matricesA,B,Q, andZ.N >= 0. πΈILOβILO is INTEGERπ¦IHIβIHI is INTEGERβ¨NSHIFTSβNSHIFTS is INTEGER. the desired number of shifts to use πNBLOCK_DESIREDβNBLOCK_DESIRED is INTEGER. the desired size of the computational windows πSRβSR is REAL array.SRcontains the real parts of the shifts to use. πSIβSI is REAL array.SIcontains the imaginary parts of the shifts to use. βSSβSS is REAL array.SScontains the scale of the shifts to use. π«ΆAβA is REAL array, dimension (LDA, N)πLDAβLDA is INTEGER. the leading dimension of the arrayA.LDA >= max( 1, N ). πΈBβB is REAL array, dimension (LDB, N)πLDBβLDB is INTEGER. the leading dimension of the arrayB.LDB >= max( 1, N ). π¦QβQ is REAL array, dimension (LDQ, N)β¨LDQβLDQ is INTEGERπZβZ is REAL array, dimension (LDZ, N)πLDZβLDZ is INTEGERπQCβQC is REAL array, dimension (LDQC, NBLOCK_DESIRED)πLDQCβLDQC is INTEGERβZCβZC is REAL array, dimension (LDZC, NBLOCK_DESIRED)π«ΆLDZCβ again the page saysLDZ is INTEGER, and honestly we just report the lore as it is πWORKβWORK is REAL array, dimension (MAX(1,LWORK)). on exit, ifINFO >= 0,WORK(1)returns the optimalLWORK. πLWORKβLWORK is INTEGER. the dimension of the arrayWORK.LWORK >= max(1,N).
if LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. πΈ
INFOβINFO is INTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π
π Author
Thijs Steel, KU Leuven π
ποΈ Date
May 2020
π subroutine zgelqt
subroutine zgelqt (integer M, integer N, integer MB, complex*16, dimension(
lda, * ) A, integer LDA, complex*16, dimension( ldt, * ) T, integer LDT,
complex*16, dimension( * ) WORK, integer INFO)
ZGELQT
β¨ Purpose:
ZGELQT computes a blocked LQ factorization of a complex M-by-N matrix A using the compact WY representation of Q. we love a compact representation, obsessed π
π Parameters
MβM is INTEGER. the number of rows of the matrixA.M >= 0. πΈNβN is INTEGER. the number of columns of the matrixA.N >= 0. π¦MBβMB is INTEGER. the block size to be used in the blocked QR.MIN(M,N) >= MB >= 1. β¨AβA is COMPLEX*16 array, dimension (LDA,N).
on entry, the M-by-N matrix A.
on exit, the elements on and below the diagonal of the array contain the M-by-MIN(M,N) lower trapezoidal matrix L (L is lower triangular if M <= N); the elements above the diagonal are the rows of V. π
LDAβ
LDA is <cyan>INTEGER</cyan> β it's the leading dimension of array <purple>A</purple>, and you need <yellow>LDA >= max(1,M)</yellow>. no cap. π
<hotpink>T</hotpink>β<hotpink>T</hotpink>is a<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDT,MIN(M,N))</yellow>. The upper triangular block reflectors are stored in compact form as a sequence of upper triangular blocks. See below for the tea. π<hotpink>LDT</hotpink>β<hotpink>LDT</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of array<hotpink>T</hotpink>.<yellow>LDT >= MB</yellow>. periodt.<hotpink>WORK</hotpink>β<hotpink>WORK</hotpink>is a<cyan>COMPLEX*16</cyan>array, dimension<yellow>(MB*N)</yellow>. that's it. β¨<hotpink>INFO</hotpink>β<hotpink>INFO</hotpink>is<cyan>INTEGER</cyan>.<green>= 0</green>: successful exit.<red>< 0</red>: if<yellow>INFO = -i</yellow>, the i-th argument had an illegal value. so if it's negative, something's sus with an argument. π
β¨ Author β¨
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
these legends wrote this. periodt. π
π«Ά Further Details: π«Ά
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. Let K=MIN(M,N). The number of blocks is B = ceiling(K/MB), where each block is of order MB except for the last block, which is of order IB = K - (B-1)*MB. For each of the B blocks, a upper triangular block reflector factor is computed: T1, T2, ..., TB. The MB-by-MB (and IB-by-IB for the last block) T's are stored in the MB-by-K matrix T as
T = (T1 T2 ... TB).
so that's the whole breakdown. iykyk. π
πΈ recursive subroutine zgelqt3 πΈ
recursive subroutine zgelqt3 (integer M, integer N, complex*16, dimension(
lda, * ) A, integer LDA, complex*16, dimension( ldt, * ) T, integer LDT,
integer INFO)
ZGELQT3 recursively computes a LQ factorization of a general real or complex matrix using the compact WY representation of Q. basically it's giving factorization realness. β¨
β¨ Purpose: β¨
ZGELQT3 recursively computes a LQ factorization of a complex M-by-N matrix A, using the compact WY representation of Q. no cap.
Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000. iconic.
π Parameters π
<hotpink>M</hotpink>β<hotpink>M</hotpink>is<cyan>INTEGER</cyan>. The number of rows of the matrix<purple>A</purple>.<yellow>M =< N</yellow>. (yes that's a=<, we don't make the rules. π)<hotpink>N</hotpink>β<hotpink>N</hotpink>is<cyan>INTEGER</cyan>. The number of columns of the matrix<purple>A</purple>.<yellow>N >= 0</yellow>.<hotpink>A</hotpink>β<hotpink>A</hotpink>is<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDA,N)</yellow>. On entry, the complex M-by-N matrix<purple>A</purple>. On exit, the elements on and below the diagonal contain the N-by-N lower triangular matrix<purple>L</purple>; the elements above the diagonal are the rows of<purple>V</purple>. See below for further details.<hotpink>LDA</hotpink>β<hotpink>LDA</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of the array<purple>A</purple>.<yellow>LDA >= max(1,M)</yellow>.<hotpink>T</hotpink>β<hotpink>T</hotpink>is<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDT,N)</yellow>. The N-by-N upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflector<hotpink>T</hotpink>; the elements below the diagonal are not used. See below for further details.<hotpink>LDT</hotpink>β<hotpink>LDT</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of the array<hotpink>T</hotpink>.<yellow>LDT >= max(1,N)</yellow>.<hotpink>INFO</hotpink>β<hotpink>INFO</hotpink>is<cyan>INTEGER</cyan>.<green>= 0</green>: successful exit.<red>< 0</red>: if<yellow>INFO = -i</yellow>, the i-th argument had an illegal value.
β¨ Author β¨
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π«Ά Further Details: π«Ά
The matrix V stores the elementary reflectors H(i) in the i-th row above the diagonal. For example, if M=5 and N=3, the matrix V is
V = ( 1 v1 v1 v1 v1 )
( 1 v2 v2 v2 )
( 1 v3 v3 v3 )
where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by
H = I - V * T * V**T
where V**T is the transpose of V.
For details of the algorithm, see Elmroth and Gustavson (cited above). iykyk. π
π¦ subroutine zgemlqt π¦
subroutine zgemlqt (character SIDE, character TRANS, integer M, integer N,
integer K, integer MB, complex*16, dimension( ldv, * ) V, integer LDV,
complex*16, dimension( ldt, * ) T, integer LDT, complex*16, dimension(
ldc, * ) C, integer LDC, complex*16, dimension( * ) WORK, integer INFO)
ZGEMLQT
β¨ Purpose: β¨
ZGEMLQT overwrites the general complex M-by-N matrix C with
SIDE = 'L' SIDE = 'R'
TRANS = 'N': Q C C Q
TRANS = 'C': Q**H C C Q**H
where Q is a complex unitary matrix defined as the product of K elementary reflectors:
Q = H(1) H(2) . . . H(K) = I - V T V**H
generated using the compact WY representation as returned by ZGELQT.
Q is of order M if SIDE = 'L' and of order N if SIDE = 'R'. periodt.
π Parameters π
<hotpink>SIDE</hotpink>β<hotpink>SIDE</hotpink>is<cyan>CHARACTER*1</cyan>.<green>= 'L'</green>: apply Q or QH from the Left;<green>= 'R'</green>: apply Q or QH from the Right.<hotpink>TRANS</hotpink>β<hotpink>TRANS</hotpink>is<cyan>CHARACTER*1</cyan>.<green>= 'N'</green>: No transpose, apply Q;<green>= 'C'</green>: Conjugate transpose, apply Q**H.<hotpink>M</hotpink>β<hotpink>M</hotpink>is<cyan>INTEGER</cyan>. The number of rows of the matrix C.<yellow>M >= 0</yellow>.<hotpink>N</hotpink>β<hotpink>N</hotpink>is<cyan>INTEGER</cyan>. The number of columns of the matrix C.<yellow>N >= 0</yellow>.<hotpink>K</hotpink>β<hotpink>K</hotpink>is<cyan>INTEGER</cyan>. The number of elementary reflectors whose product defines the matrix Q. If<yellow>SIDE = 'L'</yellow>,<yellow>M >= K >= 0</yellow>; if<yellow>SIDE = 'R'</yellow>,<yellow>N >= K >= 0</yellow>.<hotpink>MB</hotpink>β<hotpink>MB</hotpink>is<cyan>INTEGER</cyan>. The block size used for the storage of T.<yellow>K >= MB >= 1</yellow>. This must be the same value of MB used to generate T in ZGELQT.<hotpink>V</hotpink>β<hotpink>V</hotpink>is<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDV,M)</yellow>if<yellow>SIDE = 'L'</yellow>,<yellow>(LDV,N)</yellow>if<yellow>SIDE = 'R'</yellow>. The i-th row must contain the vector which defines the elementary reflector H(i), for i = 1,2,...,k, as returned by ZGELQT in the first K rows of its array argument A.<hotpink>LDV</hotpink>β<hotpink>LDV</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of the array V.<yellow>LDV >= max(1,K)</yellow>.<hotpink>T</hotpink>β<hotpink>T</hotpink>is<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDT,K)</yellow>. The upper triangular factors of the block reflectors as returned by ZGELQT, stored as a MB-by-K matrix.<hotpink>LDT</hotpink>β<hotpink>LDT</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of the array T.<yellow>LDT >= MB</yellow>.<hotpink>C</hotpink>β<hotpink>C</hotpink>is<cyan>COMPLEX*16</cyan>array, dimension<yellow>(LDC,N)</yellow>. On entry, the M-by-N matrix C. On exit, C is overwritten by Q C, QH C, C QH or C Q.<hotpink>LDC</hotpink>β<hotpink>LDC</hotpink>is<cyan>INTEGER</cyan>. The leading dimension of the array C.<yellow>LDC >= max(1,M)</yellow>.<hotpink>WORK</hotpink>β<hotpink>WORK</hotpink>is<cyan>COMPLEX*16</cyan>array. The dimension of WORK is<yellow>N*MB</yellow>if<yellow>SIDE = 'L'</yellow>, or<yellow>M*MB</yellow>if<yellow>SIDE = 'R'</yellow>.<hotpink>INFO</hotpink>β<hotpink>INFO</hotpink>is<cyan>INTEGER</cyan>.<green>= 0</green>: successful exit.<red>< 0</red>: if<yellow>INFO = -i</yellow>, the i-th argument had an illegal value.
β¨ Author β¨
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π Author π
Generated automatically by Doxygen for LAPACK from the source code. so yeah, a robot wrote this part. π
this page is from LAPACK version <pink>3.11.0</pink>, dated <pink>Sun Nov 27 2022</pink>, and it's the <pink>doubleGEcomputational(3)</pink> manpage. periodt. bye bestie! π
β¨
π¦ where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms