doubleGEcomputational(3)

πŸ“¦
version 3.11.0 Β· 2 versions
, in debian bookworm

πŸ’– 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) β€” CGELQT
  • cgelqt3 β€” recursive subroutine cgelqt3 (M, N, A, LDA, T, LDT, INFO) β€” CGELQT3
  • cgemlqt β€” subroutine cgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO) β€” CGEMLQT
  • dgebak β€” subroutine dgebak (JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, INFO) β€” DGEBAK
  • dgebal β€” subroutine dgebal (JOB, N, A, LDA, ILO, IHI, SCALE, INFO) β€” DGEBAL
  • dgebd2 β€” 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) β€” DGEBRD
  • dgecon β€” subroutine dgecon (NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK, INFO) β€” DGECON
  • dgeequ β€” subroutine dgeequ (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO) β€” DGEEQU
  • dgeequb β€” subroutine dgeequb (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO) β€” DGEEQUB
  • dgehd2 β€” 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) β€” DGEHRD
  • dgelq2 β€” 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) β€” DGELQF
  • dgelqt β€” subroutine dgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO) β€” DGELQT
  • dgelqt3 β€” 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) β€” DGEMLQT
  • dgemqrt β€” subroutine dgemqrt (SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO) β€” DGEMQRT
  • dgeql2 β€” 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) β€” DGEQLF
  • dgeqp3 β€” subroutine dgeqp3 (M, N, A, LDA, JPVT, TAU, WORK, LWORK, INFO) β€” DGEQP3
  • dgeqr2 β€” 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) β€” DGEQRF
  • dgeqrfp β€” subroutine dgeqrfp (M, N, A, LDA, TAU, WORK, LWORK, INFO) β€” DGEQRFP
  • dgeqrt β€” subroutine dgeqrt (M, N, NB, A, LDA, T, LDT, WORK, INFO) β€” DGEQRT
  • dgeqrt2 β€” 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) β€” DGERFS
  • dgerfsx β€” 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) β€” DGERFSX
  • dgerq2 β€” 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) β€” DGERQF
  • dgesvj β€” subroutine dgesvj (JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V, LDV, WORK, LWORK, INFO) β€” DGESVJ
  • dgetf2 β€” 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) β€” DGETRF
  • dgetrf2 β€” recursive subroutine dgetrf2 (M, N, A, LDA, IPIV, INFO) β€” DGETRF2
  • dgetri β€” subroutine dgetri (N, A, LDA, IPIV, WORK, LWORK, INFO) β€” DGETRI
  • dgetrs β€” subroutine dgetrs (TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO) β€” DGETRS
  • dhgeqz β€” subroutine dhgeqz (JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, INFO) β€” DHGEQZ
  • dla_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_GERPVGRW
  • dlaorhr_col_getrfnp β€” subroutine dlaorhr_col_getrfnp (M, N, A, LDA, D, INFO) β€” DLAORHR_COL_GETRFNP
  • dlaorhr_col_getrfnp2 β€” recursive subroutine dlaorhr_col_getrfnp2 (M, N, A, LDA, D, INFO) β€” DLAORHR_COL_GETRFNP2
  • dlaqz0 β€” recursive subroutine dlaqz0 (WANTS, WANTQ, WANTZ, N, ILO, IHI, A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, REC, INFO) β€” DLAQZ0
  • dlaqz1 β€” subroutine dlaqz1 (A, LDA, B, LDB, SR1, SR2, SI, BETA1, BETA2, V) β€” DLAQZ1
  • dlaqz2 β€” subroutine dlaqz2 (ILQ, ILZ, K, ISTARTM, ISTOPM, IHI, A, LDA, B, LDB, NQ, QSTART, Q, LDQ, NZ, ZSTART, Z, LDZ) β€” DLAQZ2
  • dlaqz3 β€” 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) β€” DLAQZ3
  • dlaqz4 β€” 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) β€” DLAQZ4
  • dtgevc β€” subroutine dtgevc (SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL, LDVL, VR, LDVR, MM, M, WORK, INFO) β€” DTGEVC
  • dtgexc β€” subroutine dtgexc (WANTQ, WANTZ, N, A, LDA, B, LDB, Q, LDQ, Z, LDZ, IFST, ILST, WORK, LWORK, INFO) β€” DTGEXC
  • sgelqt β€” subroutine sgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO) β€” SGELQT
  • sgelqt3 β€” recursive subroutine sgelqt3 (M, N, A, LDA, T, LDT, INFO) β€” SGELQT3
  • sgemlqt β€” subroutine sgemlqt (SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO) β€” SGEMLQT
  • slaqz0 β€” recursive subroutine slaqz0 (WANTS, WANTQ, WANTZ, N, ILO, IHI, A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, REC, INFO) β€” SLAQZ0
  • slaqz1 β€” subroutine slaqz1 (A, LDA, B, LDB, SR1, SR2, SI, BETA1, BETA2, V) β€” SLAQZ1
  • slaqz2 β€” subroutine slaqz2 (ILQ, ILZ, K, ISTARTM, ISTOPM, IHI, A, LDA, B, LDB, NQ, QSTART, Q, LDQ, NZ, ZSTART, Z, LDZ) β€” SLAQZ2
  • slaqz3 β€” 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) β€” SLAQZ3
  • slaqz4 β€” 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) β€” SLAQZ4
  • zgelqt β€” subroutine zgelqt (M, N, MB, A, LDA, T, LDT, WORK, INFO) β€” ZGELQT
  • zgelqt3 β€” 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 matrix A. constraint: M >= 0.
  • N β€” N is INTEGER. the number of columns of the matrix A. 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: 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. so it comes in as A, leaves as two things at once. multitasking icon. 😭
  • LDA β€” LDA is INTEGER. the leading dimension of the array A. 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 array T. 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: if INFO = -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 matrix A. M =< N.
  • N β€” N is INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” A is COMPLEX array, dimension (LDA,N). On entry, the complex M-by-N matrix A. On exit, the elements on and below the diagonal contain the N-by-N lower triangular matrix L; the elements above the diagonal are the rows 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 COMPLEX 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: if INFO = -i, the i-th argument had an illegal value

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

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': apply Q or Q**H from the Left;
    • = 'R': apply Q or Q**H from the Right.
  • TRANS β€” TRANS is CHARACTER*1
    • = 'N': No transpose, apply Q;
    • = 'C': Conjugate transpose, apply Q**H.
  • M β€” M is INTEGER. The number of rows of the matrix C. M >= 0.
  • N β€” N is INTEGER. The number of columns of the matrix C. N >= 0.
  • K β€” K is INTEGER. The number of elementary reflectors whose product defines the matrix Q. If SIDE = 'L', M >= K >= 0; if SIDE = 'R', N >= K >= 0.
  • MB β€” MB is INTEGER. The block size used for the storage of T. K >= MB >= 1. This must be the same value of MB used to generate T in CGELQT.
  • V β€” V is COMPLEX 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 CGELQT in the first K rows of its array argument A.
  • LDV β€” LDV is INTEGER. The leading dimension of the array V. LDV >= max(1,K).
  • T β€” T is COMPLEX array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned by CGELQT, stored as a MB-by-K matrix.
  • LDT β€” LDT is INTEGER. The leading dimension of the array T. LDT >= MB.
  • C β€” C is COMPLEX array, dimension (LDC,N). On entry, the M-by-N matrix C. On exit, C is overwritten by Q C, Q**H C, C Q**H or C Q.
  • LDC β€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • WORK β€” WORK is COMPLEX array. The dimension of WORK is N*MB if SIDE = 'L', or M*MB if SIDE = 'R'.
  • INFO β€” INFO is INTEGER
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


🌸 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': V contains right eigenvectors;
    • = 'L': V contains left eigenvectors.
  • N β€” N is INTEGER. The number of rows of the matrix V. N >= 0.
  • ILO β€” ILO is INTEGER
  • IHI β€” IHI is INTEGER. The integers ILO and IHI determined by DGEBAL. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  • SCALE β€” SCALE is DOUBLE PRECISION array, dimension (N). Details of the permutation and scaling factors, as returned by DGEBAL.
  • M β€” M is INTEGER. The number of columns of the matrix V. 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 by DHSEIN or DTREVC. On exit, V is overwritten by the transformed eigenvectors.
  • LDV β€” LDV is INTEGER. The leading dimension of the array V. LDV >= max(1,N).
  • INFO β€” INFO is INTEGER
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value.

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


πŸ‘‘ 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 on A:
    • = 'N': none: simply set ILO = 1, IHI = N, SCALE(I) = 1.0 for i = 1,...,N;
    • = 'P': permute only;
    • = 'S': scale only;
    • = 'B': both permute and scale.
  • N β€” N is INTEGER. The order of the matrix A. N >= 0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the input matrix A. On exit, A is overwritten by the balanced matrix. If JOB = 'N', A is not referenced. See Further Details.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • ILO β€” ILO is INTEGER
  • IHI β€” IHI is INTEGER. ILO and IHI are set to integers such that on exit A(i,j) = 0 if i > j and j = 1,...,ILO-1 or I = IHI+1,...,N. If JOB = 'N' or 'S', ILO = 1 and IHI = 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: if INFO = -i, the i-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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns in the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, 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 matrix B; the elements below the diagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors;
    • if m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrix B; the elements below the first subdiagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the diagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors.
    • See Further Details below. πŸ‘‡
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • D β€” DOUBLE PRECISION array, dimension (min(M,N)). The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i).
  • E β€” DOUBLE PRECISION array, dimension (min(M,N)-1). The off-diagonal elements of the bidiagonal matrix B:
    • if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n-1;
    • if m < n, E(i) = A(i+1,i) for i = 1,2,...,m-1.
  • TAUQ β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. See Further Details. πŸ’«
  • TAUP β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrix P. See Further Details. πŸ’«
  • WORK β€” DOUBLE PRECISION array, dimension (max(M,N)).
  • INFO β€” INTEGER:
    • = 0: successful exit. slay πŸŽ€
    • < 0: if INFO = -i, the i-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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns in the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, 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 matrix B; the elements below the diagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors;
    • if m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrix B; the elements below the first subdiagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the diagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors.
    • See Further Details. πŸ‘€
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • D β€” DOUBLE PRECISION array, dimension (min(M,N)). The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i).
  • E β€” DOUBLE PRECISION array, dimension (min(M,N)-1). The off-diagonal elements of the bidiagonal matrix B:
    • if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n-1;
    • if m < n, E(i) = A(i+1,i) for i = 1,2,...,m-1.
  • TAUQ β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. See Further Details. ✨
  • TAUP β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors which represent the orthogonal matrix P. See Further Details. ✨
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. it tells you how much room it actually wanted, so considerate 🫢
  • LWORK β€” INTEGER. The length of the array WORK. LWORK >= max(1,M,N). For optimum performance LWORK >= (M+N)*NB, where NB is 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 πŸ’…

  • INFO
  • INFO β€” it's an INTEGER, bestie, and it's the vibe check at the end:
    • = 0: successful exit, we ate πŸ’…
    • < 0: if INFO = -i, the i-th argument had an illegal value.

πŸ’– Author πŸ’–

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

πŸ”₯ 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 β€” NORM is CHARACTER*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 β€” N is INTEGER. The order of the matrix A. N >= 0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). The factors L and U from the factorization A = P*L*U as computed by DGETRF.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • ANORM β€” ANORM is DOUBLE PRECISION. If NORM = '1' or 'O', the 1-norm of the original matrix A. If NORM = 'I', the infinity-norm of the original matrix A.
  • RCOND β€” RCOND is DOUBLE PRECISION. The reciprocal of the condition number of the matrix A, computed as RCOND = 1/(norm(A) * norm(inv(A))).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (4*N).
  • IWORK β€” IWORK is INTEGER array, dimension (N).
  • INFO β€” INFO is INTEGER:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

πŸ’– Author πŸ’–

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


πŸ¦‹ 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 β€” 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). The M-by-N matrix whose equilibration factors are to be computed.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • R β€” R is DOUBLE PRECISION array, dimension (M). If INFO = 0 or INFO > M, R contains the row scale factors for A.
  • C β€” C is DOUBLE PRECISION array, dimension (N). If INFO = 0, C contains the column scale factors for A.
  • ROWCND β€” ROWCND is DOUBLE PRECISION. If INFO = 0 or INFO > M, ROWCND contains the ratio of the smallest R(i) to the largest R(i). If ROWCND >= 0.1 and AMAX is neither too large nor too small, it is not worth scaling by R.
  • COLCND β€” COLCND is DOUBLE PRECISION. If INFO = 0, COLCND contains the ratio of the smallest C(i) to the largest C(i). If COLCND >= 0.1, it is not worth scaling by C.
  • AMAX β€” AMAX is DOUBLE 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 β€” INFO is INTEGER:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: if INFO = 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 β€” 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). The M-by-N matrix whose equilibration factors are to be computed.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • R β€” R is DOUBLE PRECISION array, dimension (M). If INFO = 0 or INFO > M, R contains the row scale factors for A.
  • C β€” C is DOUBLE PRECISION array, dimension (N). If INFO = 0, C contains the column scale factors for A.
  • ROWCND β€” ROWCND is DOUBLE PRECISION. If INFO = 0 or INFO > M, ROWCND contains the ratio of the smallest R(i) to the largest R(i). If ROWCND >= 0.1 and AMAX is neither too large nor too small, it is not worth scaling by R.
  • COLCND β€” COLCND is DOUBLE PRECISION. If INFO = 0, COLCND contains the ratio of the smallest C(i) to the largest C(i). If COLCND >= 0.1, it is not worth scaling by C.
  • AMAX β€” AMAX is DOUBLE 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 β€” INFO is INTEGER:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: if INFO = 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 β€” N is INTEGER. It's the order of the matrix A, and she must be N >= 0. that's it, that's the vibe check.
  • ILO β€” ILO is INTEGER. that's the whole description fr.
  • IHI β€” IHI is INTEGER. okay so the deal is: we're assuming A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally handed to you by a previous call to DGEBAL β€” if you're not coming from there, just set them to 1 and N respectively. See Further Details for the tea. And the constraint is 1 <= ILO <= IHI <= max(1,N). πŸ’–
  • A β€” A is 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 of A get overwritten with the upper Hessenberg matrix H, and the elements below the first subdiagonal β€” together with the array TAU β€” represent the orthogonal matrix Q as a product of elementary reflectors. See Further Details. she's a multitasker. ✨
  • LDA β€” LDA is INTEGER. It's the leading dimension of the array A, and LDA >= max(1,N). no exceptions bestie.
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (N-1). The scalar factors of the elementary reflectors (again: see Further Details 🫢).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (N).
  • INFO β€” INFO is INTEGER. = 0: successful exit, slay. < 0: if INFO = -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 β€” N is INTEGER. The order of the matrix A. N >= 0.
  • ILO β€” ILO is INTEGER.
  • IHI β€” IHI is INTEGER. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set by a previous call to DGEBAL; otherwise they should be set to 1 and N respectively. See Further Details. And the rules are 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. yes, that IHI=0 case is real, don't come for me. πŸ¦‹
  • A β€” A is 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 of A are overwritten with the upper Hessenberg matrix H, and the elements below the first subdiagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors. See Further Details.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (N-1). The scalar factors of the elementary reflectors (see Further Details). Elements 1:ILO-1 and IHI:N-1 of TAU are set to zero. 🫢
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (LWORK). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. she tells you what she wants.
  • LWORK β€” LWORK is INTEGER. The length of the array WORK. LWORK >= max(1,N). For good performance, LWORK should generally be larger. and 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. sneaky but iconic. ✨
  • INFO β€” INFO is INTEGER. = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. πŸ™ˆ

Author:

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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's DGEHRD subroutine incorporating improvements proposed by Quintana-Orti and Van de Geijn (2006). (See DLAHR2.) πŸ’œ

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:

  • Q is a n-by-n orthogonal matrix;
  • L is a lower-triangular m-by-m matrix;
  • 0 is a m-by-(n-m) zero matrix, if m < n.

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 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, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details). πŸŽ€
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (M).
  • INFO β€” INFO is INTEGER. = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. πŸ’€

Author:

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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:

  • Q is a N-by-N orthogonal matrix;
  • L is a lower-triangular M-by-M matrix;
  • 0 is a M-by-(N-M) zero matrix, if M < N.

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 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, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details). ✨
  • LDA β€” LDA is INTEGER.
  • LDA β€” an INTEGER, bestie. It's the leading dimension of the array A, and you need LDA >= max(1,M). that's the whole vibe. πŸ’…
  • TAU β€” DOUBLE PRECISION array, dimension (min(M,N)). These are the scalar factors of the elementary reflectors (peep Further Details below for the tea β˜•).
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, then WORK(1) hands you back the optimal LWORK. it's giving helpful fr 🫢
  • LWORK β€” an INTEGER, the dimension of the array WORK. LWORK >= max(1,M). For optimum performance you want LWORK >= M*NB, where NB is 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. no cap. ✨
  • INFO β€” an INTEGER, your little status report:
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author 🌸

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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 β€” an INTEGER. The number of rows of the matrix A. M >= 0.
  • N β€” an INTEGER. The number of columns of the matrix A. N >= 0.
  • MB β€” an INTEGER. 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 PRECISION 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. iconic behavior honestly πŸ‘‘
  • LDA β€” an INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • T β€” 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 β€” an INTEGER. The leading dimension of the array T. LDT >= MB.
  • WORK β€” DOUBLE PRECISION array, dimension (MB*N).
  • INFO β€” an INTEGER, the vibes check:
    • = 0: successful exit πŸŽ€
    • < 0: if INFO = -i, the i-th argument had an illegal value 😭

Author 🌈

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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 β€” an INTEGER. The number of rows of the matrix A. M =< N.
  • N β€” an INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N). On entry, the real M-by-N matrix A. On exit, the elements on and below the diagonal contain the N-by-N lower triangular matrix L; the elements above the diagonal are the rows of V. See below for further details. πŸ’–
  • LDA β€” an INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • T β€” 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 β€” an INTEGER. The leading dimension of the array T. LDT >= max(1,N).
  • INFO β€” an INTEGER:
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ™ˆ

Author 🌸

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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': apply Q or Q**T from the Left;
    • = 'R': apply Q or Q**T from the Right.
  • TRANS β€” CHARACTER*1:
    • = 'N': No transpose, apply Q;
    • = 'C': Transpose, apply Q**T.
  • M β€” an INTEGER. The number of rows of the matrix C. M >= 0.
  • N β€” an INTEGER. The number of columns of the matrix C. N >= 0.
  • K β€” an INTEGER. The number of elementary reflectors whose product defines the matrix Q. If SIDE = 'L', M >= K >= 0; if SIDE = 'R', N >= K >= 0.
  • MB β€” an INTEGER. The block size used for the storage of T. K >= MB >= 1. This must be the same value of MB used to generate T in DGELQT. ⚠️ do not mix these up bestie.
  • V β€” DOUBLE PRECISION 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 DGELQT in the first K rows of its array argument A.

  • LDV β€” an INTEGER. The leading dimension of the array V. LDV >= max(1,K).
  • T β€” DOUBLE PRECISION array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned by DGELQT, stored as a MB-by-K matrix. πŸŽ€
  • LDT β€” an INTEGER. The leading dimension of the array T. LDT >= MB.
  • C β€” DOUBLE PRECISION array, dimension (LDC,N). On entry, the M-by-N matrix C. On exit, C is overwritten by Q C, Q**T C, C Q**T or C Q. πŸ”₯
  • LDC β€” an INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • WORK β€” DOUBLE PRECISION array. The dimension of WORK is N*MB if SIDE = 'L', or M*MB if SIDE = 'R'.
  • INFO β€” an INTEGER:
    • = 0: successful exit 🌈
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author 🌸

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

✨ 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 a CHARACTER*1, and it's giving direction:
    • = 'L': apply Q or Q**T from the Left;
    • = 'R': apply Q or Q**T from the Right.
  • TRANS β€” also CHARACTER*1, the glow-up question:
    • = 'N': No transpose, apply Q;
    • = 'C': Transpose, apply Q**T.
  • M β€” INTEGER. The number of rows of the matrix C. M >= 0.
  • N β€” INTEGER. The number of columns of the matrix C. N >= 0.
  • K β€” INTEGER. The number of elementary reflectors whose product defines the matrix Q.
    • If SIDE = 'L', M >= K >= 0;
    • if SIDE = 'R', N >= K >= 0.
  • NB β€” INTEGER. The block size used for the storage of T. K >= NB >= 1.
Heads up bestie: this must be the same value of NB used to generate T in DGEQRT. Matching fits only, okay? 🫢
  • V β€” DOUBLE PRECISION array, dimension (LDV,K). The i-th column must contain the vector which defines the elementary reflector H(i), for i = 1,2,...,k, as returned by DGEQRT in the first K columns of its array argument A.
  • LDV β€” INTEGER. The leading dimension of the array V.
    • If SIDE = 'L', LDA >= max(1,M);
    • if SIDE = 'R', LDA >= max(1,N).
  • T β€” DOUBLE PRECISION array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned by DGEQRT, stored as a NB-by-N matrix.
  • LDT β€” INTEGER. The leading dimension of the array T. LDT >= NB.
  • C β€” DOUBLE PRECISION array, dimension (LDC,N).
    • On entry, the M-by-N matrix C.
    • On exit, C is overwritten by Q C, Q**T C, C Q**T or C Q. (told you it gets overwritten, she does not ask permission πŸ’€)
  • LDC β€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • WORK β€” DOUBLE PRECISION array. The dimension of WORK is N*NB if SIDE = 'L', or M*NB if SIDE = 'R'.
  • INFO β€” INTEGER, the receipts:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ¦‹ 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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N).
    • On entry, the m by n matrix A.
    • On exit, if m >= n, the lower triangle of the subarray A(m-n+1:m,1:n) contains the n by n lower triangular matrix L;
    • if m <= n, the elements on and below the (n-m)-th superdiagonal contain the m by n lower trapezoidal matrix L;
    • the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” DOUBLE PRECISION array, dimension (N).
  • INFO β€” INTEGER:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N).
    • On entry, the M-by-N matrix A.
    • On exit,
      • if m >= n, the lower triangle of the subarray A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L;
      • if m <= n, the elements on and below the (n-m)-th superdiagonal contain the M-by-N lower trapezoidal matrix L;
      • the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= max(1,N). For optimum performance LWORK >= N*NB, where NB is 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 a lil peek, not a whole computation, bestie ✨)
  • INFO β€” INTEGER:
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, 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 matrix R; the elements below the diagonal, together with the array TAU, represent the orthogonal matrix Q as a product of min(M,N) elementary reflectors.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • JPVT β€” INTEGER array, dimension (N).
    • On entry, if JPVT(J).ne.0, the J-th column of A is permuted to the front of A*P (a leading column); if JPVT(J)=0, the J-th column of A is a free column.
    • On exit, if JPVT(J)=K, then the J-th column of A*P was the K-th column of A.
  • TAU β€” DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors.
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO=0, WORK(1) returns the optimal LWORK.
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= 3*N+1. For optimal performance LWORK >= 2*N+( N+1 )*NB, where NB is 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. (same lil peek energy, different routine 🫢)
  • INFO β€” INTEGER:
    • = 0: successful exit.
    • < 0: if INFO = -i, the i-th argument had an illegal value.

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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:

  • Q is a m-by-m orthogonal matrix;
  • R is an upper-triangular n-by-n matrix;
  • 0 is a (m-n)-by-n zero matrix, if m > n.

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 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 β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (N).
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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:

  • Q is a m-by-m orthogonal matrix;
  • R is an upper-triangular n-by-n matrix with nonnegative diagonal entries;
  • 0 is a (m-n)-by-n zero matrix, if m > n.

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 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 β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (N).
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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:

  • Q is a M-by-M orthogonal matrix;
  • R is an upper-triangular N-by-N matrix;
  • 0 is a (M-N)-by-N zero matrix, if M > N.

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 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 β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” LWORK is INTEGER. The dimension of the array WORK. LWORK >= 1, if MIN(M,N) = 0, and LWORK >= N, otherwise. For optimum performance LWORK >= N*NB, where NB is 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 β€” INFO is INTEGER.
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

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:

  • Q is a M-by-M orthogonal matrix;
  • R is an upper-triangular N-by-N matrix with nonnegative diagonal entries;
  • 0 is a (M-N)-by-N zero matrix, if M > N.

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 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 β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” TAU is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” LWORK is INTEGER. The dimension of the array WORK. LWORK >= max(1,N). For optimum performance LWORK >= N*NB, where NB is 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
  • INFO β€” INFO is INTEGER, the little status report bestie
    • = 0: successful exit πŸŽ‰ everything slayed
    • < 0: if INFO = -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 if M >= 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: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author ✍️

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

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: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author ✍️

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

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: if INFO = -i, the i-th argument had an illegal value πŸ’€

Author ✍️

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

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 factorization A = P*L*U as computed by DGETRF.
  • 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 from DGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
  • B
  • B β€” 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 array B. 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 matrix X, exactly as DGETRS handed it to you. On exit? It's the improved solution matrix X. Glow up, literally. ✨
  • LDX β€” INTEGER. The leading dimension of the array X. LDX >= max(1,N), no cap.
  • FERR β€” DOUBLE PRECISION array, dimension (NRHS). The estimated forward error bound for each solution vector X(j) (that's the j-th column of the solution matrix X, 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 vector X(j). Translation: the smallest relative change in any element of A or B that would make X(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: if INFO = -i, the i-th argument had an illegal value. Not slay. One of your inputs was giving chaos. 😭

Internal Parameters: πŸ‘‘

  • ITMAX is the maximum number of steps of iterative refinement. She'll keep polishing the solution, but only ITMAX times. 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 to A before calling this routine. This is needed to compute the solution and error bounds correctly. Like, you gotta tell her what was done to A or she's guessing, and guessing is not the vibe.
    • = 'N': No equilibration
    • = 'R': Row equilibration, i.e., A has been premultiplied by diag(R).
    • = 'C': Column equilibration, i.e., A has been postmultiplied by diag(C).
    • = 'B': Both row and column equilibration, i.e., A has been replaced by diag(R) * A * diag(C). The right hand side B has been changed accordingly.
  • N β€” INTEGER. The order of the matrix A. N >= 0.
  • NRHS β€” INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N). The original N-by-N matrix A. The one from before the whole saga.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • AF β€” DOUBLE PRECISION array, dimension (LDAF,N). The factors L and U from the factorization A = P*L*U, as computed by DGETRF.
  • LDAF β€” INTEGER. The leading dimension of the array AF. LDAF >= max(1,N).
  • IPIV β€” INTEGER array, dimension (N). The pivot indices from DGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i). The receipts of every swap. 🧾
  • R β€” DOUBLE PRECISION array, dimension (N). The row scale factors for A. If EQUED = 'R' or 'B', A is multiplied on the left by diag(R); if EQUED = 'N' or 'C', R is not accessed.
