BLAS/SRC/srotg.f90(3)

πŸ“¦
version 3.12.1 Β· 3 versions
, in arch rolling

πŸ’… BLAS/SRC/srotg.f90 ✨

okay bestie, buckle up β€” this is the manual page for BLAS/SRC/srotg.f90, which is a very specific little gem in the LAPACK/BLAS universe. it's the home of srotg, a Fortran subroutine that builds plane rotations, and honestly? it's giving main character energy for something so small. πŸŽ€


✨ SYNOPSIS ✨

Functions/Subroutines

  • subroutine srotg (a, b, c, s) β€” the one, the only, SROTG 🌟

πŸ¦‹ Function/Subroutine Documentation πŸ¦‹

subroutine srotg (real(wp) a, real(wp) b, real(wp) c, real(wp) s)

SROTG, periodt. that's the name, that's the vibe. πŸ’œ

πŸŽ€ Purpose πŸŽ€

okay so picture this β€” per the original docs, and i'm quoting the vibe here:

!>
!> SROTG constructs a plane rotation
!>    [  c  s ] [ a ] = [ r ]
!>    [ -s  c ] [ b ]   [ 0 ]
!> satisfying c**2 + s**2 = 1.
!>
!> The computation uses the formulas
!>    sigma = sgn(a)    if |a| >  |b|
!>          = sgn(b)    if |b| >= |a|
!>    r = sigma*sqrt( a**2 + b**2 )
!>    c = 1; s = 0      if r = 0
!>    c = a/r; s = b/r  if r != 0
!> The subroutine also computes
!>    z = s    if |a| > |b|,
!>      = 1/c  if |b| >= |a| and c != 0
!>      = 1    if c = 0
!> This allows c and s to be reconstructed from z as follows:
!>    If z = 1, set c = 0, s = 1.
!>    If |z| < 1, set c = sqrt(1 - z**2) and s = z.
!>    If |z| > 1, set c = 1/z and s = sqrt( 1 - c**2).
!>
!>

like, it literally constructs a plane rotation and it does not apologize for it. the way that c**2 + s**2 = 1 just... holds. iconic. πŸ˜­πŸ’–

🌈 See also 🌈

  • lartg β€” generate plane rotation, more accurate than BLAS rot, 🌸
  • lartgp β€” generate plane rotation, more accurate than BLAS rot ✨

(iykyk β€” if you want the more accurate one, those are your girls.)

πŸ‘‘ Parameters πŸ‘‘

  • A β€” A is REAL. On entry, the scalar a. On exit, the scalar r. πŸ”„ it literally becomes a different thing, no cap.
  • B β€” B is REAL. On entry, the scalar b. On exit, the scalar z. bestie it transforms too 😭
  • C β€” C is REAL. The scalar c. πŸ’…
  • S β€” S is REAL. The scalar s. 🫢
fr fr, watch out β€” A and B are not the same on the way out. on entry they're a and b, on exit they're r and z. that's the whole plot twist of this subroutine. πŸ“

⭐ Author ⭐

Edward Anderson, Lockheed Martin πŸ‘‘

πŸ’œ Contributors: πŸ’œ

Weslley Pereira, University of Colorado Denver, USA 🌸

πŸ”₯ Further Details: πŸ”₯

!>
!>  Anderson E. (2017)
!>  Algorithm 978: Safe Scaling in the Level 1 BLAS
!>  ACM Trans Math Softw 44:1--28
!>  https://doi.org/10.1145/3061665
!>
!>

like, read the paper, it ate. πŸ“šβœ¨


🧚 Definition 🧚

Definition at line 91 of file srotg.f90. β€” yes, line 91, we counted. πŸ’€


πŸ’– Author πŸ’–

Generated automatically by Doxygen for LAPACK from the source code. β€” Doxygen did the typing, we just did the vibes. πŸ™ˆ


okay that's the whole page, bestie! and a cute sign-off as promised: this lil masterpiece is from LAPACK, Version 3.12.0, dated BLAS/SRC/srotg.f90(3) β€” slay, go build your plane rotations. πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from