laev2(3)

✨ laev2(3) β€” the 2x2 eig situation πŸ’…

Okay bestie, sit down, grab a strawberry πŸ“, because we're talking about laev2 β€” the laev2: 2x2 eig of the LAPACK library functions manual. It's the little family of subroutines that computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. Yes, only 2-by-2. Yes, it's iconic. No cap.


🌸 SYNOPSIS 🌸

🫢 Functions

  • subroutine claev2 (a, b, c, rt1, rt2, cs1, sn1) β€” CLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix.
  • subroutine dlaev2 (a, b, c, rt1, rt2, cs1, sn1) β€” DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix.
  • subroutine slaev2 (a, b, c, rt1, rt2, cs1, sn1) β€” SLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix.
  • subroutine zlaev2 (a, b, c, rt1, rt2, cs1, sn1) β€” ZLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix.

πŸ’– Detailed Description πŸ’–

Honestly? This section of the original is just vibes β€” a heading with nothing under it, and then Function Documentation right after. Not me pointing that out. πŸ™ˆ Either way, the actual content lives in the per-function docs below, and they are so good.


πŸ‘‘ Function Documentation πŸ‘‘

πŸ¦‹ subroutine claev2 (complex a, complex b, complex c, real rt1, real rt2, real cs1, complex sn1)

CLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. That's the whole brand. πŸ’…

✨ Purpose ✨

!> CLAEV2 computes the eigendecomposition of a 2-by-2 Hermitian matrix
!>    [  A         B  ]
!>    [  CONJG(B)  C  ].
!> On return, RT1 is the eigenvalue of larger absolute value, RT2 is the
!> eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right
!> eigenvector for RT1, giving the decomposition
!>
!> [ CS1  CONJG(SN1) ] [    A     B ] [ CS1 -CONJG(SN1) ] = [ RT1  0  ]
!> [-SN1     CS1     ] [ CONJG(B) C ] [ SN1     CS1     ]   [  0  RT2 ].

So like β€” you hand it the Hermitian matrix, it hands you back the eigenvalues sorted by absolute value (biggest first, RT1) and the unit right eigenvector for RT1 as (CS1, SN1). The factorization is literally spelled out above, keep it in your notes. πŸŽ€

πŸŽ€ Parameters πŸŽ€

  • A β€” A is COMPLEX. The (1,1) element of the 2-by-2 matrix.
  • B β€” B is COMPLEX. The (1,2) element and the conjugate of the (2,1) element of the 2-by-2 matrix.
  • C β€” C is COMPLEX. The (2,2) element of the 2-by-2 matrix.
  • RT1 β€” RT1 is REAL. The eigenvalue of larger absolute value.
  • RT2 β€” RT2 is REAL. The eigenvalue of smaller absolute value.
  • CS1 β€” CS1 is REAL. (That's the whole description, bestie, it's giving mystery. πŸ•΅οΈ)
  • SN1 β€” SN1 is COMPLEX. The vector (CS1, SN1) is a unit right eigenvector for RT1.

🌈 Author 🌈

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

⭐ Further Details ⭐

!>
!>  RT1 is accurate to a few ulps barring over/underflow.
!>
!>  RT2 may be inaccurate if there is massive cancellation in the
!>  determinant A*C-B*B; higher precision or correctly rounded or
!>  correctly truncated arithmetic would be needed to compute RT2
!>  accurately in all cases.
!>
!>  CS1 and SN1 are accurate to a few ulps barring over/underflow.
!>
!>  Overflow is possible only if RT1 is within a factor of 5 of overflow.
!>  Underflow is harmless if the input data is 0 or exceeds
!>     underflow_threshold / macheps.
!>
Lowkey important: RT1 is accurate to a few ulps barring over/underflow, but RT2 can be inaccurate if there's massive cancellation in the determinant A*C-B*B β€” you'd need higher precision or correctly rounded or correctly truncated arithmetic to get RT2 right in all cases. 😭 Don't come for RT2, it's doing its best.