If R is accessed, each element of R should 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 for A. If EQUED = 'C' or 'B', A is multiplied on the right by diag(C); if EQUED = 'N' or 'R', C is not accessed.
If C is accessed, each element of C should 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 matrix B.
  • LDB β€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • X β€” DOUBLE PRECISION array, dimension (LDX,NRHS). On entry, the solution matrix X, as computed by DGETRS. On exit, the improved solution matrix X. Same girl, better version. πŸ’…
  • LDX β€” INTEGER. The leading dimension of the array X. LDX >= max(1,N).
  • RCOND β€” DOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after 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 vector X(j), i.e., the smallest relative change in any element of A or B that makes X(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). See ERR_BNDS_NORM and ERR_BNDS_COMP below. 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 threshold sqrt(n) * dlamch('Epsilon'). Literally a vibe check boolean, no cap. βœ…/❌
  • 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 threshold sqrt(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 threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1.

See Lapack Working Note 165 for further details and extra cautions. πŸ“š

  • ERR_BNDS_COMP β€”
  • ERR_BNDS_COMP is DOUBLE 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 threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1.

See Lapack Working Note 165 for further details and extra cautions. πŸ‘‘

  • NPARAMS β€” is INTEGER. Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never referenced and default values are used.
  • PARAMS β€” is DOUBLE 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 to NPARAMS are 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 support DOUBLE PRECISION.
      • (other values are reserved for future use)
    • PARAMS(LA_LINRX_ITHRESH_I = 2) β€” Maximum number of residual computations allowed for refinement. Default: 10 Aggressive: Set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may 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.0 is false. Default: 1.0 (attempt componentwise convergence)
  • WORK β€” is DOUBLE PRECISION array, dimension (4*N).
  • IWORK β€” is INTEGER array, dimension (N).
  • INFO β€” is INTEGER
    • = 0: Successful exit. The solution to every right-hand side is guaranteed.
    • < 0: If INFO = -i, the i-th argument had an illegal value.
    • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned.
    • = N+J: The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right-hand sides K with K > J may 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 the Jth right-hand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the Jth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides check ERR_BNDS_NORM or ERR_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 β€” is INTEGER. The number of rows of the matrix A. M >= 0.
  • N β€” is INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” is DOUBLE PRECISION array, dimension (LDA,N). On entry, the m by n matrix A. On exit, if m <= n, the upper triangle of the subarray A(1:m,n-m+1:n) contains the m by m upper triangular matrix R; if m >= n, the elements on and above the (m-n)-th subdiagonal contain the m by n upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
  • LDA β€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” is DOUBLE PRECISION array, dimension (M).
  • INFO β€” is INTEGER
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

πŸ‘‘ Author

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ” 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 β€” is INTEGER. The number of rows of the matrix A. M >= 0.
  • N β€” is INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” is DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrix A. On exit, if m <= n, the upper triangle of the subarray A(1:m,n-m+1:n) contains the M-by-M upper triangular matrix R; if m >= n, the elements on and above the (m-n)-th subdiagonal contain the M-by-N upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).
  • LDA β€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • TAU β€” is DOUBLE PRECISION array, dimension (min(M,N)). The scalar factors of the elementary reflectors (see Further Details).
  • WORK β€” is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” is INTEGER. The dimension of the array WORK. LWORK >= 1, if MIN(M,N) = 0, and LWORK >= M, otherwise. For optimum performance LWORK >= M*NB, where NB is 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 β€”
  • INFO is INTEGER
    • = 0: bestie it worked, successful exit πŸ’–
    • < 0: if INFO = -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 β€” JOBA is CHARACTER*1. It specifies the structure of A:
    • = 'L': the input matrix A is lower triangular;
    • = 'U': the input matrix A is upper triangular;
    • = 'G': the input matrix A is general M-by-N matrix, M >= N.
  • JOBU β€” JOBU is CHARACTER*1. It specifies whether to compute the left singular vectors (columns of U):
    • = 'U': the left singular vectors corresponding to the nonzero singular values are computed and returned in the leading columns of A. See more details in the description of A. The default numerical orthogonality threshold is set to approximately TOL=CTOL*EPS, CTOL=DSQRT(M), EPS=DLAMCH('E').
    • = 'C': analogous to JOBU='U', except that user can control the level of numerical orthogonality of the computed left singular vectors. TOL can be set to TOL = CTOL*EPS, where CTOL is given on input in the array WORK. No CTOL smaller than ONE is allowed. CTOL greater than 1 / EPS is meaningless. The option 'C' can be used if M*EPS is satisfactory orthogonality of the computed left singular vectors, so CTOL=M could save few sweeps of Jacobi rotations. See the descriptions of A and WORK(1).
    • = 'N': the matrix U is not computed. However, see the description of A.
  • JOBV β€” JOBV is CHARACTER*1. It specifies whether to compute the right singular vectors, that is, the matrix V:
    • = 'V': the matrix V is computed and returned in the array V
    • = 'A': the Jacobi rotations are applied to the MV-by-N array V. In other words, the right singular vector matrix V is not computed explicitly, instead it is applied to an MV-by-N matrix initially stored in the first MV rows of V.
    • = 'N': the matrix V is not computed and the array V is not referenced πŸ™ˆ
  • M β€” M is INTEGER. The number of rows of the input matrix A. 1/DLAMCH('E') > M >= 0.
  • N β€” N is INTEGER. The number of columns of the input matrix A. M >= N >= 0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the M-by-N matrix A.

On exit:

If JOBU = 'U' .OR. JOBU = 'C':

  • If INFO = 0: RANKA orthonormal columns of U are returned in the leading RANKA columns of the array A. Here RANKA <= N is the number of computed singular values of A that are above the underflow threshold DLAMCH('S'). The singular vectors corresponding to underflowed or zero singular values are not computed. The value of RANKA is returned in the array WORK as RANKA=NINT(WORK(2)). Also see the descriptions of SVA and WORK. The computed columns of U are mutually numerically orthogonal up to approximately TOL=DSQRT(M)*EPS (default); or TOL=CTOL*EPS (JOBU = 'C'), see the description of JOBU.
  • If INFO > 0: the procedure DGESVJ did not converge in the given number of iterations (sweeps). In that case, the computed columns of U may not be orthogonal up to TOL. The output U (stored in A), SIGMA (given by the computed singular values in SVA(1:N)) and V is still a decomposition of the input matrix A in the sense that the residual ||A-SCALE*U*SIGMA*V^T||_2 / ||A||_2 is 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 of U is not an issue and iterations are stopped when the columns of the iterated matrix are numerically orthogonal up to approximately M*EPS. Thus, on exit, A contains the columns of U scaled with the corresponding singular values.
  • If INFO > 0: the procedure DGESVJ did not converge in the given number of iterations (sweeps).
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • SVA β€” SVA is DOUBLE PRECISION array, dimension (N). On exit:
    • If INFO = 0: depending on the value SCALE = WORK(1), we have:
      • If SCALE = ONE: SVA(1:N) contains the computed singular values of A. During the computation SVA contains the Euclidean column norms of the iterated matrices in the array A.
      • If SCALE .NE. ONE: the singular values of A are SCALE*SVA(1:N), and this factored representation is due to the fact that some of the singular values of A might underflow or overflow. 😭
    • If INFO > 0: the procedure DGESVJ did not converge in the given number of iterations (sweeps) and SCALE*SVA(1:N) may not be accurate.
  • MV β€” MV is INTEGER. If JOBV = 'A', then the product of Jacobi rotations in DGESVJ is applied to the first MV rows of V. See the description of JOBV.
  • V β€” V is DOUBLE PRECISION array, dimension (LDV,N).
    • If JOBV = 'V', then V contains on exit the N-by-N matrix of the right singular vectors;
    • If JOBV = 'A', then V contains the product of the computed right singular vector matrix and the initial matrix in the array V.
    • If JOBV = 'N', then V is not referenced.
  • LDV β€” LDV is INTEGER. The leading dimension of the array V, LDV >= 1.
    • If JOBV = 'V', then LDV >= max(1,N).
    • If JOBV = 'A', then LDV >= max(1,MV).
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (LWORK).

