tmp/tmphl124slj/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Scaled sum of squares of a vector’s elements <a id="linalg.algs.blas1.ssq">[[linalg.algs.blas1.ssq]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<in-vector InVec, class Scalar>
|
| 5 |
+
sum_of_squares_result<Scalar> vector_sum_of_squares(InVec v, sum_of_squares_result<Scalar> init);
|
| 6 |
+
template<class ExecutionPolicy, in-vector InVec, class Scalar>
|
| 7 |
+
sum_of_squares_result<Scalar> vector_sum_of_squares(ExecutionPolicy&& exec,
|
| 8 |
+
InVec v, sum_of_squares_result<Scalar> init);
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
[*Note 1*: These functions correspond to the LAPACK function
|
| 12 |
+
`xLASSQ`. — *end note*]
|
| 13 |
+
|
| 14 |
+
*Mandates:*
|
| 15 |
+
`decltype(`*`abs-if-needed`*`(declval<typename InVec::value_type>()))`
|
| 16 |
+
is convertible to `Scalar`.
|
| 17 |
+
|
| 18 |
+
*Effects:* Returns a value `result` such that
|
| 19 |
+
|
| 20 |
+
- `result.scaling_factor` is the maximum of `init.scaling_factor` and
|
| 21 |
+
*`abs-if-needed`*`(x[i])` for all `i` in the domain of `v`; and
|
| 22 |
+
- let `s2init` be
|
| 23 |
+
``` cpp
|
| 24 |
+
init.scaling_factor * init.scaling_factor * init.scaled_sum_of_squares
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
then
|
| 28 |
+
`result.scaling_factor * result.scaling_factor * result.scaled_sum_of_squares`
|
| 29 |
+
equals the sum of `s2init` and the squares of
|
| 30 |
+
*`abs-if-needed`*`(x[i])` for all `i` in the domain of `v`.
|
| 31 |
+
|
| 32 |
+
*Remarks:* If `InVec::value_type`, and `Scalar` are all floating-point
|
| 33 |
+
types or specializations of `complex`, and if `Scalar` has higher
|
| 34 |
+
precision than `InVec::value_type`, then intermediate terms in the sum
|
| 35 |
+
use `Scalar`’s precision or greater.
|
| 36 |
+
|