SRC/zlartg.f90(3)
π SRC/zlartg.f90(3) π
okay bestie, you're on the SRC/zlartg.f90(3) page from the Library Functions Manual, and it's all about one iconic little subroutine. Let's get into it. π«Ά
πΈ NAME πΈ
SRC/zlartg.f90 β yep, that's the file, bestie. This page is literally the manual for that source file's zlartg routine.
β¨ SYNOPSIS β¨
π§© Functions/Subroutines π§©
subroutine zlartg (f, g, c, s, r)β ZLARTG generates a plane rotation with real cosine and complex sine.
π οΈ Function/Subroutine Documentation π οΈ
subroutine zlartg (complex(wp) f, complex(wp) g, real(wp) c, complex(wp) s,
complex(wp) r)
ZLARTG generates a plane rotation with real cosine and complex sine. π
π― Purpose:
okay so the whole point is generating a plane rotation so that:
[ C S ] . [ F ] = [ R ]
[ -conjg(S) C ] [ G ] [ 0 ]
where C is real and C**2 + |S|**2 = 1. no cap, that's the vibe. β¨
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:
- If
G=0, thenC=1andS=0. - If
F=0, thenC=0andSis chosen so thatRis 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 DLARTG. π
The algorithm used to compute these quantities incorporates scaling to avoid overflow or underflow in computing the square root of the sum of squares. safe scaling icon behavior, we love to see it. π₯
This is the same routine ZROTG fom BLAS1, except that F and G are unchanged on return.
Below, wp=>dp stands for double precision from LA_CONSTANTS module. π§
π§Έ Parameters
FβFisCOMPLEX(wp): the first component of vector to be rotated.GβGisCOMPLEX(wp): the second component of vector to be rotated.CβCisREAL(wp): the cosine of the rotation.SβSisCOMPLEX(wp): the sine of the rotation.RβRisCOMPLEX(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 zlartg.f90.
π€ Author
Generated automatically by Doxygen for LAPACK from the source code.
mwah π that's the whole page, bestie β LAPACK Version 3.12.0, source page SRC/zlartg.f90(3), with a December 2021 date stamp. π
β¨
π¦ 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