LinearAlgebra`BLAS`
LinearAlgebra`BLAS`

# ROTG

ROTG[a,b,c,s]

computes a Givens rotation {c,s} for given scalars a and b.

# Details

• To use ROTG, you first need to load the BLAS Package using Needs["LinearAlgebra`BLAS`"].
• The following arguments must be given:
•  a input/output symbol scalar; the symbol value is modified in place b input/output symbol scalar; the symbol value is modified in place c output symbol scalar; the symbol value is modified in place s output symbol scalar; the symbol value is modified in place
• ROTG[a,b,c,s] computes {c,s} such that {{c,s},{-Conjugate[s],c}.{a,b}=={r,0}, where the signed radius r is given by rSign[b]Norm[{a,b}] if a==0 or a,b with Abs[a]Abs[b], and by rSign[a]Norm[{a,b}] otherwise. In the degenerate case a==b==0, by convention c==1 and s==0.
• The scalars c and s can be viewed as the cosine and sine, respectively, of the angle of rotation and satisfy the conditions c and c2+Abs[s]21.
• The scalar a is set to r. The scalar b is not modified if either a or b is complex. Otherwise, b is set to the value z given by:
•  s if Abs[a]>Abs[b] 1/c if 0
• When given, the value z can be used to reconstruct c and s as follows:
•  c1/z s  if Abs[z]>1 c0 s1 if z1 c sz if 0

# Examples

open allclose all

## Basic Examples(1)

Compute a Givens rotation for given scalars:

## Scope(3)

Real values:

Complex values:

Note that c is real-valued even when the inputs are complex:

Arbitrary-precision values:

## Properties & Relations(1)

ROTG[a,b,c,s] satisfies the relation {{c,s},{-Conjugate[s],c}}.{a,b}={r,0} where r is the number saved in a:

The scalars c and s form a unit vector with c real:

## Possible Issues(2)

All arguments must be symbols:  The first and the second arguments are modified and must be initialized to scalars: 