SRC/cgelq2.f(3)

πŸ’… SRC/cgelq2.f β€” the LAPACK manual, but make it make sense

okay bestie, this page is from the LAPACK Library Functions Manual and it's literally about one little subroutine in SRC/cgelq2.f that's about to become your whole personality. it computes an LQ factorization. unblocked. no cap. let's get into it πŸŽ€


✨ SYNOPSIS ✨

functions & subroutines

subroutine cgelq2 (m, n, a, lda, tau, work, info)

CGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm. that's the whole gig. iconic behavior fr fr πŸ¦‹


🌸 Function/Subroutine Documentation 🌸

subroutine cgelq2 (integer m, integer n, complex, dimension( lda, * ) a,
    integer lda, complex, dimension( * ) tau, complex, dimension( * ) work,
    integer info)

CGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm. (yes she said it twice, she's thorough like that πŸ’…)

🫢 Purpose

!>
!> CGELQ2 computes an LQ factorization of a complex 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.
!>
!>

so like, A gets split into that ( L 0 ) situation times Q. Q is n-by-n and orthogonal, L is lower-triangular m-by-m, and that zero block is m-by-(n-m) β€” but only if m < n. the way the math just works πŸ˜­πŸ‘‘

πŸŽ€ Parameters

  • M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!>

the row count, bestie. it's an INTEGER and it has to be M >= 0. no negative rows, that's not a thing.

  • N
!>          N is INTEGER
!>          The number of columns of the matrix A.  N >= 0.
!>

the column count. also an INTEGER, also N >= 0. we love a non-negative queen.

  • 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,
!>          with the array TAU, represent the unitary matrix Q as a
!>          product of elementary reflectors (see Further Details).
!>

so she goes in as the m by n matrix A, and she comes out transformed πŸ”₯ on exit, everything on and below the diagonal holds that m by min(m,n) lower trapezoidal matrix L (and L is lower triangular if m <= n β€” note that). everything above the diagonal, together with the TAU array, represents the unitary matrix Q as a product of elementary reflectors. further details below, iykyk.

  • LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!>

leading dimension of A, INTEGER, and it's gotta satisfy LDA >= max(1,M). that's the vibe check, don't fail it.

  • TAU
!>          TAU is COMPLEX array, dimension (min(M,N))
!>          The scalar factors of the elementary reflectors (see Further
!>          Details).
!>

the scalar factors of the elementary reflectors, dimension min(M,N). she's the supporting cast but honestly she's carrying the plot.

  • WORK
!>          WORK is COMPLEX array, dimension (M)
!>

scratch space, COMPLEX, dimension (M). just vibing in the background so the math can happen.

  • INFO
!>          INFO is INTEGER
!>          = 0: successful exit
!>          < 0: if INFO = -i, the i-th argument had an illegal value
!>

the receipts 🧾 it's an INTEGER. = 0 means successful exit, slay. < 0 means if INFO = -i, the i-th argument had an illegal value β€” so like, somebody passed something cursed and now you know exactly which one.

πŸ‘‘ Author

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

the whole squad. respect. 🫑

🌈 Further Details:

!>
!>  The matrix Q is represented as a product of elementary reflectors
!>
!>     Q = H(k)**H . . . H(2)**H H(1)**H, where k = min(m,n).
!>
!>  Each H(i) has the form
!>
!>     H(i) = I - tau * v * v**H
!>
!>  where tau is a complex scalar, and v is a complex vector with
!>  v(1:i-1) = 0 and v(i) = 1; conjg(v(i+1:n)) is stored on exit in
!>  A(i,i+1:n), and tau in TAU(i).
!>

okay this is the lore ✨ Q is that product of elementary reflectors, with k = min(m,n). each H(i) has the form H(i) = I - tau * v * v**H, where tau is a complex scalar and v is a complex vector with v(1:i-1) = 0 and v(i) = 1. on exit, conjg(v(i+1:n)) is stored in A(i,i+1:n), and tau lives in TAU(i). read it twice, it slaps. πŸ’œ


πŸ’€ heads up: definition at line 128 of file cgelq2.f. that's where the actual source lives, go look if you're nosy (respectfully).

⭐ sign-off ⭐

that's the whole page, bestie! this beauty is from LAPACK, Version 3.12.0 β€” generated automatically by Doxygen for LAPACK from the source code, dated at the bottom of the original as LAPACK Version 3.12.0 SRC/cgelq2.f(3). mwah πŸ’‹ go factorize something rectangular. πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from