3.0 KiB
[linalg.algs.blas1.matfrobnorm]
29 Numerics library [numerics]
29.9 Basic linear algebra algorithms [linalg]
29.9.13 BLAS 1 algorithms [linalg.algs.blas1]
29.9.13.12 Frobenius norm of a matrix [linalg.algs.blas1.matfrobnorm]
[Note 1:
These functions exist in the BLAS standard[bib] but are not part of the reference implementation.
â end note]
template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InMat, class Scalar> Scalar matrix_frob_norm(InMat A, Scalar init); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InMat, class Scalar> Scalar matrix_frob_norm(ExecutionPolicy&& exec, InMat A, Scalar init);
Mandates: Let a beabs-if-needed(declval<typename InMat::value_type>()).
Then, decltype(init + a * a) is convertible to Scalar.
Returns: The square root of the sum of squares of init and the absolute values of the elements of A.
[Note 2:
For init equal to zero, this is the Frobenius norm of the matrix A.
â end note]
Remarks: If InMat::value_type and Scalar are all floating-point types or specializations of complex, and if Scalar has higher precision than InMat::value_type, then intermediate terms in the sum use Scalar's precision or greater.
template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InMat> auto matrix_frob_norm(InMat A); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InMat> auto matrix_frob_norm(ExecutionPolicy&& exec, InMat A);
Effects: Let a beabs-if-needed(declval<typename InMat::value_type>()).
Let T bedecltype(a * a).
Then,
the one-parameter overload is equivalent to:return matrix_frob_norm(A, T{}); and
the two-parameter overload is equivalent to:return matrix_frob_norm(std::forward(exec), A, T{});