SRC/clartg.f90(3)
β¨ NAME β¨
SRC/clartg.f90 β okay bestie, welcome to the SRC/clartg.f90 page from the Library Functions Manual. This is the file thatβs giving βplane rotation with real cosine and complex sineβ energy, and weβre gonna get into all of it. π
π SYNOPSIS π
Functions/Subroutines
subroutine clartg (f, g, c, s, r)
CLARTG generates a plane rotation with real cosine and complex sine.
πΈ Function/Subroutine Documentation πΈ
subroutine clartg (complex(wp) f, complex(wp) g, real(wp) c, complex(wp) s, complex(wp) r)
CLARTG generates a plane rotation with real cosine and complex sine. Slay. β¨
Purpose
Okay so hereβs the whole mathematical vibe, copied exactly because the formulas are literally the main character:
!>
!> CLARTG generates a plane rotation so that
!>
!> [ C S ] . [ F ] = [ R ]
!> [ -conjg(S) C ] [ G ] [ 0 ]
!>
!> where C is real and C**2 + |S|**2 = 1.
!>
!> The mathematical formulas used for C and S are
!>
!> sgn(x) = { x / |x|, x != 0
!> { 1, x = 0
!>
!> R = sgn(F) * sqrt(|F|**2 + |G|**2)
!>
!> C = |F| / sqrt(|F|**2 + |G|**2)
!>
!> S = sgn(F) * conjg(G) / sqrt(|F|**2 + |G|**2)
!>
!> Special conditions:
!> If G=0, then C=1 and S=0.
!> If F=0, then C=0 and S is chosen so that R is real.
!>
!> When F and G are real, the formulas simplify to C = F/R and
!> S = G/R, and the returned values of C, S, and R should be
!> identical to those returned by SLARTG.
!>
!> The algorithm used to compute these quantities incorporates scaling
!> to avoid overflow or underflow in computing the square root of the
!> sum of squares.
!>
!> This is the same routine CROTG fom BLAS1, except that
!> F and G are unchanged on return.
!>
!> Below, wp=>sp stands for single precision from LA_CONSTANTS module.
!>
Bestie, note the exact warning-ish lore: this is the same routineCROTGfom BLAS1, except thatFandGare unchanged on return. Also yes, βfomβ is literally in the original, so weβre keeping it. π
Parameters
Fβ type:F is COMPLEX(wp). The first component of vector to be rotated.Gβ type:G is COMPLEX(wp). The second component of vector to be rotated.Cβ type:C is REAL(wp). The cosine of the rotation.Sβ type:S is COMPLEX(wp). The sine of the rotation.Rβ type:R is COMPLEX(wp). The nonzero component of the rotated vector.
Author
Weslley Pereira, University of Colorado Denver, USA. π«Ά
Date
December 2021. ποΈ
Further Details
!>
!> Based on the algorithm from
!>
!> 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
!>
!>
Definition at line 115 of file clartg.f90.
Thatβs the exact line, bestie: 115 of clartg.f90. π
Author
Generated automatically by Doxygen for LAPACK from the source code. So not a human bestie, a whole documentation machine. π
byeee bestie π«Ά this whole lil page is from LAPACK Version 3.12.0, date December 2021, and the footer tag is SRC/clartg.f90(3) β mwah πβ¨
π¦ 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