SRC/sgeqrt.f(3)

✨ SRC/sgeqrt.f ✨

ok so bestie, this page is from the LAPACK Library Functions Manual and it's literally all about one little subroutine that does blocked QR factorization. let's get into it πŸ’…


🌸 SYNOPSIS 🌸

πŸŽ€ Functions/Subroutines

subroutine sgeqrt (m, n, nb, a, lda, t, ldt, work, info)

that's SGEQRT, bestie. iconic name, iconic subroutine.


πŸ’– Function/Subroutine Documentation πŸ’–

subroutine sgeqrt (integer m, integer n, integer nb, real, dimension( lda, * ) a, integer lda, real, dimension( ldt, * ) t, integer ldt, real, dimension( * ) work, integer info)

SGEQRT β€” say it with me 🫢

⭐ Purpose

!> !> SGEQRT computes a blocked QR factorization of a real M-by-N matrix A !> using the compact WY representation of Q. !>

so yeah β€” it takes your real M-by-N matrix A and computes a blocked QR factorization, and it does it with the compact WY representation of Q. that's the whole vibe. 😌


🌈 Parameters 🌈

  • M β€” M is INTEGER. it's the number of rows of the matrix A, and the constraint is M >= 0. no negatives, we don't do that here. ✨
  • N β€” N is INTEGER. the number of columns of the matrix A, with N >= 0. again, no negative energy. πŸ™…β€β™€οΈ
  • NB β€” NB is INTEGER. this is the block size used in the blocked QR, and the rule is MIN(M,N) >= NB >= 1. so it's gotta be at least 1 and no bigger than MIN(M,N). πŸŽ€
  • A β€” A is REAL array, dimension (LDA,N). on entry it's 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 (and R is upper triangular if M >= N, slay), while the elements below the diagonal are the columns of V. she transforms, ok?? πŸ’…
  • LDA β€” LDA is INTEGER. leading dimension of the array A, and LDA >= max(1,M). respect the leading dimension fr fr. ⭐
  • T β€” T is REAL array, dimension (LDT,MIN(M,N)). this holds the upper triangular block reflectors stored in compact form as a sequence of upper triangular blocks. see below for the details, bestie, it's all spelled out πŸ’–
  • LDT β€” LDT is INTEGER. leading dimension of the array T, with LDT >= NB. that's the rule. πŸ¦‹
  • WORK β€” WORK is REAL array, dimension (NB*N). that's it, that's the workspace. 🧚
  • INFO β€” INFO is INTEGER. the vibe check of return values:
    • = 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.

the whole squad really came together for this one 🫢


πŸ’œ 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). !>

ok so let me translate that for you because it's actually kind of gorgeous 😭

the matrix V stores the elementary reflectors H(i) in the i-th column below the diagonal. like, if M=5 and N=3, then:

V = (  1       )
    ( v1  1    )
    ( v1 v2  1 )
    ( v1 v2 v3 )
    ( v1 v2 v3 )

the vi's are the vectors that define H(i), and they get returned in the matrix A. and the 1's along the diagonal of V? not stored in A. they're just implied, main character energy, they don't need to be written down πŸ’…

then let K=MIN(M,N). the number of blocks is B = ceiling(K/NB), and each block is of order NB except the last one, which is of order IB = K - (B-1)*NB. for each of the B blocks a upper triangular block reflector factor gets computed: T1, T2, ..., TB. and the NB-by-NB ones (and the IB-by-IB one for the last block) get stored in the NB-by-K matrix T like this:

T = (T1 T2 ... TB).

look at her. organized. compact. stunning. πŸŽ€βœ¨

lowkey important: Definition at line 140 of file sgeqrt.f. that's where she lives, bestie 🏑

⭐ Author ⭐

Generated automatically by Doxygen for LAPACK from the source code. so like, nobody hand-wrote this, the tooling did it, and honestly? respect. πŸ€–πŸ’–


and that's the whole page!! LAPACK, Version 3.12.0, SRC/sgeqrt.f(3) β€” go forth and factorize your little heart out, bestie πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from