CLARTG(3)
π¦ CLARTG π¦ (that's clartg.f90(3), from the Library Functions Manual bestie)
okay so real talk β we're in the LAPACK cinematic universe today and this whole page lives at clartg.f90(3) in the Library Functions Manual. stay with me, it's giving math but make it cute π
β¨ NAME β¨
the file in question, in all its absolute-path glory:
/home/abuild/rpmbuild/BUILD/lapack-
static-3.12.0-build/lapack-3.12.0/SRC/clartg.f90
like yes she's a whole path, she contains multitudes π
β¨ SYNOPSIS β¨
Functions/Subroutines
subroutine CLARTG (f, g, c, s, r)β CLARTG generates a plane rotation with real cosine and complex sine. periodt. that's the whole vibe π₯
β¨ 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. no cap π«Ά
πΈ Purpose:
lowkey the whole point is this β 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. (that's the vibe check that keeps everything normalized β¨)
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, bestie, memorize these:
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. (yes she's consistent, we stan a predictable queen π)
The algorithm used to compute these quantities incorporates scaling to avoid overflow or underflow in computing the square root of the sum of squares. like literally, she's out here protecting you from the numerical void π
This is the same routine CROTG fom BLAS1, except that F and G are unchanged on return. main character behaviour tbh.
Below, wp=>sp stands for single precision from the LA_CONSTANTS module. iykyk π§
β¨ Parameters β¨
F
F is COMPLEX(wp)
The first component of vector to be rotated.
the first component of vector to be rotated, she's the opener π
G
G is COMPLEX(wp)
The second component of vector to be rotated.
the second component of vector to be rotated β the sequel, and honestly? she ate π
C
C is REAL(wp)
The cosine of the rotation.
the cosine of the rotation, and yes she's REAL (literally) β
S
S is COMPLEX(wp)
The sine of the rotation.
the sine of the rotation, complex and thriving π¦
R
R is COMPLEX(wp)
The nonzero component of the rotated vector.
the nonzero component of the rotated vector. the one that actually shows up πβ¨
β¨ Author β¨
Weslley Pereira, University of Colorado Denver, USA. legend behaviour, we salute π«‘π
β¨ Date β¨
December 2021. vintage but still slaying π
β¨ 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
that's the receipts, the citation, the whole bibliography moment ππ
ngl the definition is sitting at line 115 of file clartg.f90. that's where the magic happens, bestie.
β¨ Author (the meta one) β¨
Generated automatically by Doxygen for LAPACK from the source code. (not a human, just a very diligent little robot π§ββοΈ)
and that's the page!! no notes, she's iconic, she's scaled safely, she's not overflowing into your DMs π β¨
sign-off szn: this was LAPACK, Version 3.12.0, dated December 2021 β courtesy of /home/abui.../clartg.f90(3). mwah, go rotate something. ππ
π¦ where this page comes from
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms