[linalg.algs.blas1.matfrobnorm]

# 29 Numerics library [[numerics]](./#numerics)

## 29.9 Basic linear algebra algorithms [[linalg]](linalg#algs.blas1.matfrobnorm)

### 29.9.13 BLAS 1 algorithms [[linalg.algs.blas1]](linalg.algs.blas1#matfrobnorm)

#### 29.9.13.12 Frobenius norm of a matrix [linalg.algs.blas1.matfrobnorm]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L13991)

[*Note [1](#note-1)*:

These functions exist in the BLAS standard[[bib]](bibliography#bib:blas-std "Bibliography") but are not part of the reference implementation[.](#1.sentence-1)

â *end note*]

[ð](#lib:matrix_frob_norm)

`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);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L14007)

*Mandates*: Let a be*abs-if-needed*(declval<typename InMat​::​value_type>())[.](#2.sentence-1)

Then, decltype(init + a * a) is convertible to Scalar[.](#2.sentence-2)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L14014)

*Returns*: The square root of the sum of squares
of init and the absolute values of the elements of A[.](#3.sentence-1)

[*Note [2](#note-2)*:

For init equal to zero,
this is the Frobenius norm of the matrix A[.](#3.sentence-2)

â *end note*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L14023)

*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[.](#4.sentence-1)

[ð](#lib:matrix_frob_norm_)

`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);
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L14041)

*Effects*: Let a be*abs-if-needed*(declval<typename InMat​::​value_type>())[.](#5.sentence-1)

Let T bedecltype(a * a)[.](#5.sentence-2)

Then,

- [(5.1)](#5.1)

the one-parameter overload is equivalent to:return matrix_frob_norm(A, T{}); and

- [(5.2)](#5.2)

the two-parameter overload is equivalent to:return matrix_frob_norm(std::forward<ExecutionPolicy>(exec), A, T{});
