[linalg.algs.blas2.symherrank1]

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

## 29.9 Basic linear algebra algorithms [[linalg]](linalg#algs.blas2.symherrank1)

### 29.9.14 BLAS 2 algorithms [[linalg.algs.blas2]](linalg.algs.blas2#symherrank1)

#### 29.9.14.7 Symmetric or Hermitian Rank-1 (outer product) update of a matrix [linalg.algs.blas2.symherrank1]

[1](#1)

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

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

These functions correspond to the BLAS functionsxSYR, xSPR, xHER, and xHPR[[bib]](bibliography#bib:blas2 "Bibliography")[.](#1.sentence-1)

They have overloads taking a scaling factor alpha,
because it would be impossible to express the updateA=AâxxT otherwise[.](#1.sentence-2)

â *end note*]

[2](#2)

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

The following elements apply to all functions in [linalg.algs.blas2.symherrank1][.](#2.sentence-1)

[3](#3)

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

*Mandates*: 

- [(3.1)](#3.1)

If InOutMat has layout_blas_packed layout,
then the layout's Triangle template argument has
the same type as the function's Triangle template argument;

- [(3.2)](#3.2)

*compatible-static-extents*<decltype(A), decltype(A)>(0, 1) is true; and

- [(3.3)](#3.3)

*compatible-static-extents*<decltype(A), decltype(x)>(0, 0) is true[.](#3.sentence-1)

[4](#4)

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

*Preconditions*: 

- [(4.1)](#4.1)

A.extent(0) equals A.extent(1), and

- [(4.2)](#4.2)

A.extent(0) equals x.extent(0)[.](#4.sentence-1)

[5](#5)

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

*Complexity*: O(x.extent(0)Ãx.extent(0))[.](#5.sentence-1)

[ð](#lib:symmetric_matrix_rank_1_update)

`template<class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void symmetric_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A, Triangle t);
template<class ExecutionPolicy,
         class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec,
                                      Scalar alpha, InVec x, InOutMat A, Triangle t);
`

[6](#6)

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

These functions perform
a symmetric rank-1 update of the symmetric matrix A,
taking into account the Triangle parameter
that applies to A ([[linalg.general]](linalg.general "29.9.3 General"))[.](#6.sentence-1)

[7](#7)

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

*Effects*: Computes a matrix Aâ² such thatAâ²=A+Î±xxT, where the scalar Î± is alpha,
and assigns each element of Aâ² to the corresponding element of A[.](#7.sentence-1)

[ð](#lib:symmetric_matrix_rank_1_update_)

`template<[in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void symmetric_matrix_rank_1_update(InVec x, InOutMat A, Triangle t);
template<class ExecutionPolicy,
         [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t);
`

[8](#8)

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

These functions perform
a symmetric rank-1 update of the symmetric matrix A,
taking into account the Triangle parameter
that applies to A ([[linalg.general]](linalg.general "29.9.3 General"))[.](#8.sentence-1)

[9](#9)

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

*Effects*: Computes a matrix Aâ² such that Aâ²=A+xxT and assigns each element of Aâ² to the corresponding element of A[.](#9.sentence-1)

[ð](#lib:hermitian_matrix_rank_1_update)

`template<class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void hermitian_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A, Triangle t);
template<class ExecutionPolicy,
         class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec,
                                      Scalar alpha, InVec x, InOutMat A, Triangle t);
`

[10](#10)

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

These functions perform
a Hermitian rank-1 update of the Hermitian matrix A,
taking into account the Triangle parameter
that applies to A ([[linalg.general]](linalg.general "29.9.3 General"))[.](#10.sentence-1)

[11](#11)

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

*Effects*: Computes Aâ² such thatAâ²=A+Î±xxH, where the scalar Î± is alpha,
and assigns each element of Aâ² to the corresponding element of A[.](#11.sentence-1)

[ð](#lib:hermitian_matrix_rank_1_update_)

`template<[in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void hermitian_matrix_rank_1_update(InVec x, InOutMat A, Triangle t);
template<class ExecutionPolicy,
         [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InOutMat, class Triangle>
  void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t);
`

[12](#12)

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

These functions perform
a Hermitian rank-1 update of the Hermitian matrix A,
taking into account the Triangle parameter
that applies to A ([[linalg.general]](linalg.general "29.9.3 General"))[.](#12.sentence-1)

[13](#13)

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

*Effects*: Computes a matrix Aâ² such that Aâ²=A+xxH and
assigns each element of Aâ² to the corresponding element of A[.](#13.sentence-1)
