ZHETRD(3)

πŸ“¦ version 3.12.0, in opensuse-leap 16.0

πŸ¦‹ ZHETRD β€” the girlies are reducing a complex Hermitian matrix to tridiagonal form ✨

ok so real quick before we get into it: this is zhetrd.f, and the full path the manual screams at you is /home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/SRC/zhetrd.f β€” that's the NAME, that's the file, that's where she lives πŸ’…. It's ZHETRD, a subroutine from the LAPACK library functions manual, and she's lowkey doing SO much. Buckle up bestie πŸŽ€


✨ SYNOPSIS ✨

ok so the functions/subroutines section literally just says this:

subroutine ZHETRD (uplo, n, a, lda, d, e, tau, work, lwork, info)

and then, like, also:

ZHETRD

that's it. that's the whole vibe. moving on 🫢


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

🌸 the full signature, bestie

subroutine ZHETRD (character uplo, integer n, complex*16, dimension( lda, * ) a, integer lda, double precision, dimension( * ) d, double precision, dimension( * ) e, complex*16, dimension( * ) tau, complex*16, dimension( * ) work, integer lwork, integer info)

yes that's a lot of arguments, no we're not skipping any of them, and yes, her name is ZHETRD πŸ’œ

πŸ”₯ Purpose πŸ”₯

ok so what does she Actually do. here it is, straight up:

ZHETRD reduces a complex Hermitian matrix A to real symmetric tridiagonal form T by a unitary similarity transformation: Q**H * A * Q = T.

iconic. she takes your fancy complex Hermitian situation and gives you a nice tidy tridiagonal queen. periodt ✨


πŸŽ€ Parameters πŸŽ€

UPLO

  • UPLO is CHARACTER*1
  • = 'U': the upper triangle of A is stored, slay
  • = 'L': the lower triangle of A is stored

pick a side bestie, there's no third option πŸ’€

N

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

A

  • A is COMPLEX*16 array, dimension (LDA,N)
  • on entry, the Hermitian matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced.
  • on exit, if UPLO = 'U', the diagonal and first superdiagonal of A are overwritten by the corresponding elements of the tridiagonal matrix T, and the elements above the first superdiagonal, with the array TAU, represent the unitary matrix Q as a product of elementary reflectors; if UPLO = 'L', the diagonal and first subdiagonal of A are overwritten by the corresponding elements of the tridiagonal matrix T, and the elements below the first subdiagonal, with the array TAU, represent the unitary matrix Q as a product of elementary reflectors. See Further Details β€” she's got lore πŸ’…
bestie she gets overwritten. like, on exit A is not your original matrix anymore. it's giving main character transformation arc. emotionally prepare πŸ¦‹

LDA

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

D

  • D is DOUBLE PRECISION array, dimension (N)
  • the diagonal elements of the tridiagonal matrix T: D(i) = A(i,i).

E

  • E is DOUBLE PRECISION array, dimension (N-1)
  • the off-diagonal elements of the tridiagonal matrix T: E(i) = A(i,i+1) if UPLO = 'U', E(i) = A(i+1,i) if UPLO = 'L'.

TAU

  • TAU is COMPLEX*16 array, dimension (N-1)
  • the scalar factors of the elementary reflectors (see Further Details).

WORK

  • WORK is COMPLEX*16 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.
  • 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.
so LWORK = -1 is not an error, it's a mood. she's just peeking at how much space she'd want, no drama, no XERBLA yelling πŸ™ˆ

INFO

  • INFO is INTEGER
  • = 0: successful exit πŸŽ‰
  • < 0: if INFO = -i, the i-th argument had an illegal value

πŸ‘‘ Author πŸ‘‘

these absolute legends wrote her:

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

give them their flowers πŸ’


🌈 Further Details 🌈

ok this is the good part, the lore drop, the iykyk section ✨

If UPLO = 'U', the matrix Q is represented as a product of elementary reflectors

Q = H(n-1) . . . H(2) H(1).

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(i+1:n) = 0 and v(i) = 1; v(1:i-1) is stored on exit in A(1:i-1,i+1), and tau in TAU(i).

If UPLO = 'L', the matrix Q is represented as a product of elementary reflectors

Q = H(1) H(2) . . . H(n-1).

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) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in A(i+2:n,i), and tau in TAU(i).

The contents of A on exit are illustrated by the following examples with n = 5:

if UPLO = 'U':                       if UPLO = 'L':

  (  d   e   v2  v3  v4 )              (  d                  )
  (      d   e   v3  v4 )              (  e   d              )
  (          d   e   v4 )              (  v1  e   d          )
  (              d   e  )              (  v1  v2  e   d      )
  (                  d  )              (  v1  v2  v3  e   d  )

where d and e denote diagonal and off-diagonal elements of T, and vi denotes an element of the vector defining H(i).

literally a whole before-and-after of your matrix. screenshot it, it's iconic πŸ“Έ

⭐ Definition at line 191 of file zhetrd.f. ⭐

yes bestie, line 191, that's where the magic starts πŸ’«


🌸 Author (the other one) 🌸

Generated automatically by Doxygen for LAPACK from the source code.

not a human, a robot, and honestly she ate πŸ€–πŸ’…


ok that's the whole page 🫢 she's LAPACK, Version 3.12.0, and the file is /home/abui...RC/zhetrd.f(3) β€” mwah, go reduce something gorgeous, drink water, and remember: Q**H * A * Q = T βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from