tmp/tmp8cp29xdt/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Dot product of two vectors <a id="linalg.algs.blas1.dot">[[linalg.algs.blas1.dot]]</a>
|
| 2 |
+
|
| 3 |
+
[*Note 1*: The functions in this section correspond to the BLAS
|
| 4 |
+
functions `xDOT`, `xDOTU`, and `xDOTC`. — *end note*]
|
| 5 |
+
|
| 6 |
+
The following elements apply to all functions in
|
| 7 |
+
[[linalg.algs.blas1.dot]].
|
| 8 |
+
|
| 9 |
+
*Mandates:* `compatible-static-extents<InVec1, InVec2>(0, 0)` is `true`.
|
| 10 |
+
|
| 11 |
+
*Preconditions:* `v1.extent(0)` equals `v2.extent(0)`.
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
template<in-vector InVec1, in-vector InVec2, class Scalar>
|
| 15 |
+
Scalar dot(InVec1 v1, InVec2 v2, Scalar init);
|
| 16 |
+
template<class ExecutionPolicy, in-vector InVec1, in-vector InVec2, class Scalar>
|
| 17 |
+
Scalar dot(ExecutionPolicy&& exec,
|
| 18 |
+
InVec1 v1, InVec2 v2, Scalar init);
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
These functions compute a non-conjugated dot product with an explicitly
|
| 22 |
+
specified result type.
|
| 23 |
+
|
| 24 |
+
*Returns:* Let `N` be `v1.extent(0)`.
|
| 25 |
+
|
| 26 |
+
- `init` if `N` is zero;
|
| 27 |
+
- otherwise, *GENERALIZED_SUM*(plus\<\>(), init, v1\[0\]\*v2\[0\], …,
|
| 28 |
+
v1\[N-1\]\*v2\[N-1\]).
|
| 29 |
+
|
| 30 |
+
*Remarks:* If `InVec1::value_type`, `InVec2::value_type`, and `Scalar`
|
| 31 |
+
are all floating-point types or specializations of `complex`, and if
|
| 32 |
+
`Scalar` has higher precision than `InVec1::value_type` or
|
| 33 |
+
`InVec2::value_type`, then intermediate terms in the sum use `Scalar`’s
|
| 34 |
+
precision or greater.
|
| 35 |
+
|
| 36 |
+
``` cpp
|
| 37 |
+
template<in-vector InVec1, in-vector InVec2>
|
| 38 |
+
auto dot(InVec1 v1, InVec2 v2);
|
| 39 |
+
template<class ExecutionPolicy, in-vector InVec1, in-vector InVec2>
|
| 40 |
+
auto dot(ExecutionPolicy&& exec,
|
| 41 |
+
InVec1 v1, InVec2 v2);
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
These functions compute a non-conjugated dot product with a default
|
| 45 |
+
result type.
|
| 46 |
+
|
| 47 |
+
*Effects:* Let `T` be
|
| 48 |
+
`decltype(declval<typename InVec1::value_type>() * declval<typename InVec2::value_type>())`.
|
| 49 |
+
Then,
|
| 50 |
+
|
| 51 |
+
- the two-parameter overload is equivalent to:
|
| 52 |
+
``` cpp
|
| 53 |
+
return dot(v1, v2, T{});
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
and
|
| 57 |
+
- the three-parameter overload is equivalent to:
|
| 58 |
+
``` cpp
|
| 59 |
+
return dot(std::forward<ExecutionPolicy>(exec), v1, v2, T{});
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
``` cpp
|
| 63 |
+
template<in-vector InVec1, in-vector InVec2, class Scalar>
|
| 64 |
+
Scalar dotc(InVec1 v1, InVec2 v2, Scalar init);
|
| 65 |
+
template<class ExecutionPolicy, in-vector InVec1, in-vector InVec2, class Scalar>
|
| 66 |
+
Scalar dotc(ExecutionPolicy&& exec,
|
| 67 |
+
InVec1 v1, InVec2 v2, Scalar init);
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
These functions compute a conjugated dot product with an explicitly
|
| 71 |
+
specified result type.
|
| 72 |
+
|
| 73 |
+
*Effects:*
|
| 74 |
+
|
| 75 |
+
- The three-parameter overload is equivalent to:
|
| 76 |
+
``` cpp
|
| 77 |
+
return dot(conjugated(v1), v2, init);
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
and
|
| 81 |
+
- the four-parameter overload is equivalent to:
|
| 82 |
+
``` cpp
|
| 83 |
+
return dot(std::forward<ExecutionPolicy>(exec), conjugated(v1), v2, init);
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
``` cpp
|
| 87 |
+
template<in-vector InVec1, in-vector InVec2>
|
| 88 |
+
auto dotc(InVec1 v1, InVec2 v2);
|
| 89 |
+
template<class ExecutionPolicy, in-vector InVec1, in-vector InVec2>
|
| 90 |
+
auto dotc(ExecutionPolicy&& exec,
|
| 91 |
+
InVec1 v1, InVec2 v2);
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
These functions compute a conjugated dot product with a default result
|
| 95 |
+
type.
|
| 96 |
+
|
| 97 |
+
*Effects:* Let `T` be
|
| 98 |
+
`decltype(`*`conj-if-needed`*`(declval<typename InVec1::value_type>()) * declval<typename InVec2::value_type>())`.
|
| 99 |
+
Then,
|
| 100 |
+
|
| 101 |
+
- the two-parameter overload is equivalent to:
|
| 102 |
+
``` cpp
|
| 103 |
+
return dotc(v1, v2, T{});
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
and
|
| 107 |
+
- the three-parameter overload is equivalent to
|
| 108 |
+
``` cpp
|
| 109 |
+
return dotc(std::forward<ExecutionPolicy>(exec), v1, v2, T{});
|
| 110 |
+
```
|
| 111 |
+
|