Files
cppdraft_translate/cppdraft/linalg/algs/blas1/givens.md
2025-10-25 03:02:53 +03:00

4.6 KiB
Raw Blame History

[linalg.algs.blas1.givens]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.13 BLAS 1 algorithms [linalg.algs.blas1]

29.9.13.2 Givens rotations [linalg.algs.blas1.givens]

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

🔗

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

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

1

#

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.

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.

[Note 1:

These functions correspond to the LAPACK function xLARTG[bib].

— end note]

2

#

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.

29.9.13.2.2 Apply a computed Givens rotation to vectors [linalg.algs.blas1.givens.rot]

🔗

template<[inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec1, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec2, class Real> void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, Real s); template<class ExecutionPolicy, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec1, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec2, class Real> void apply_givens_rotation(ExecutionPolicy&& exec, InOutVec1 x, InOutVec2 y, Real c, Real s); template<[inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec1, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec2, class Real> void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, complex<Real> s); template<class ExecutionPolicy, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec1, [inout-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec2, class Real> void apply_givens_rotation(ExecutionPolicy&& exec, InOutVec1 x, InOutVec2 y, Real c, complex<Real> s);

1

#

[Note 1:

These functions correspond to the BLAS function xROT[bib].

— end note]

2

#

Mandates: compatible-static-extents<InOutVec1, InOutVec2>(0, 0) is true.

3

#

Preconditions: x.extent(0) equals y.extent(0).

4

#

Effects: Applies the plane rotation specified by c and s to the input vectors x and y, as if the rotation were a 2 x 2 matrix and the input vectors were successive rows of a matrix with two rows.