On entry:

  • If JOBU = 'C': WORK(1) = CTOL, where CTOL defines the threshold for convergence. The process stops if all columns of A are mutually orthogonal up to CTOL*EPS, EPS=DLAMCH('E'). It is required that CTOL >= ONE, i.e. it is not allowed to force the routine to obtain orthogonality below EPS.

On exit:

  • WORK(1) = SCALE is the scaling factor such that SCALE*SVA(1:N) are the computed singular values of A. (See description of SVA().)
  • 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 when DGESVJ did 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 β€” LWORK is INTEGER. length of WORK, WORK >= MAX(6,M+N)
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit.
    • < 0: if INFO = -i, then the i-th argument had an illegal value
    • > 0: DGESVJ did not converge in the maximal allowed number (30) of sweeps. The output may still be useful. See the description of WORK.
bestie if you get INFO > 0 do NOT panic, the output might still be giving πŸ’… just go read WORK like 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 factorization A = 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; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -k, the k-th argument had an illegal value
    • > 0: if INFO = 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 factorization A = 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; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: if INFO = 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 factorization A = 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; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: if INFO = 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.
  • A
  • A β€” 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 factorization A = P*L*U; the unit diagonal elements of L are not stored. bestie they literally skip storing them bc they're all 1s, it's giving efficient πŸ’…
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • IPIV β€” INTEGER array, dimension (min(M,N)). The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i). this is the receipts of every row swap that happened, keep up πŸŽ€
  • INFO β€” INTEGER. the vibe check:
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value 😭
    • > 0: if INFO = 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. 🚨 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 matrix A. M >= 0.
  • N β€” INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” 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 factorization A = P*L*U; the unit diagonal elements of L are not stored.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • IPIV β€” INTEGER array, dimension (min(M,N)). The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
  • INFO β€” INTEGER. the same trio as before, no cap:
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value 😭
    • > 0: if INFO = 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.

πŸ’œ 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 matrix A. N >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N). On entry, the factors L and U from the factorization A = P*L*U as computed by DGETRF. On exit, if INFO = 0, the inverse of the original matrix A. she goes in as L and U and comes out as the whole inverse, glow up ✨
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • IPIV β€” INTEGER array, dimension (N). The pivot indices from DGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
  • WORK β€” DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO=0, then WORK(1) returns the optimal LWORK.
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= max(1,N). For optimal performance LWORK >= N*NB, where NB is the optimal blocksize returned by ILAENV.

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: if INFO = -i, the i-th argument had an illegal value 😭
    • > 0: if INFO = 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 matrix A. N >= 0.
  • NRHS β€” INTEGER. The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0.
  • A β€” DOUBLE PRECISION array, dimension (LDA,N). The factors L and U from the factorization A = P*L*U as computed by DGETRF.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • IPIV β€” INTEGER array, dimension (N). The pivot indices from DGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
  • B β€” DOUBLE PRECISION array, dimension (LDB,NRHS). On entry, the right hand side matrix B. On exit, the solution matrix X. in goes B, out comes X, we love a transformation arc πŸ’–
  • LDB β€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • INFO β€” INTEGER.
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value 😭

🫢 Author

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ‘‘ 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 a CHARACTER*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 vectors Q.
    • = '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 (H,T) is returned;
    • = 'V': Q must contain an orthogonal matrix Q1 on entry and the product Q1*Q is returned.
  • COMPZ β€” CHARACTER*1, controls the right Schur vectors Z.
    • = '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 (H,T) is returned;
    • = 'V': Z must contain an orthogonal matrix Z1 on entry and the product Z1*Z is returned.
  • N β€” INTEGER. The order of the matrices H, T, Q, and Z. N >= 0.
  • ILO β€” INTEGER. (yes, that’s the whole description. iconic minimalism.)
  • IHI β€” INTEGER. ILO and IHI mark the rows and columns of H which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  • H β€” DOUBLE PRECISION array, dimension (LDH, N). On entry, the N-by-N upper Hessenberg matrix H. On exit, if JOB = 'S', H contains the upper quasi-triangular matrix S from the generalized Schur factorization. If JOB = 'E', the diagonal blocks of H match those of S, but the rest of H is unspecified.
  • LDH β€” INTEGER. The leading dimension of the array H. LDH >= max( 1, N ).
  • T β€” DOUBLE PRECISION array, dimension (LDT, N). On entry, the N-by-N upper triangular matrix T. On exit, if JOB = 'S', T 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., if H(j+1,j) is non-zero, then T(j+1,j) = T(j,j+1) = 0, T(j,j) > 0, and T(j+1,j+1) > 0. If JOB = 'E', the diagonal blocks of T match those of P, but the rest of T is unspecified.
  • LDT β€” INTEGER. The leading dimension of the array T. 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. If ALPHAI(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, with ALPHAI(j+1) = -ALPHAI(j).
  • BETA β€” DOUBLE PRECISION array, 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.
  • Q β€” DOUBLE PRECISION array, 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 (H,T), 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 PRECISION array, 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 PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
  • 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.

  • INFO β€” INTEGER.
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • = 1,...,N: the QZ iteration did not converge. (H,T) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFO+1,...,N should be correct.
    • = N+1,...,2*N: the shift calculation failed. (H,T) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFO-N+1,...,N should 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 since ILAST was last changed. This is therefore reset only when a 1-by-1 or 2-by-2 block 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, TRANS specifies 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, M specifies the number of rows of the matrix A. M must be at least zero. Unchanged on exit.
  • N β€” INTEGER. On entry, N specifies the number of columns of the matrix A. N must be at least zero. Unchanged on exit.
  • ALPHA β€” DOUBLE PRECISION. On entry, ALPHA specifies the scalar alpha. Unchanged on exit.
  • A β€” DOUBLE PRECISION array, dimension ( LDA, n ). Before entry, the leading m by n part of the array A must contain the matrix of coefficients. Unchanged on exit.
  • LDA β€” INTEGER. On entry, LDA specifies the first dimension of A as declared in the calling (sub) program. LDA must be at least max( 1, m ). Unchanged on exit.
  • X β€” DOUBLE PRECISION array, dimension ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. Before entry, the incremented array X must contain the vector x. Unchanged on exit.
  • INCX β€” INTEGER. On entry, INCX specifies the increment for the elements of X. INCX must not be zero. Unchanged on exit.
  • BETA β€” DOUBLE PRECISION. On entry, BETA specifies the scalar beta. When BETA is supplied as zero then Y need not be set on input. Unchanged on exit.
  • Y β€” DOUBLE PRECISION array, dimension at least ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. Before entry with BETA non-zero, the incremented array Y must contain the vector y. On exit, Y is overwritten by the updated vector y.
  • INCY β€” INTEGER. On entry, INCY specifies the increment for the elements of Y. INCY must 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) = C
  • CMODE = 0 β†’ op2(C) = I
  • CMODE = -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 β€” 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 number of linear equations, i.e., the order of the matrix A. N >= 0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the 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 factorization A = P*L*U as computed by DGETRF.
  • 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 from the factorization A = P*L*U as computed by DGETRF; row i of the matrix was interchanged with row IPIV(i).
  • CMODE β€” CMODE is INTEGER. Determines op2(C) in the formula op(A) * op2(C) like so:
    • CMODE = 1 β†’ op2(C) = C
    • CMODE = 0 β†’ op2(C) = I
    • CMODE = -1 β†’ op2(C) = inv(C)
  • C β€” C is DOUBLE PRECISION array, dimension (N). The vector C in the formula op(A) * op2(C).
  • INFO β€” INFO is INTEGER.
    • = 0: Successful exit.
    • i > 0: The ith argument is invalid.
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (3*N). Workspace.
  • IWORK β€” IWORK is INTEGER array, 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_TYPE is INTEGER. Specifies the intermediate precision to be used in refinement. The value is defined by ILAPREC(P) where P is a CHARACTER and
    • P = 'S': Single
    • P = 'D': Double
    • P = 'I': Indigenous
    • P = 'X' or 'E': Extra
  • TRANS_TYPE β€” TRANS_TYPE is INTEGER. Specifies the transposition operation on A. The value is defined by ILATRANS(T) where T is a CHARACTER and T
    • = 'N': No transpose
    • = 'T': Transpose
    • = 'C': Conjugate transpose
  • N β€” N is INTEGER. The number of linear equations, i.e., 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 matrix B.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the 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 factorization A = P*L*U as computed by DGETRF.
  • 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 from the factorization A = P*L*U as computed by DGETRF; row i of the matrix was interchanged with row IPIV(i).
  • COLEQU β€” COLEQU is LOGICAL. If .TRUE. then column equilibration was done to A before calling this routine. This is needed to compute the solution and error bounds correctly.
  • C β€” C is DOUBLE PRECISION array, dimension (N). The column scale factors for A. If COLEQU = .FALSE., C is not accessed. If C is input, each element of C should 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 β€” B is DOUBLE PRECISION array, dimension (LDB,NRHS). The right-hand-side matrix B.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • Y β€” Y is DOUBLE PRECISION array, dimension (LDY,NRHS). On entry, the solution matrix X, as computed by DGETRS. On exit, the improved solution matrix Y.
  • LDY β€” LDY is INTEGER. The leading dimension of the array Y. LDY >= max(1,N).
  • BERR_OUT β€” BERR_OUT is DOUBLE PRECISION array, dimension (NRHS). On exit, BERR_OUT(j) contains the componentwise relative backward error for right-hand-side j from 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_NORMS is INTEGER. Determines which error bounds to return (see ERRS_N and ERRS_C).
    • If N_NORMS >= 1 return normwise error bounds.
    • If N_NORMS >= 2 return componentwise error bounds.
  • ERRS_N β€” ERRS_N is 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 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 threshold sqrt(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 threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.
  • err = 3 Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are 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_C
  • ERRS_C is DOUBLE 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 threshold sqrt(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 threshold sqrt(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 threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are 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 β€” RES is DOUBLE PRECISION array, dimension (N). Workspace to hold the intermediate residual.
  • AYB β€” AYB is DOUBLE PRECISION array, dimension (N). Workspace. This can be the same workspace passed for Y_TAIL.
  • DY β€” DY is DOUBLE PRECISION array, dimension (N). Workspace to hold the intermediate solution.
  • Y_TAIL β€” Y_TAIL is DOUBLE PRECISION array, dimension (N). Workspace to hold the trailing bits of the intermediate solution.
  • RCOND β€” RCOND is DOUBLE PRECISION. Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after 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 β€” ITHRESH is INTEGER. The maximum number of residual computations allowed for refinement. The default is 10. For 'aggressive' set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in ERRS_N and ERRS_C may no longer be trustworthy. πŸ‘€
  • RTHRESH β€” RTHRESH is DOUBLE PRECISION. Determines when to stop refinement if the error estimate stops decreasing. Refinement will stop when the next solution no longer satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The default value is 0.5. For 'aggressive' set to 0.9 to permit convergence on extremely ill-conditioned matrices. See LAWN 165 for more details.
  • DZ_UB β€” DZ_UB is DOUBLE PRECISION. Determines when to start considering componentwise convergence. Componentwise convergence is only considered after each component of the solution Y is stable, which we define as the relative change in each component being less than DZ_UB. The default value is 0.25, requiring the first bit to be stable. See LAWN 165 for more details.
  • IGNORE_CWISE β€” IGNORE_CWISE is LOGICAL. If .TRUE. then ignore componentwise convergence. Default value is .FALSE..
  • INFO β€” INFO is INTEGER
    • = 0: Successful exit.
    • < 0: if INFO = -i, the ith argument to DGETRS had 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 β€” N is INTEGER. The number of linear equations, i.e., the order of the matrix A. N >= 0.
  • NCOLS β€” NCOLS is INTEGER. The number of columns of the matrix A. NCOLS >= 0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the 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 factorization A = P*L*U as computed by DGETRF.
  • LDAF β€” LDAF is INTEGER. The leading dimension of the array AF. 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:

  • 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 as D(i)=-SIGN(A(i,i)), where A(i,i) is the value after performing i-1 steps 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);
  • 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 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 β€” 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 factorization A-S=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).
  • D β€” D is DOUBLE PRECISION array, dimension min(M,N). The diagonal elements of the diagonal M-by-N sign matrix S, D(i) = S(i,i), where 1 <= i <= min(M,N). The elements can be only plus or minus one.
  • INFO β€” INFO is INTEGER
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value

πŸ’– Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

πŸ’… Contributors:

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 as D(i)=-SIGN(A(i,i)), where A(i,i) is the value after performing i-1 steps 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 β€” 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 factorization A-S=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).
  • D β€” D is DOUBLE PRECISION array, dimension min(M,N). The diagonal elements of the diagonal M-by-N sign matrix S, D(i) = S(i,i), where 1 <= i <= min(M,N). The elements can be only plus or minus one. βš–οΈ
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value 😭

