tmp/tmpp8tkb6vl/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General matrix-vector product <a id="linalg.algs.blas2.gemv">[[linalg.algs.blas2.gemv]]</a>
|
| 2 |
+
|
| 3 |
+
[*Note 1*: These functions correspond to the BLAS function
|
| 4 |
+
`xGEMV`. — *end note*]
|
| 5 |
+
|
| 6 |
+
The following elements apply to all functions in
|
| 7 |
+
[[linalg.algs.blas2.gemv]].
|
| 8 |
+
|
| 9 |
+
*Mandates:*
|
| 10 |
+
|
| 11 |
+
- `possibly-multipliable<decltype(A), decltype(x), decltype(y)>()` is
|
| 12 |
+
`true`, and
|
| 13 |
+
- `possibly-addable<decltype(x), decltype(y), decltype(z)>()` is `true`
|
| 14 |
+
for those overloads that take a `z` parameter.
|
| 15 |
+
|
| 16 |
+
*Preconditions:*
|
| 17 |
+
|
| 18 |
+
- `multipliable(A,x,y)` is `true`, and
|
| 19 |
+
- `addable(x,y,z)` is `true` for those overloads that take a `z`
|
| 20 |
+
parameter.
|
| 21 |
+
|
| 22 |
+
*Complexity:* 𝑂(`x.extent(0)` × `A.extent(1)`).
|
| 23 |
+
|
| 24 |
+
``` cpp
|
| 25 |
+
template<in-matrix InMat, in-vector InVec, out-vector OutVec>
|
| 26 |
+
void matrix_vector_product(InMat A, InVec x, OutVec y);
|
| 27 |
+
template<class ExecutionPolicy, in-matrix InMat, in-vector InVec, out-vector OutVec>
|
| 28 |
+
void matrix_vector_product(ExecutionPolicy&& exec, InMat A, InVec x, OutVec y);
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
These functions perform an overwriting matrix-vector product.
|
| 32 |
+
|
| 33 |
+
*Effects:* Computes y = A x.
|
| 34 |
+
|
| 35 |
+
[*Example 1*:
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
constexpr size_t num_rows = 5;
|
| 39 |
+
constexpr size_t num_cols = 6;
|
| 40 |
+
|
| 41 |
+
// y = 3.0 * A * x
|
| 42 |
+
void scaled_matvec_1(mdspan<double, extents<size_t, num_rows, num_cols>> A,
|
| 43 |
+
mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) {
|
| 44 |
+
matrix_vector_product(scaled(3.0, A), x, y);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// z = 7.0 times the transpose of A, times y
|
| 48 |
+
void scaled_transposed_matvec(mdspan<double, extents<size_t, num_rows, num_cols>> A,
|
| 49 |
+
mdspan<double, extents<size_t, num_rows>> y, mdspan<double, extents<size_t, num_cols>> z) {
|
| 50 |
+
matrix_vector_product(scaled(7.0, transposed(A)), y, z);
|
| 51 |
+
}
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
— *end example*]
|
| 55 |
+
|
| 56 |
+
``` cpp
|
| 57 |
+
template<in-matrix InMat, in-vector InVec1, in-vector InVec2, out-vector OutVec>
|
| 58 |
+
void matrix_vector_product(InMat A, InVec1 x, InVec2 y, OutVec z);
|
| 59 |
+
template<class ExecutionPolicy,
|
| 60 |
+
in-matrix InMat, in-vector InVec1, in-vector InVec2, out-vector OutVec>
|
| 61 |
+
void matrix_vector_product(ExecutionPolicy&& exec,
|
| 62 |
+
InMat A, InVec1 x, InVec2 y, OutVec z);
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
These functions perform an updating matrix-vector product.
|
| 66 |
+
|
| 67 |
+
*Effects:* Computes z = y + A x.
|
| 68 |
+
|
| 69 |
+
*Remarks:* `z` may alias `y`.
|
| 70 |
+
|
| 71 |
+
[*Example 2*:
|
| 72 |
+
|
| 73 |
+
``` cpp
|
| 74 |
+
// y = 3.0 * A * x + 2.0 * y
|
| 75 |
+
void scaled_matvec_2(mdspan<double, extents<size_t, num_rows, num_cols>> A,
|
| 76 |
+
mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) {
|
| 77 |
+
matrix_vector_product(scaled(3.0, A), x, scaled(2.0, y), y);
|
| 78 |
+
}
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
— *end example*]
|
| 82 |
+
|