Also: overflow only happens if RT1 is within a factor of 5 of overflow, and underflow is harmless if the input data is 0 or exceeds underflow_threshold / macheps. Slay. πŸ”₯

Definition at line 120 of file claev2.f.


🧚 subroutine dlaev2 (double precision a, double precision b, double precision c, double precision rt1, double precision rt2, double precision cs1, double precision sn1)

DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. Same energy, double precision edition. πŸ’œ

✨ Purpose ✨

!> DLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix
!>    [  A   B  ]
!>    [  B   C  ].
!> On return, RT1 is the eigenvalue of larger absolute value, RT2 is the
!> eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right
!> eigenvector for RT1, giving the decomposition
!>
!>    [ CS1  SN1 ] [  A   B  ] [ CS1 -SN1 ]  =  [ RT1  0  ]
!>    [-SN1  CS1 ] [  B   C  ] [ SN1  CS1 ]     [  0  RT2 ].

Note the vibe shift: this one's a plain symmetric matrix, so no CONJG anywhere, just B twice. The math ate, honestly. 🍽️

πŸŽ€ Parameters πŸŽ€

  • A β€” A is DOUBLE PRECISION. The (1,1) element of the 2-by-2 matrix.
  • B β€” B is DOUBLE PRECISION. The (1,2) element and the conjugate of the (2,1) element of the 2-by-2 matrix.
  • C β€” C is DOUBLE PRECISION. The (2,2) element of the 2-by-2 matrix.
  • RT1 β€” RT1 is DOUBLE PRECISION. The eigenvalue of larger absolute value.
  • RT2 β€” RT2 is DOUBLE PRECISION. The eigenvalue of smaller absolute value.
  • CS1 β€” CS1 is DOUBLE PRECISION. (Again, no elaboration. Mysterious queen. πŸ‘‘)
  • SN1 β€” SN1 is DOUBLE PRECISION. The vector (CS1, SN1) is a unit right eigenvector for RT1.

🌈 Author 🌈

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

⭐ Further Details ⭐

!>
!>  RT1 is accurate to a few ulps barring over/underflow.
!>
!>  RT2 may be inaccurate if there is massive cancellation in the
!>  determinant A*C-B*B; higher precision or correctly rounded or
!>  correctly truncated arithmetic would be needed to compute RT2
!>  accurately in all cases.
!>
!>  CS1 and SN1 are accurate to a few ulps barring over/underflow.
!>
!>  Overflow is possible only if RT1 is within a factor of 5 of overflow.
!>  Underflow is harmless if the input data is 0 or exceeds
!>     underflow_threshold / macheps.
!>

Same caveats, same accuracy tea. 🍡 RT1 is accurate to a few ulps barring over/underflow; RT2 may be inaccurate if there's massive cancellation in the determinant A*C-B*B; CS1 and SN1 are accurate to a few ulps barring over/underflow; overflow is possible only if RT1 is within a factor of 5 of overflow; underflow is harmless if the input data is 0 or exceeds underflow_threshold / macheps.

Definition at line 119 of file dlaev2.f.


🌸 subroutine slaev2 (real a, real b, real c, real rt1, real rt2, real cs1, real sn1)

SLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. Single precision, real numbers, no complexes invited. πŸŽ€

✨ Purpose ✨

!> SLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix
!>    [  A   B  ]
!>    [  B   C  ].
!> On return, RT1 is the eigenvalue of larger absolute value, RT2 is the
!> eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right
!> eigenvector for RT1, giving the decomposition
!>
!>    [ CS1  SN1 ] [  A   B  ] [ CS1 -SN1 ]  =  [ RT1  0  ]
!>    [-SN1  CS1 ] [  B   C  ] [ SN1  CS1 ]     [  0  RT2 ].