πŸ’œ Author πŸ’œ

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


🌸 Contributors: 🌸

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 β€” WANTS is CHARACTER*1.
    • = 'E': Compute eigenvalues only;
    • = 'S': Compute eigenvalues and the Schur form.
  • WANTQ β€” WANTQ is CHARACTER*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 product Q1*Q is returned.
  • WANTZ β€” WANTZ is CHARACTER*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 product Z1*Z is returned.
  • N β€” N is INTEGER. The order of the matrices A, B, Q, and Z. N >= 0.
  • ILO β€” ILO is INTEGER.
  • IHI β€” IHI is INTEGER. ILO and IHI mark the rows and columns of A which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA, N). On entry, the N-by-N upper Hessenberg matrix A. On exit, if JOB = 'S', A contains the upper quasi-triangular matrix S from the generalized Schur factorization. If JOB = 'E', the diagonal blocks of A match those of S, but the rest of A is unspecified.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max( 1, N ).
  • B β€” B is DOUBLE PRECISION array, dimension (LDB, N). On entry, the N-by-N upper triangular matrix B. On exit, if JOB = '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., if A(j+1,j) is non-zero, then B(j+1,j) = B(j,j+1) = 0, B(j,j) > 0, and B(j+1,j+1) > 0. If JOB = 'E', the diagonal blocks of B match those of P, but the rest of B is unspecified.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max( 1, N ).
  • ALPHAR β€” ALPHAR is DOUBLE PRECISION array, dimension (N). The real parts of each scalar alpha defining an eigenvalue of GNEP.
  • ALPHAI
  • ALPHAI β€” DOUBLE PRECISION array, 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 PRECISION array, 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 PRECISION array, 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 PRECISION array, 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 PRECISION array, 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: if INFO = -i, the i-th argument had an illegal value
    • = 1,...,N: the QZ iteration did not converge. (A,B) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFO+1,...,N should 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

  1. sr1 = sr2
  2. si = 0

This is useful for starting double implicit shift bulges in the QZ algorithm. πŸ‘‘

Parameters

  • A β€” DOUBLE PRECISION array, 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 PRECISION array, 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 PRECISION
  • SR2 β€” DOUBLE PRECISION
  • SI β€” DOUBLE PRECISION
  • BETA1 β€” DOUBLE PRECISION
  • BETA2 β€” DOUBLE PRECISION
  • V β€” DOUBLE PRECISION array, 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 β€” INTEGER
  • ISTOPM β€” 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 β€” INTEGER
  • A β€” DOUBLE PRECISION array, dimension (LDA,N)
  • LDA β€” INTEGER

The leading dimension of A as declared in the calling procedure.

  • B β€” DOUBLE PRECISION array, 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 PRECISION array, 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 PRECISION array, 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 β€” INTEGER
  • IHI β€” 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 PRECISION array, dimension (LDA, N)
  • LDA β€” INTEGER

The leading dimension of the array A. LDA >= max( 1, N ).

  • B β€” DOUBLE PRECISION array, dimension (LDB, N)
  • LDB β€” INTEGER

The leading dimension of the array B. LDB >= max( 1, N ).

  • Q β€” DOUBLE PRECISION array, dimension (LDQ, N)
  • LDQ β€” INTEGER
  • Z β€” DOUBLE PRECISION array, dimension (LDZ, N)
  • LDZ β€” (to be continued, bestie, the tea is still brewing β˜•)
  • LDZ β€” LDZ is INTEGER.
  • NS β€” NS is 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 β€” ND is INTEGER. The number of converged eigenvalues found. bestie found them πŸŽ€
  • ALPHAR β€” ALPHAR is DOUBLE PRECISION array, dimension (N). The real parts of each scalar alpha defining an eigenvalue of GNEP.
  • ALPHAI β€” ALPHAI is DOUBLE PRECISION array, dimension (N). The imaginary parts of each scalar alpha defining an eigenvalue of GNEP. And listen, the convention matters here: 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). they come in twos, always πŸ¦‹
  • BETA β€” BETA is DOUBLE PRECISION array, 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.
