SGEHRD(3)
๐ 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
Nis 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
IHIis INTEGER It is assumed that A is already upper triangular in rows and columns1:ILO-1andIHI+1:N. ILO and IHI are normally set by a previous call toSGEBAL; otherwise they should be set to1andNrespectively. See Further Details.1 <= ILO <= IHI <= N, ifN > 0;ILO=1andIHI=0, ifN=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
Ais 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
LDAis INTEGER The leading dimension of the array A.LDA >= max(1,N).
leading dimension, the classic. max(1,N), don't @ me ๐
TAU
TAUis REAL array, dimension(N-1)The scalar factors of the elementary reflectors (see Further Details). Elements1:ILO-1andIHI:N-1of TAU are set to zero.
the scalar factor girlies ๐ and yes, those specific elements get zeroed out, that's canon
WORK
WORKis REAL array, dimension(LWORK)On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.
scratch space, but make it โจinformativeโจ
LWORK
LWORKis INTEGER The length of the array WORK.LWORK >= max(1,N). For good performance,LWORKshould generally be larger. IfLWORK = -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 byXERBLA.
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
INFOis INTEGER= 0: successful exit< 0: ifINFO = -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 reflectorsfortran Q = H(ilo) H(ilo+1) . . . H(ihi-1).EachH(i)has the formfortran H(i) = I - tau * v * v**Twhere tau is a real scalar, and v is a real vector withv(1:i) = 0,v(i+1) = 1andv(ihi+1:n) = 0;v(i+2:ihi)is stored on exit inA(i+2:ihi,i), and tau inTAU(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, withn = 7,ilo = 2andihi = 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
whereadenotes an element of the original matrix A,hdenotes a modified element of the upper Hessenberg matrix H, andvidenotes an element of the vector definingH(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
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms