.TH "rotg" 3 "Wed Feb 7 2024 11:30:40" "Version 3.12.0" "LAPACK" \" -*- nroff -*- .ad l .nh .SH NAME rotg \- rotg: generate plane rotation (cf\&. lartg) .SH SYNOPSIS .br .PP .SS "Functions" .in +1c .ti -1c .RI "subroutine \fBcrotg\fP (a, b, c, s)" .br .RI "\fBCROTG\fP generates a Givens rotation with real cosine and complex sine\&. " .ti -1c .RI "subroutine \fBdrotg\fP (a, b, c, s)" .br .RI "\fBDROTG\fP " .ti -1c .RI "subroutine \fBsrotg\fP (a, b, c, s)" .br .RI "\fBSROTG\fP " .ti -1c .RI "subroutine \fBzrotg\fP (a, b, c, s)" .br .RI "\fBZROTG\fP generates a Givens rotation with real cosine and complex sine\&. " .in -1c .SH "Detailed Description" .PP .SH "Function Documentation" .PP .SS "subroutine crotg (complex(wp) a, complex(wp) b, real(wp) c, complex(wp) s)" .PP \fBCROTG\fP generates a Givens rotation with real cosine and complex sine\&. .PP \fBPurpose:\fP .RS 4 .PP .nf CROTG constructs a plane rotation [ c s ] [ a ] = [ r ] [ -conjg(s) c ] [ b ] [ 0 ] where c is real, s is 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) r = sgn(a)*sqrt(|a|**2 + |b|**2) When a and b are real and r /= 0, the formulas simplify to c = a / r s = b / r the same as in SROTG when |a| > |b|\&. When |b| >= |a|, the sign of c and s will be different from those computed by SROTG if the signs of a and b are not the same\&. .fi .PP .RE .PP \fBSee also\fP .RS 4 \fBlartg: generate plane rotation, more accurate than BLAS rot\fP, .PP \fBlartgp: generate plane rotation, more accurate than BLAS rot\fP .RE .PP \fBParameters\fP .RS 4 \fIA\fP .PP .nf A is COMPLEX On entry, the scalar a\&. On exit, the scalar r\&. .fi .PP .br \fIB\fP .PP .nf B is COMPLEX The scalar b\&. .fi .PP .br \fIC\fP .PP .nf C is REAL The scalar c\&. .fi .PP .br \fIS\fP .PP .nf S is COMPLEX The scalar s\&. .fi .PP .RE .PP \fBAuthor\fP .RS 4 Weslley Pereira, University of Colorado Denver, USA .RE .PP \fBDate\fP .RS 4 December 2021 .RE .PP \fBFurther Details:\fP .RS 4 .PP .nf 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 .fi .PP .RE .PP .SS "subroutine drotg (real(wp) a, real(wp) b, real(wp) c, real(wp) s)" .PP \fBDROTG\fP .PP \fBPurpose:\fP .RS 4 .PP .nf DROTG constructs a plane rotation [ c s ] [ a ] = [ r ] [ -s c ] [ b ] [ 0 ] satisfying c**2 + s**2 = 1\&. The computation uses the formulas sigma = sgn(a) if |a| > |b| = sgn(b) if |b| >= |a| r = sigma*sqrt( a**2 + b**2 ) c = 1; s = 0 if r = 0 c = a/r; s = b/r if r != 0 The subroutine also computes z = s if |a| > |b|, = 1/c if |b| >= |a| and c != 0 = 1 if c = 0 This allows c and s to be reconstructed from z as follows: If z = 1, set c = 0, s = 1\&. If |z| < 1, set c = sqrt(1 - z**2) and s = z\&. If |z| > 1, set c = 1/z and s = sqrt( 1 - c**2)\&. .fi .PP .RE .PP \fBSee also\fP .RS 4 \fBlartg: generate plane rotation, more accurate than BLAS rot\fP, .PP \fBlartgp: generate plane rotation, more accurate than BLAS rot\fP .RE .PP \fBParameters\fP .RS 4 \fIA\fP .PP .nf A is DOUBLE PRECISION On entry, the scalar a\&. On exit, the scalar r\&. .fi .PP .br \fIB\fP .PP .nf B is DOUBLE PRECISION On entry, the scalar b\&. On exit, the scalar z\&. .fi .PP .br \fIC\fP .PP .nf C is DOUBLE PRECISION The scalar c\&. .fi .PP .br \fIS\fP .PP .nf S is DOUBLE PRECISION The scalar s\&. .fi .PP .RE .PP \fBAuthor\fP .RS 4 Edward Anderson, Lockheed Martin .RE .PP \fBContributors:\fP .RS 4 Weslley Pereira, University of Colorado Denver, USA .RE .PP \fBFurther Details:\fP .RS 4 .PP .nf 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 .fi .PP .RE .PP .SS "subroutine srotg (real(wp) a, real(wp) b, real(wp) c, real(wp) s)" .PP \fBSROTG\fP .PP \fBPurpose:\fP .RS 4 .PP .nf SROTG constructs a plane rotation [ c s ] [ a ] = [ r ] [ -s c ] [ b ] [ 0 ] satisfying c**2 + s**2 = 1\&. The computation uses the formulas sigma = sgn(a) if |a| > |b| = sgn(b) if |b| >= |a| r = sigma*sqrt( a**2 + b**2 ) c = 1; s = 0 if r = 0 c = a/r; s = b/r if r != 0 The subroutine also computes z = s if |a| > |b|, = 1/c if |b| >= |a| and c != 0 = 1 if c = 0 This allows c and s to be reconstructed from z as follows: If z = 1, set c = 0, s = 1\&. If |z| < 1, set c = sqrt(1 - z**2) and s = z\&. If |z| > 1, set c = 1/z and s = sqrt( 1 - c**2)\&. .fi .PP .RE .PP \fBSee also\fP .RS 4 \fBlartg: generate plane rotation, more accurate than BLAS rot\fP, .PP \fBlartgp: generate plane rotation, more accurate than BLAS rot\fP .RE .PP \fBParameters\fP .RS 4 \fIA\fP .PP .nf A is REAL On entry, the scalar a\&. On exit, the scalar r\&. .fi .PP .br \fIB\fP .PP .nf B is REAL On entry, the scalar b\&. On exit, the scalar z\&. .fi .PP .br \fIC\fP .PP .nf C is REAL The scalar c\&. .fi .PP .br \fIS\fP .PP .nf S is REAL The scalar s\&. .fi .PP .RE .PP \fBAuthor\fP .RS 4 Edward Anderson, Lockheed Martin .RE .PP \fBContributors:\fP .RS 4 Weslley Pereira, University of Colorado Denver, USA .RE .PP \fBFurther Details:\fP .RS 4 .PP .nf 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 .fi .PP .RE .PP .SS "subroutine zrotg (complex(wp) a, complex(wp) b, real(wp) c, complex(wp) s)" .PP \fBZROTG\fP generates a Givens rotation with real cosine and complex sine\&. .PP \fBPurpose:\fP .RS 4 .PP .nf ZROTG constructs a plane rotation [ c s ] [ a ] = [ r ] [ -conjg(s) c ] [ b ] [ 0 ] where c is real, s is 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) r = sgn(a)*sqrt(|a|**2 + |b|**2) When a and b are real and r /= 0, the formulas simplify to c = a / r s = b / r the same as in DROTG when |a| > |b|\&. When |b| >= |a|, the sign of c and s will be different from those computed by DROTG if the signs of a and b are not the same\&. .fi .PP .RE .PP \fBSee also\fP .RS 4 \fBlartg: generate plane rotation, more accurate than BLAS rot\fP, .PP \fBlartgp: generate plane rotation, more accurate than BLAS rot\fP .RE .PP \fBParameters\fP .RS 4 \fIA\fP .PP .nf A is DOUBLE COMPLEX On entry, the scalar a\&. On exit, the scalar r\&. .fi .PP .br \fIB\fP .PP .nf B is DOUBLE COMPLEX The scalar b\&. .fi .PP .br \fIC\fP .PP .nf C is DOUBLE PRECISION The scalar c\&. .fi .PP .br \fIS\fP .PP .nf S is DOUBLE COMPLEX The scalar s\&. .fi .PP .RE .PP \fBAuthor\fP .RS 4 Weslley Pereira, University of Colorado Denver, USA .RE .PP \fBDate\fP .RS 4 December 2021 .RE .PP \fBFurther Details:\fP .RS 4 .PP .nf 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 .fi .PP .RE .PP .SH "Author" .PP Generated automatically by Doxygen for LAPACK from the source code\&.