ok real talk πŸ’€ since either lambda or mu may overflow, they should not, in general, be computed. do not pass go, do not collect your eigenvalue.
  • QC β€” QC is DOUBLE PRECISION array, dimension (LDQC, NW).
  • LDQC β€” LDQC is INTEGER.
  • ZC β€” ZC is DOUBLE PRECISION array, dimension (LDZC, NW).
  • LDZC β€” LDZ is INTEGER. (that's literally what it says, I'm just the messenger πŸ’€)
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO >= 0, WORK(1) returns the optimal LWORK. it's a little receipt for future you 🧾
  • LWORK β€” LWORK is 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. so you're just asking, not doing πŸ’…

  • REC β€” REC is INTEGER. REC indicates the current recursion level. Should be set to 0 on first call. yes bestie, 0. first call. every time 🫢
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit 🌈
    • < 0: if INFO = -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 β€” ILSCHUR is LOGICAL. Determines whether or not to update the full Schur form.
  • ILQ β€” ILQ is LOGICAL. Determines whether or not to update the matrix Q.
  • ILZ β€” ILZ is LOGICAL. Determines whether or not to update the matrix Z.
  • N β€” N is INTEGER. The order of the matrices A, B, Q, and Z. 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. manifesting that block size πŸ¦‹
  • SR β€” SR is DOUBLE PRECISION array. SR contains the real parts of the shifts to use.
  • SI β€” SI is DOUBLE PRECISION array. SI contains the imaginary parts of the shifts to use.
  • SS β€” SS is DOUBLE PRECISION array. SS contains the scale of the shifts to use.
  • A β€” A is DOUBLE PRECISION array, dimension (LDA, N).
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max( 1, N ).
  • B β€” B is DOUBLE PRECISION array, dimension (LDB, N).
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max( 1, N ).
  • Q β€” Q is DOUBLE PRECISION array, dimension (LDQ, N).
  • LDQ β€” LDQ is INTEGER.
  • Z β€” Z is DOUBLE PRECISION array, dimension (LDZ, N).
  • LDZ β€” LDZ is INTEGER.
  • QC β€” QC is DOUBLE PRECISION array, dimension (LDQC, NBLOCK_DESIRED).
  • LDQC β€” LDQC is INTEGER.
  • ZC β€” ZC is DOUBLE PRECISION array, dimension (LDZC, NBLOCK_DESIRED).
  • LDZC β€” LDZ is INTEGER. (again!! it's the same bit, I promise I'm not messing with you πŸ’€)
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” LWORK is 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.

  • INFO β€” INFO is INTEGER.
    • = 0: successful exit 🌈
    • < 0: if INFO = -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 β€” SIDE is CHARACTER*1.
    • = 'R': compute right eigenvectors only;
    • = 'L': compute left eigenvectors only;
    • = 'B': compute both right and left eigenvectors.
  • HOWMNY β€” HOWMNY is CHARACTER*1.
    • = 'A': compute all right and/or left eigenvectors;
    • = 'B': compute all right and/or left eigenvectors, backtransformed by the matrices in VR and/or VL;
    • = 'S': compute selected right and/or left eigenvectors, specified by the logical array SELECT.
  • SELECT β€” SELECT is LOGICAL array, dimension (N). If HOWMNY='S', SELECT specifies the eigenvectors to be computed. If w(j) is a real eigenvalue, the corresponding real eigenvector is computed if SELECT(j) is .TRUE.. If w(j) and w(j+1) are the real and imaginary parts of a complex eigenvalue, the corresponding complex eigenvector is computed if either SELECT(j) or SELECT(j+1) is .TRUE., and on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to .FALSE.. Not referenced if HOWMNY = 'A' or 'B'. it edits itself, main character behaviour πŸ’…
  • N β€” N is INTEGER. The order of the matrices S and P. N >= 0.
  • S β€” S is DOUBLE PRECISION array, dimension (LDS,N). The upper quasi-triangular matrix S from a generalized Schur factorization, as computed by DHGEQZ.
  • LDS β€” LDS is INTEGER. The leading dimension of array S. LDS >= max(1,N).
  • P β€” P is DOUBLE PRECISION array, dimension (LDP,N). The upper triangular matrix P from a generalized Schur factorization, as computed by DHGEQZ. And heads up: 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S must be in positive diagonal form. non-negotiable 🚨
  • LDP β€” LDP is INTEGER. The leading dimension of array P. LDP >= max(1,N).
  • VL β€” VL is DOUBLE PRECISION array, dimension (LDVL,MM).
    • On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must contain an N-by-N matrix Q (usually the orthogonal matrix Q of left Schur vectors returned by DHGEQZ).
    • On exit, if SIDE = 'L' or 'B', VL contains:
      • if HOWMNY = 'A', the matrix Y of left eigenvectors of (S,P);
      • if HOWMNY = 'B', the matrix Q*Y;
      • if HOWMNY = 'S', the left eigenvectors of (S,P) specified by SELECT, stored consecutively in the columns of VL, 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 if SIDE = 'R'.

  • LDVL β€” LDVL is INTEGER. It's the leading dimension of array VL. LDVL >= 1, and if SIDE = 'L' or SIDE = 'B', then LDVL >= N. πŸ‘‘
  • VR β€” VR is DOUBLE PRECISION array, dimension (LDVR,MM). On entry, if SIDE = 'R' or SIDE = 'B' and HOWMNY = 'B', VR must contain an N-by-N matrix Z (usually the orthogonal matrix Z of right Schur vectors returned by DHGEQZ). πŸ¦‹ On exit, if SIDE = 'R' or SIDE = 'B', VR contains:
    • if HOWMNY = 'A', the matrix X of right eigenvectors of (S,P);
    • if HOWMNY = 'B' or 'b', the matrix Z*X;
    • if HOWMNY = 'S' or 's', the right eigenvectors of (S,P) specified by SELECT, stored consecutively in the columns of VR, 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 if SIDE = 'L'.
  • LDVR β€” LDVR is INTEGER. Leading dimension of the array VR. LDVR >= 1, and if SIDE = 'R' or SIDE = 'B', LDVR >= N. πŸ’–
  • MM β€” MM is INTEGER. The number of columns in the arrays VL and/or VR. MM >= M. πŸŽ€
  • M β€” M is INTEGER. The number of columns in the arrays VL and/or VR actually used to store the eigenvectors. If HOWMNY = 'A' or HOWMNY = 'B', M is set to N. Each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns. πŸ’œ
  • WORK β€” WORK is DOUBLE PRECISION array, dimension (6*N). 🌸
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit. βœ…
    • < 0: if INFO = -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 β€” WANTQ is LOGICAL.
    • .TRUE.: update the left transformation matrix Q; βœ…
    • .FALSE.: do not update Q. πŸ™…
  • WANTZ β€” WANTZ is LOGICAL.
    • .TRUE.: update the right transformation matrix Z; βœ…
    • .FALSE.: do not update Z. πŸ™…
  • N β€” N is INTEGER. The order of the matrices A and B. N >= 0. ✨
  • A β€” A is DOUBLE PRECISION array, dimension (LDA,N). On entry, the matrix A in generalized real Schur canonical form. On exit, the updated matrix A, again in generalized real Schur canonical form. πŸ’–
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,N). πŸ‘‘
  • B β€” B is DOUBLE PRECISION array, dimension (LDB,N). On entry, the matrix B in generalized real Schur canonical form (A,B). On exit, the updated matrix B, again in generalized real Schur canonical form (A,B). πŸ¦‹
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N). πŸ’…
  • Q β€” Q is DOUBLE PRECISION array, dimension (LDQ,N). On entry, if WANTQ = .TRUE., the orthogonal matrix Q. On exit, the updated matrix Q. If WANTQ = .FALSE., Q is not referenced. πŸŽ€
  • LDQ β€” LDQ is INTEGER. The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= N. ✨
  • Z β€” Z is DOUBLE PRECISION array, dimension (LDZ,N). On entry, if WANTZ = .TRUE., the orthogonal matrix Z. On exit, the updated matrix Z. If WANTZ = .FALSE., Z is not referenced. πŸ’œ
  • LDZ β€” LDZ is INTEGER. The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= N. 🌸
  • IFST β€” IFST is INTEGER. 🌟
  • ILST β€” ILST is INTEGER. Specify the reordering of the diagonal blocks of (A, B). The block with row index IFST is moved to row ILST, by a sequence of swapping between adjacent blocks. On exit, if IFST pointed on entry to the second row of a 2-by-2 block, it is changed to point to the first row; ILST always 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 β€” WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. πŸ’–
  • LWORK β€” LWORK is INTEGER. The dimension of the array WORK. LWORK >= 1 when N <= 1, otherwise LWORK >= 4*N + 16. 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: if INFO = -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, and ILST points 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 β€” 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. πŸ¦‹
  • 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: the M-by-N matrix A. On exit: the elements on and below the diagonal hold the M-by-MIN(M,N) lower trapezoidal matrix L (and L is lower triangular when M <= N, slay); the elements above the diagonal are the rows of V.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. 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 array T. 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: if INFO = -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 matrix A. M =< N. (yes, =<, that's how it's written, don't @ me)
  • N β€” N is INTEGER. The number of columns of the matrix A. N >= 0.
  • A β€” A is REAL array, dimension (LDA,N). On entry: the real M-by-N matrix A. On exit: the elements on and below the diagonal contain the N-by-N lower triangular matrix L; the elements above the diagonal are the rows of V. See below for the tea β˜•
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • T β€” T is REAL 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 (they're just there, existing, not our problem πŸ’€). 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: if INFO = -i, the i-th argument had an illegal value.

πŸ‘‘ Author πŸ‘‘

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


✨ 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': apply Q or Q**T from the Left;
    • = 'R': apply Q or Q**T from the Right.
  • TRANS β€” TRANS is CHARACTER*1.
    • = 'N': No transpose, apply Q;
    • = 'C': Transpose, apply Q**T.
  • M β€” M is INTEGER. The number of rows of the matrix C. M >= 0.
  • N β€” N is INTEGER. The number of columns of the matrix C. N >= 0.
  • K β€” K is INTEGER. The number of elementary reflectors whose product defines the matrix Q. If SIDE = 'L', M >= K >= 0; if SIDE = 'R', N >= K >= 0.
  • MB β€” MB is INTEGER. The block size used for the storage of T. K >= MB >= 1. This must be the same value of MB used to generate T in SGELQT. 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 array V. LDV >= max(1,K).
  • T β€” T is REAL array, dimension (LDT,K). The upper triangular factors of the block reflectors as returned by SGELQT, stored as a MB-by-K matrix.
  • LDT β€” LDT is INTEGER. The leading dimension of the array T. LDT >= MB.
  • C β€” C is REAL array, dimension (LDC,N). On entry: the M-by-N matrix C. On exit: C is overwritten by Q C, Q**T C, C Q**T or C Q. Pick your fighter βš”οΈ
  • LDC β€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • WORK β€” WORK is REAL array. The dimension of WORK is N*MB if SIDE = 'L', or M*MB if SIDE = 'R'.
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit ✨
    • < 0: if INFO = -i, the i-th argument had an illegal value.

πŸ‘‘ Author πŸ‘‘

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


πŸ¦‹ 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 β€” WANTS is CHARACTER*1, and it's literally telling you what to compute:
    • = 'E': Compute eigenvalues only;
    • = 'S': Compute eigenvalues and the Schur form.
  • WANTQ β€” WANTQ is CHARACTER*1, bestie:
    • = '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 product Q1*Q is returned.
  • WANTZ β€” WANTZ is CHARACTER*1, no cap:
    • = '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 product Z1*Z is returned.
  • N β€” N is INTEGER. The order of the matrices A, B, Q, and Z. N >= 0.
  • ILO β€” ILO is INTEGER.
  • IHI β€” IHI is INTEGER. ILO and IHI mark the rows and columns of A which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  • A β€” A is REAL array, dimension (LDA, N).
    • On entry, the N-by-N upper Hessenberg matrix A.
    • On exit, if JOB = 'S', A contains the upper quasi-triangular matrix S from the generalized Schur factorization.
    • If JOB = 'E', the diagonal blocks of A match those of S, but the rest of A is unspecified.
  • LDA β€” LDA is INTEGER. The leading dimension of the array A. LDA >= max( 1, N ).
  • B β€” B is REAL array, dimension (LDB, N).
    • On entry, the N-by-N upper triangular matrix B.
    • On exit, if JOB = '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., if A(j+1,j) is non-zero, then B(j+1,j) = B(j,j+1) = 0, B(j,j) > 0, and B(j+1,j+1) > 0.
    • If JOB = 'E', the diagonal blocks of B match those of P, but the rest of B is unspecified.
  • LDB β€” LDB is INTEGER. The leading dimension of the array B. LDB >= max( 1, N ).
  • 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. If ALPHAI(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, with ALPHAI(j+1) = -ALPHAI(j).
  • BETA β€” BETA is REAL array, 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.
  • Q β€” Q is REAL array, 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 β€” LDQ is INTEGER. The leading dimension of the array Q. LDQ >= 1. If COMPQ='V' or 'I', then LDQ >= N.
  • Z β€” Z is REAL array, 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 β€” LDZ is INTEGER. The leading dimension of the array Z. LDZ >= 1. If COMPZ='V' or 'I', then LDZ >= N.
  • WORK β€” WORK is REAL array, dimension (MAX(1,LWORK)). On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” LWORK is 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.
  • REC β€” REC is INTEGER. REC indicates the current recursion level. Should be set to 0 on first call.
  • INFO β€” INFO is INTEGER.
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • = 1,...,N: the QZ iteration did not converge. (A,B) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFO+1,...,N should 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 β€” A is REAL array, dimension (LDA,N). The 3-by-3 matrix A in (*).
  • LDA β€” LDA is INTEGER. The leading dimension of A as declared in the calling procedure.
  • B β€” B is REAL array, dimension (LDB,N). The 3-by-3 matrix B in (*).
  • LDB β€” LDB is INTEGER. The leading dimension of B as declared in the calling procedure.
  • SR1 β€” SR1 is REAL.
  • SR2 β€” SR2 is REAL.
  • SI β€” SI is REAL.
  • BETA1 β€” BETA1 is REAL.
  • BETA2 β€” BETA2 is REAL.
  • V β€” V is REAL array, dimension (N). A scalar multiple of the first column of the matrix K in (*).

πŸ‘‘ 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 β€” ILQ is LOGICAL. Determines whether or not to update the matrix Q
  • ILZ β€” ILZ is LOGICAL. Determines whether or not to update the matrix Z
  • K β€” K is 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 β€” ISTARTM is INTEGER.
  • ISTOPM β€” ISTOPM is 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 β€” IHI is INTEGER.
  • A β€” A is REAL array, dimension (LDA,N).
  • LDA β€” LDA is INTEGER. The leading dimension of A as declared in the calling procedure.
  • B β€” B is REAL array, dimension (LDB,N).
  • LDB β€”
  • LDB β€” LDB is INTEGER. it's the leading dimension of B, exactly like you declared it in the calling procedure. no cap πŸ’…
  • NQ β€” NQ is INTEGER. the order of the matrix Q. that's the whole vibe ✨
  • QSTART β€” QSTART is INTEGER. the start index of the matrix Q. rotations get applied to columns k+2-qStart:k+4-qStart of Q. πŸŽ€
  • Q β€” Q is REAL array, dimension (LDQ,NQ) πŸ’–
  • LDQ β€” LDQ is INTEGER. leading dimension of Q, as declared in the calling procedure, bestie 🫢
  • NZ β€” NZ is INTEGER. the order of the matrix Z. iconic 🌸
  • ZSTART β€” ZSTART is INTEGER. start index of the matrix Z. rotations get applied to columns k+1-qStart:k+3-qStart of Z. yes it really says qStart in 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 of Q as 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 matrix Q πŸ’–
  • ILZ β€” ILZ is LOGICAL. determines whether or not to update the matrix Z πŸ’œ
  • N β€” N is INTEGER. the order of the matrices A, B, Q, and Z. N >= 0. 🌸
  • ILO β€” ILO is INTEGER πŸ¦‹
  • IHI β€” IHI is INTEGER. ILO and IHI mark 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 array A. LDA >= max( 1, N ). 🫢
  • B β€” B is REAL array, dimension (LDB, N) 🌈
  • LDB β€” LDB is INTEGER. the leading dimension of the array B. 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. if ALPHAI(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, with ALPHAI(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 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. ⚠️ like genuinely do not compute them, bestie
  • QC β€” QC is REAL array, dimension (LDQC, NW) πŸ’–
  • LDQC β€” LDQC is INTEGER 🌸
  • ZC β€” ZC is REAL array, dimension (LDZC, NW) πŸ’œ
  • LDZC β€” and it says LDZ is INTEGER in the original (not LDZC, we are simply reporting the lore) 😭
  • WORK β€” WORK is REAL array, dimension (MAX(1,LWORK)). on exit, if INFO >= 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” LWORK is 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. 🫢

  • REC β€” REC is INTEGER. REC indicates the current recursion level. should be set to 0 on first call. πŸ“Œ
  • INFO β€” INFO is INTEGER
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -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 matrix Q πŸ’–
  • ILZ β€” ILZ is LOGICAL. determines whether or not to update the matrix Z πŸ’œ
  • N β€” N is INTEGER. the order of the matrices A, B, Q, and Z. 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. SR contains the real parts of the shifts to use. 🌈
  • SI β€” SI is REAL array. SI contains the imaginary parts of the shifts to use. ⭐
  • SS β€” SS is REAL array. SS contains the scale of the shifts to use. 🫢
  • A β€” A is REAL array, dimension (LDA, N) πŸ’–
  • LDA β€” LDA is INTEGER. the leading dimension of the array A. LDA >= max( 1, N ). 🌸
  • B β€” B is REAL array, dimension (LDB, N) πŸ’œ
  • LDB β€” LDB is INTEGER. the leading dimension of the array B. 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 says LDZ is INTEGER, and honestly we just report the lore as it is 😭
  • WORK β€” WORK is REAL array, dimension (MAX(1,LWORK)). on exit, if INFO >= 0, WORK(1) returns the optimal LWORK. πŸ’–
  • LWORK β€” LWORK is 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. 🌸

  • INFO β€” INFO is INTEGER
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -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 matrix A. M >= 0. 🌸
  • N β€” N is INTEGER. the number of columns of the matrix A. 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