SROTG(3S)SROTG(3S)NAME
SROTG, DROTG, CROTG, ZROTG - Constructs a Givens plane rotation
SYNOPSIS
Single precision
Fortran:
CALL SROTG (a, b, c, s)
C/C++:
#include <scsl_blas.h>
void srotg (float *a, float *b, float *c, float *s);
Double precision
Fortran:
CALL DROTG (a, b, c, s)
C/C++:
#include <scsl_blas.h>
void drotg (double *a, double *b, double *c, double *s);
Single precision complex
Fortran:
CALL CROTG (a, b, c, s)
C/C++:
#include <scsl_blas.h>
void crotg (scsl_complex *a, scsl_complex *b, float *c,
scsl_complex *s);
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void crotg (complex<float> *a, complex<float> *b, float *c,
complex<float> *s);
Double precision complex
Fortran:
CALL ZROTG (a, b, c, s)
C/C++:
#include <scsl_blas.h>
void zrotg (scsl_zomplex *a, scsl_zomplex *b, double *c,
scsl_zomplex *s);
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void zrotg (complex<double> *a, complex<double> *b, double *c,
Page 1
SROTG(3S)SROTG(3S)
complex<double> *s);
IMPLEMENTATION
These routines are part of the SCSL Scientific Library and can be loaded
using either the -lscs or the -lscs_mp option. The -lscs_mp option
directs the linker to use the multi-processor version of the library.
When linking to SCSL with -lscs or -lscs_mp, the default integer size is
4 bytes (32 bits). Another version of SCSL is available in which integers
are 8 bytes (64 bits). This version allows the user access to larger
memory sizes and helps when porting legacy Cray codes. It can be loaded
by using the -lscs_i8 option or the -lscs_i8_mp option. A program may use
only one of the two versions; 4-byte integer and 8-byte integer library
calls cannot be mixed.
The C and C++ prototypes shown above are appropriate for the 4-byte
integer version of SCSL. When using the 8-byte integer version, the
variables of type int become long long and the <scsl_blas_i8.h> header
file should be included.
DESCRIPTION
DROTG/SROTG computes the elements of a rotation matrix such that:
_ _ _ _ _ _
| c s | | a | | r |
|-s c | * | b | = | 0 |
- - - - - -
where
2 2 2 2
r = +- sqrt (a + b ) and c + s = 1
CROTG/ZROTG computes the elements of a rotation matrix such that:
_ _ _ _ _ _
| c s | | a | | r |
| _ | | | | |
|-s c | * | b | = | 0 |
- - - - - -
where
_ _ _
r = (a / sqrt(aa)) * sqrt ((aa) + (bb))
Page 2
SROTG(3S)SROTG(3S)
and the notation
-
z
represents the complex conjugate of z.
See the NOTES section of this man page for information about the
interpretation of the data types described in the following arguments.
These routines have the following arguments:
a First vector component. (input and output)
SROTG (Single precision), DROTG (Double precision):
On input, the first component of the vector to be rotated. On
output, a is overwritten by by r, the first component of the
vector in the rotated coordinate system where:
2 2
r = sign(sqrt(a + b ,a), if |a| > |b|
2 2
r = sign(sqrt(a + b ,b), if |a| <= |b|
CROTG (Single precision complex), ZROTG (Double precision
complex):
On output, a is overwritten by the unique complex number r, whose
size in the complex plane is the Euclidean norm of the complex
vector (a,b), and whose direction in the complex plane is the same
as that of the original complex element a.
For C/C++, a pointer to this value is passed.
b Second vector component. (input and output)
SROTG: Single precision.
DROTG: Double precision.
CROTG: Single precision complex.
ZROTG: Double precision complex.
On input, the second component of the vector to be rotated. On
output, b contains z, where:
z=s if |a| > |b|
z=1c if |a| <= |b| and c / 0
z=1 if c = 0.
Page 3
SROTG(3S)SROTG(3S)
For C/C++, a pointer to this value is passed.
c Cosine of the angle of rotation. (output)
SROTG: Single precision.
DROTG: Double precision.
CROTG: Single precision.
ZROTG: Double precision.
For C/C++, a pointer to this value is passed.
s Sine of the angle of rotation. (output)
SROTG: Single precision.
DROTG: Double precision.
CROTG: Single precision complex.
ZROTG: Double precision complex.
For C/C++, a pointer to this value is passed.
NOTES
SROTG/DROTG routines are Level 1 Basic Linear Algebra Subprograms (Level
1 BLAS).
CROTG and ZROTG, are extensions to the Level 1 Basic Linear Algebra
Subprograms (Level 1 BLAS).
The value of z, returned in b by SROTG, gives a compact representation of
the rotation matrix, which can be used later to reconstruct c and s as in
the following example:
IF (B .EQ. 1. ) THEN
C = 0.
S = 1.
ELSEIF( ABS( B) .LT. 1) THEN
C = SQRT( 1. - B * B)
S = B
ELSE
C = 1. / B
S = SQRT( 1 - C * C)
ENDIF
Data Types
The following data types are described in this documentation:
Term Used Data type
Fortran:
Array dimensioned n x(n)
Page 4
SROTG(3S)SROTG(3S)
Integer INTEGER (INTEGER*8 for -lscs_i8[_mp])
Single precision REAL
Double precision DOUBLE PRECISION
Single precision complex COMPLEX
Double precision complex DOUBLE COMPLEX
C/C++:
Array dimensioned n x[n]
Integer int (long long for -lscs_i8[_mp])
Single precision float
Double precision double
Single precision complex scsl_complex
Double precision complex scsl_zomplex
C++ STL:
Array dimensioned n x[n]
Integer int (long long for -lscs_i8[_mp])
Single precision float
Double precision double
Single precision complex complex<float>
Double precision complex complex<double>
SEE ALSOINTRO_SCSL(3S), INTRO_BLAS1(3S), SROT(3S), SROTM(3S), SROTMG(3S)INTRO_CBLAS(3S) for information about using the C interface to Fortran 77
Basic Linear Algebra Subprograms (legacy BLAS) set forth by the Basic
Linear Algebra Subprograms Technical Forum.
Page 5