[linalg.algs.blas1.givens.lartg]

# 29 Numerics library [[numerics]](./#numerics)

## 29.9 Basic linear algebra algorithms [[linalg]](linalg#algs.blas1.givens.lartg)

### 29.9.13 BLAS 1 algorithms [[linalg.algs.blas1]](linalg.algs.blas1#givens.lartg)

#### 29.9.13.2 Givens rotations [[linalg.algs.blas1.givens]](linalg.algs.blas1.givens#lartg)

#### 29.9.13.2.1 Compute Givens rotation [linalg.algs.blas1.givens.lartg]

[ð](#lib:setup_givens_rotation)

`template<class Real>
  setup_givens_rotation_result<Real> setup_givens_rotation(Real a, Real b) noexcept;

template<class Real>
  setup_givens_rotation_result<complex<Real>>
    setup_givens_rotation(complex<Real> a, complex<Real> b) noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L13370)

These functions compute the Givens plane rotation
represented by the two values c and s such that the 2 x 2 system of equations  
[csâÂ¯Â¯Â¯sc]â[ab]=[r0]

holds, where c is always a real scalar, and c2+|s|2=1[.](#1.sentence-2)

That is, c and s represent a 2 x 2 matrix,
that when multiplied by the right by the input vector
whose components are a and b,
produces a result vector
whose first component r is the Euclidean norm of the input vector, and
whose second component is zero[.](#1.sentence-3)

[*Note [1](#note-1)*:

These functions correspond to the LAPACK function xLARTG[[bib]](bibliography#bib:lapack "Bibliography")[.](#1.sentence-4)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L13402)

*Returns*: c, s, r,
where c and s form the Givens plane rotation
corresponding to the input a and b,
and r is the Euclidean norm of the two-component vector
formed by a and b[.](#2.sentence-1)
