tmp/tmp9u061qs1/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Givens rotations <a id="linalg.algs.blas1.givens">[[linalg.algs.blas1.givens]]</a>
|
| 2 |
+
|
| 3 |
+
##### Compute Givens rotation <a id="linalg.algs.blas1.givens.lartg">[[linalg.algs.blas1.givens.lartg]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
template<class Real>
|
| 7 |
+
setup_givens_rotation_result<Real> setup_givens_rotation(Real a, Real b) noexcept;
|
| 8 |
+
|
| 9 |
+
template<class Real>
|
| 10 |
+
setup_givens_rotation_result<complex<Real>>
|
| 11 |
+
setup_givens_rotation(complex<Real> a, complex<Real> b) noexcept;
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
These functions compute the Givens plane rotation represented by the two
|
| 15 |
+
values c and s such that the 2 x 2 system of equations
|
| 16 |
+
$$\left[ \begin{matrix}
|
| 17 |
+
c & s \\
|
| 18 |
+
-\overline{s} & c \\
|
| 19 |
+
\end{matrix} \right]
|
| 20 |
+
\cdot
|
| 21 |
+
\left[ \begin{matrix}
|
| 22 |
+
a \\
|
| 23 |
+
b \\
|
| 24 |
+
\end{matrix} \right]
|
| 25 |
+
=
|
| 26 |
+
\left[ \begin{matrix}
|
| 27 |
+
r \\
|
| 28 |
+
0 \\
|
| 29 |
+
\end{matrix} \right]$$
|
| 30 |
+
|
| 31 |
+
holds, where c is always a real scalar, and c² + |s|^2 = 1. That is, c
|
| 32 |
+
and s represent a 2 x 2 matrix, that when multiplied by the right by the
|
| 33 |
+
input vector whose components are a and b, produces a result vector
|
| 34 |
+
whose first component r is the Euclidean norm of the input vector, and
|
| 35 |
+
whose second component is zero.
|
| 36 |
+
|
| 37 |
+
[*Note 1*: These functions correspond to the LAPACK function
|
| 38 |
+
`xLARTG`. — *end note*]
|
| 39 |
+
|
| 40 |
+
*Returns:* `c, s, r`, where `c` and `s` form the Givens plane rotation
|
| 41 |
+
corresponding to the input `a` and `b`, and `r` is the Euclidean norm of
|
| 42 |
+
the two-component vector formed by `a` and `b`.
|
| 43 |
+
|
| 44 |
+
##### Apply a computed Givens rotation to vectors <a id="linalg.algs.blas1.givens.rot">[[linalg.algs.blas1.givens.rot]]</a>
|
| 45 |
+
|
| 46 |
+
``` cpp
|
| 47 |
+
template<inout-vector InOutVec1, inout-vector InOutVec2, class Real>
|
| 48 |
+
void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, Real s);
|
| 49 |
+
template<class ExecutionPolicy, inout-vector InOutVec1, inout-vector InOutVec2, class Real>
|
| 50 |
+
void apply_givens_rotation(ExecutionPolicy&& exec,
|
| 51 |
+
InOutVec1 x, InOutVec2 y, Real c, Real s);
|
| 52 |
+
template<inout-vector InOutVec1, inout-vector InOutVec2, class Real>
|
| 53 |
+
void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, complex<Real> s);
|
| 54 |
+
template<class ExecutionPolicy, inout-vector InOutVec1, inout-vector InOutVec2, class Real>
|
| 55 |
+
void apply_givens_rotation(ExecutionPolicy&& exec,
|
| 56 |
+
InOutVec1 x, InOutVec2 y, Real c, complex<Real> s);
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
[*Note 2*: These functions correspond to the BLAS function
|
| 60 |
+
`xROT`. — *end note*]
|
| 61 |
+
|
| 62 |
+
*Mandates:* *`compatible-static-extents`*`<InOutVec1, InOutVec2>(0, 0)`
|
| 63 |
+
is `true`.
|
| 64 |
+
|
| 65 |
+
*Preconditions:* `x.extent(0)` equals `y.extent(0)`.
|
| 66 |
+
|
| 67 |
+
*Effects:* Applies the plane rotation specified by `c` and `s` to the
|
| 68 |
+
input vectors `x` and `y`, as if the rotation were a 2 x 2 matrix and
|
| 69 |
+
the input vectors were successive rows of a matrix with two rows.
|
| 70 |
+
|