F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06AAF (DROTG)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F06AAF (DROTG) generates a real Givens plane rotation.

## 2  Specification

 SUBROUTINE F06AAF ( A, B, C, S)
 REAL (KIND=nag_wp) A, B, C, S
The routine may be called by its BLAS name drotg.

## 3  Description

F06AAF (DROTG) generates a real Givens plane rotation with parameters $c$ and $s$, such that, given real $a$ and $b$:
 $c s -s c a b = d 0 .$
The routine computes $c$, $s$ and $d$ as follows:
 $d = σ⁢a2+b2 ;$
 $c = a/d, if ​ d≠ 0, 1, if ​ d= 0, s = b/d, if ​ d≠ 0, 0, if ​ d= 0,$
 $where σ = sign⁡a, if ​a>b, sign⁡b, if ​a≤b.$
The routine also computes the value $z$ defined as
 $z= s, if ​s
This enables $c$ and $s$ to be reconstructed from the single value $z$ as
 $c= 1-z2, if ​z≤1, 1/z, if ​z>1, s= z, if ​z≤1, 1-c2, if ​z>1.$
To apply the plane rotation to a pair of real vectors, call F06EPF (DROT); to apply it to a pair of complex vectors, call F06KPF.
None.

## 5  Parameters

1:     A – REAL (KIND=nag_wp)Input/Output
On entry: the value $a$, the first element of the vector which determines the rotation.
On exit: the value $d$.
2:     B – REAL (KIND=nag_wp)Input/Output
On entry: the value $b$, the second element of the vector which determines the rotation.
On exit: the value $z$, from which $c$ and $s$ can be reconstructed.
3:     C – REAL (KIND=nag_wp)Output
On exit: the value $c$, the cosine of the rotation.
4:     S – REAL (KIND=nag_wp)Output
On exit: the value $s$, the sine of the rotation.

None.

Not applicable.