SGEHRD(3)

๐Ÿ“ฆ version 3.12.0, in opensuse-leap 16.0

๐Ÿ’… SGEHRD(3) โ€” like, the LAPACK manual page bestie ๐ŸŽ€

okay so first things first: the manual name situation is a lil unhinged ngl โ€” this page lives at /home/abui...RC/sgehrd.f(3), which is Doxygen-speak for "the sgehrd.f source file, page 3 of the generated docs." Don't worry about the truncated path, it's just the build dir doing its thing โœจ


โœจ NAME โœจ

/home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/sgehrd.f โ€” that's literally it, that's the whole name section, the file itself is the star of the show ๐Ÿ‘‘


๐ŸŒธ SYNOPSIS ๐ŸŒธ

Functions/Subroutines

subroutine SGEHRD (n, ilo, ihi, a, lda, tau, work, lwork, info)

SGEHRD. Yeah. That's the whole vibe check ๐Ÿฆ‹


๐Ÿ’– Function/Subroutine Documentation ๐Ÿ’–

subroutine SGEHRD (integer n, integer ilo, integer ihi, real, dimension(
    lda, * ) a, integer lda, real, dimension( * ) tau, real, dimension( * )
    work, integer lwork, integer info)

SGEHRD. still iconic, still the same name ๐Ÿ’ซ

๐Ÿซถ Purpose:

SGEHRD reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H .

no cap, that's the whole mission statement ๐Ÿ”ฅ


โญ Parameters

N

N is INTEGER The order of the matrix A. N >= 0.

so like, how big is your matrix, bestie. zero is allowed, we don't judge ๐Ÿ’œ

ILO

ILO is INTEGER

that's it. that's the description. the man page said what it said ๐Ÿ™ˆ

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 SGEBAL; otherwise they should be set to 1 and N respectively. See Further Details. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.

okay so this is the "which part of the matrix are we actually touching" window ๐ŸชŸ and please note the edge case for N=0, because of course there's an edge case ๐Ÿซ 

A

A is REAL 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.

translation: your matrix gets rewritten, she gets a glow-up in place, and the leftover bits are secretly Q ๐Ÿ‘€ (see Further Details, fr fr)

LDA

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

leading dimension, the classic. max(1,N), don't @ me ๐Ÿ’…

TAU

TAU is REAL 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.

the scalar factor girlies ๐Ÿ’ and yes, those specific elements get zeroed out, that's canon

WORK

WORK is REAL array, dimension (LWORK) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

scratch space, but make it โœจinformativeโœจ

LWORK

LWORK is INTEGER The length of the array WORK. LWORK >= max(1,N). For good performance, LWORK should generally be larger. 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 LWORK = -1 is the little "hey how much room do I need" cheat code ๐Ÿ”ฎ and lowkey the best part: XERBLA isn't gonna yell at you for it ๐Ÿ’€

INFO

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

zero = slay, negative = the i-th argument was out of pocket and got called out ๐ŸŒˆ


๐Ÿ‘‘ Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

the whole squad ๐Ÿซถ


๐Ÿงš Further Details:

The matrix Q is represented as a product of (ihi-ilo) elementary reflectors fortran Q = H(ilo) H(ilo+1) . . . H(ihi-1). Each H(i) has the form fortran 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).

okay so THIS is where the tea is โ˜• those reflectors are stacked up like a group chat and Q is literally all of them combined, periodt ๐Ÿ’…

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 )

the before/after of it all ๐Ÿ˜ญ look at those v2 v3 v4 lil reflectors moving in, they're literally the main characters now

where a denotes an element of the original matrix A, h denotes a modified element of the upper Hessenberg matrix H, and vi denotes an element of the vector defining H(i).
This file is a slight modification of LAPACK-3.0's SGEHRD subroutine incorporating improvements proposed by Quintana-Orti and Van de Geijn (2006). (See SLAHR2.)

ngl that's a glow-up with receipts, 2006 called and it ate ๐Ÿ“žโœจ


๐Ÿฆ‹ Definition at line 166 of file sgehrd.f.

line 166, noted, iconic, bookmarked ๐Ÿ”–


๐ŸŽ€ Author (again, yes, really)

Generated automatically by Doxygen for LAPACK from the source code.

the robots wrote the docs, we just made them cute ๐Ÿค–๐Ÿ’–


so yeah, that's SGEHRD, she reduces, she reflects, she's upper Hessenberg by the time you're done ๐Ÿ’… shoutout to LAPACK, Version 3.12.0, this page courtesy of /home/abui...RC/sgehrd.f(3), dated per that footer โ€” love you, mean it, bye bestie ๐Ÿ“๐Ÿงš๐Ÿ’œ

๐Ÿ“ฆ where this page comes from