# ?lartg

Generates a plane rotation with real cosine and real/complex sine.

## Syntax

call slartg( f, g, cs, sn, r )

call dlartg( f, g, cs, sn, r )

call clartg( f, g, cs, sn, r )

call zlartg( f, g, cs, sn, r )

## Description

The routine generates a plane rotation so that

where `cs2 + |sn|2 = 1`

This is a slower, more accurate version of the BLAS Level 1 routine ?rotg, except for the following differences.

For slartg/dlartg:

f and g are unchanged on return;

If `g=0`, then cs=1 and sn=0;

If `f=0` and `g ≠ 0`, then `cs=0` and `sn=1` without doing any floating point operations (saves work in ?bdsqr when there are zeros on the diagonal);

If f exceeds g in magnitude, cs will be positive.

For clartg/zlartg:

f and g are unchanged on return;

If `g=0`, then `cs=1` and `sn=0`;

If `f=0`, then `cs=0` and sn is chosen so that r is real.

## Input Parameters

f, g

  REAL for slartg

  DOUBLE PRECISION for dlartg

  COMPLEX for clartg

  COMPLEX*16 for zlartg

  The first and second component of vector to be rotated.

## Output Parameters

cs

  REAL for slartg/clartg

  DOUBLE PRECISION for dlartg/zlartg

  The cosine of the rotation.

sn

  REAL for slartg

  DOUBLE PRECISION for dlartg

  COMPLEX for clartg

  COMPLEX*16 for zlartg

  The sine of the rotation.

r

  REAL for slartg

  DOUBLE PRECISION for dlartg

  COMPLEX for clartg

  COMPLEX*16 for zlartg

  The nonzero component of the rotated vector.

Parent topic: Auxiliary Routines