πŸŽ€ Parameters πŸŽ€

  • A β€” A is REAL. The (1,1) element of the 2-by-2 matrix.
  • B β€” B is REAL. The (1,2) element and the conjugate of the (2,1) element of the 2-by-2 matrix.
  • C β€” C is REAL. The (2,2) element of the 2-by-2 matrix.
  • RT1 β€” RT1 is REAL. The eigenvalue of larger absolute value.
  • RT2 β€” RT2 is REAL. The eigenvalue of smaller absolute value.
  • CS1 β€” CS1 is REAL. (Yes, the description is just the type. We love a minimalist. πŸ’…)
  • SN1 β€” SN1 is REAL. The vector (CS1, SN1) is a unit right eigenvector for RT1.

🌈 Author 🌈

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

⭐ Further Details ⭐

!>
!>  RT1 is accurate to a few ulps barring over/underflow.
!>
!>  RT2 may be inaccurate if there is massive cancellation in the
!>  determinant A*C-B*B; higher precision or correctly rounded or
!>  correctly truncated arithmetic would be needed to compute RT2
!>  accurately in all cases.
!>
!>  CS1 and SN1 are accurate to a few ulps barring over/underflow.
!>
!>  Overflow is possible only if RT1 is within a factor of 5 of overflow.
!>  Underflow is harmless if the input data is 0 or exceeds
!>     underflow_threshold / macheps.
!>

Word-for-word the same accuracy lore, because the math doesn't change just because the precision did. ✨

Definition at line 119 of file slaev2.f.


πŸ’€ subroutine zlaev2 (complex*16 a, complex*16 b, complex*16 c, double precision rt1, double precision rt2, double precision cs1, complex*16 sn1)

ZLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix. Double-precision complex, the final boss of the family. πŸ”₯

✨ Purpose ✨

!> ZLAEV2 computes the eigendecomposition of a 2-by-2 Hermitian matrix
!>    [  A         B  ]
!>    [  CONJG(B)  C  ].
!> On return, RT1 is the eigenvalue of larger absolute value, RT2 is the
!> eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right
!> eigenvector for RT1, giving the decomposition
!>
!> [ CS1  CONJG(SN1) ] [    A     B ] [ CS1 -CONJG(SN1) ] = [ RT1  0  ]
!> [-SN1     CS1     ] [ CONJG(B) C ] [ SN1     CS1     ]   [  0  RT2 ].

πŸŽ€ Parameters πŸŽ€

  • A β€” A is COMPLEX*16. The (1,1) element of the 2-by-2 matrix.
  • B β€” B is COMPLEX*16. The (1,2) element and the conjugate of the (2,1) element of the 2-by-2 matrix.
  • C β€” C is COMPLEX*16. The (2,2) element of the 2-by-2 matrix.
  • RT1 β€” RT1 is DOUBLE PRECISION. The eigenvalue of larger absolute value.
  • RT2 β€” RT2 is DOUBLE PRECISION. The eigenvalue of smaller absolute value.
  • CS1 β€” CS1 is DOUBLE PRECISION. (The description is literally just the type and honestly? Respect. πŸ™ˆ)
  • SN1 β€” SN1 is COMPLEX*16. The vector (CS1, SN1) is a unit right eigenvector for RT1.

🌈 Author 🌈

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

⭐ Further Details ⭐

!>
!>  RT1 is accurate to a few ulps barring over/underflow.
!>
!>  RT2 may be inaccurate if there is massive cancellation in the
!>  determinant A*C-B*B; higher precision or correctly rounded or
!>  correctly truncated arithmetic would be needed to compute RT2
!>  accurately in all cases.
!>
!>  CS1 and SN1 are accurate to a few ulps barring over/underflow.
!>
!>  Overflow is possible only if RT1 is within a factor of 5 of overflow.
!>  Underflow is harmless if the input data is 0 or exceeds
!>     underflow_threshold / macheps.
!>

Definition at line 120 of file zlaev2.f.


🌟 Author 🌟

Generated automatically by Doxygen for LAPACK from the source code.


πŸ’œ Okay that's the whole page, bestie β€” four subroutines, one 2-by-2 matrix at a time, and a truly iconic amount of !>.

Later, girlypop! This masterpiece is from LAPACK, Version 3.12.0, dated the LAPACK era, and it's the laev2(3) page β€” go forth and eigendecompose responsibly. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from