SRC/zlartg.f90(3) Library Functions Manual SRC/zlartg.f90(3)

SRC/zlartg.f90


subroutine zlartg (f, g, c, s, r)
ZLARTG generates a plane rotation with real cosine and complex sine.

ZLARTG generates a plane rotation with real cosine and complex sine.

Purpose:

!>
!> ZLARTG 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 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.
!>
!> 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
!>          F is COMPLEX(wp)
!>          The first component of vector to be rotated.
!> 

G

!>          G is COMPLEX(wp)
!>          The second component of vector to be rotated.
!> 

C

!>          C is REAL(wp)
!>          The cosine of the rotation.
!> 

S

!>          S is COMPLEX(wp)
!>          The sine of the rotation.
!> 

R

!>          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 zlartg.f90.

Generated automatically by Doxygen for LAPACK from the source code.

Version 3.12.0 LAPACK