XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ drotg()

void drotg ( double *  a,
double *  b,
double *  c,
double *  s 
)

Constructs Givens plane rotation (BLAS 1)

Purpose
This routine constructs Givens plane rotation for the point (a, b) as below.
( c s ) * ( a ) = ( r )
( -s c ) ( b ) ( 0 )
where r = sign(sqrt(a^2 + b^2), a), if |a| > |b|,
r = sign(sqrt(a^2 + b^2), b), if |a| <= |b|,
c^2 + s^2 = 1.
The constructed plane rotation can be used by drot to convert the points to the new coordinate system.
Parameters
[in,out]a[in] a value
[out] r value
[in,out]b[in] b value
[out] z value
  = s (if |a| > |b|)
  = 1/c (|a| <= |b| and c != 0)
  = 1 (if |a| <= |b| and c = 0)
  = 0 (if r = 0)
c and s can be reconstructed from z.
  c = sqrt(1 - z^2), s = z (if z < 1)
  c = 0, s = 1 (if z = 1)
  c = 1/z, s = sqrt(1 - (1/z)^2) (if z > 1)
[out]cc (cosine) value.
  = a/r (if r != 0)
  = 1 (if r = 0)
[out]ss (sine) value.
  = b/r (if r != 0)
  = 0 (if r = 0)
Reference
BLAS