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

2.4 KiB
Raw Blame History

[linalg.algs.blas1.ssq]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.13 BLAS 1 algorithms [linalg.algs.blas1]

29.9.13.8 Scaled sum of squares of a vector's elements [linalg.algs.blas1.ssq]

🔗

template<[in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, class Scalar> sum_of_squares_result<Scalar> vector_sum_of_squares(InVec v, sum_of_squares_result<Scalar> init); template<class ExecutionPolicy, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, class Scalar> sum_of_squares_result<Scalar> vector_sum_of_squares(ExecutionPolicy&& exec, InVec v, sum_of_squares_result<Scalar> init);

1

#

[Note 1:

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

— end note]

2

#

Mandates: decltype(abs-if-needed(declval<typename InVec::value_type>())) is convertible to Scalar.

3

#

Effects: Returns a value result such that

result.scaling_factor is the maximum of init.scaling_factor andabs-if-needed(x[i]) for all i in the domain of v; and

let s2init beinit.scaling_factor * init.scaling_factor * init.scaled_sum_of_squares then result.scaling_factor * result.scaling_factor * result.scaled_sum_of_squares equals the sum of s2init and the squares of abs-if-needed(x[i]) for all i in the domain of v.

4

#

Remarks: If InVec::value_type, and Scalar are all floating-point types or specializations of complex, and if Scalar has higher precision than InVec::value_type, then intermediate terms in the sum use Scalar's precision or greater.