BLAS/SRC/srotg.f90(3)
π 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 BLASrot, πΈlartgpβ generate plane rotation, more accurate than BLASrotβ¨
(iykyk β if you want the more accurate one, those are your girls.)
π Parameters π
AβAisREAL. On entry, the scalar a. On exit, the scalar r. π it literally becomes a different thing, no cap.BβBisREAL. On entry, the scalar b. On exit, the scalar z. bestie it transforms too πCβCisREAL. The scalar c. πSβSisREAL. The scalar s. π«Ά
fr fr, watch out βAandBare 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
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms