zrotg Subroutine

public subroutine zrotg(a, b, c, s)

NAME

zrotg(3f) - [BLAS:COMPLEX16_BLAS_LEVEL1] constructs a plane rotation

SYNOPSIS

 subroutine zrotg( a, b, c, s )

   .. Scalar Arguments ..
   real(wp),intent(out)      :: c
   complex(wp),intent(in)    :: b
   complex(wp),intent(out)   :: s
   complex(wp),intent(inout) :: a
   ..

DEFINITION

ZROTG constructs a plane rotation

  [  c         s ] [ a ] = [ r ]
  [ -conjg(s)  c ] [ b ]   [ 0 ]

where c is real, s ic complex, and c*2 + conjg(s)s = 1.

The computation uses the formulas

 |x| = sqrt( Re(x)**2 + Im(x)**2 )
 sgn(x) = x / |x|  if x /= 0
        = 1        if x  = 0
 c = |a| / sqrt(|a|**2 + |b|**2)
 s = sgn(a) * conjg(b) / sqrt(|a|**2 + |b|**2)

When a and b are real and r /= 0, the formulas simplify to

 r = sgn(a)*sqrt(|a|**2 + |b|**2)
 c = a / r
 s = b / r

the same as in ZROTG when |a| > |b|. When |b| >= |a|, the sign of c and s will be different from those computed by ZROTG if the signs of a and b are not the same.

OPTIONS

A

       A is DOUBLE COMPLEX
       On entry, the scalar a.
       On exit, the scalar r.

B

       B is DOUBLE COMPLEX
       The scalar b.

C

       C is DOUBLE PRECISION
       The scalar c.

S

       S is DOUBLE PRECISION
       The scalar s.

AUTHORS

  • Edward Anderson, Lockheed Martin

\par 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

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
complex(kind=wp), intent(inout) :: a
complex(kind=wp), intent(in) :: b
real(kind=wp), intent(out) :: c
complex(kind=wp), intent(out) :: s

Contents


Variables

Type Visibility Attributes Name Initial
real(kind=wp), public :: abssq
complex(kind=wp), public, parameter :: czero = 0.0_wp
real(kind=wp), public :: d
complex(kind=wp), public :: f
real(kind=wp), public :: f1
real(kind=wp), public :: f2
complex(kind=wp), public :: fs
complex(kind=wp), public :: g
real(kind=wp), public :: g1
real(kind=wp), public :: g2
complex(kind=wp), public :: gs
real(kind=wp), public :: h2
real(kind=wp), public, parameter :: one = 1.0_wp
real(kind=wp), public :: p
complex(kind=wp), public :: r
real(kind=wp), public, parameter :: rtmax = sqrt(real(radix(0._wp), wp)**max(1-minexponent(0._wp), maxexponent(0._wp)-1)*epsilon(0._wp))
real(kind=wp), public, parameter :: rtmin = sqrt(real(radix(0._wp), wp)**max(minexponent(0._wp)-1, 1-maxexponent(0._wp))/epsilon(0._wp))
real(kind=wp), public, parameter :: safmax = real(radix(0._wp), wp)**max(1-minexponent(0._wp), maxexponent(0._wp)-1)
real(kind=wp), public, parameter :: safmin = real(radix(0._wp), wp)**max(minexponent(0._wp)-1, 1-maxexponent(0._wp))
complex(kind=wp), public :: t
real(kind=wp), public :: u
real(kind=wp), public :: uu
real(kind=wp), public :: v
real(kind=wp), public :: vv
real(kind=wp), public :: w
integer, public, parameter :: wp = kind(1.d0)
real(kind=wp), public, parameter :: zero = 0.0_wp