[linalg.algs.blas1.add]

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

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

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

#### 29.9.13.6 Add vectors or matrices elementwise [linalg.algs.blas1.add]

[ð](#lib:add)

`template<[in-object](linalg.helpers.concepts#concept:in-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InObj1, [in-object](linalg.helpers.concepts#concept:in-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InObj2, [out-object](linalg.helpers.concepts#concept:out-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") OutObj>
  void add(InObj1 x, InObj2 y, OutObj z);
template<class ExecutionPolicy, [in-object](linalg.helpers.concepts#concept:in-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InObj1, [in-object](linalg.helpers.concepts#concept:in-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") InObj2, [out-object](linalg.helpers.concepts#concept:out-object "29.9.7.5 Argument concepts [linalg.helpers.concepts]") OutObj>
  void add(ExecutionPolicy&& exec,
           InObj1 x, InObj2 y, OutObj z);
`

[1](#1)

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

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

These functions correspond to the BLAS function xAXPY[[bib]](bibliography#bib:blas1 "Bibliography")[.](#1.sentence-1)

â *end note*]

[2](#2)

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

*Constraints*: x.rank(), y.rank(), and z.rank() are all equal[.](#2.sentence-1)

[3](#3)

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

*Mandates*: *possibly-addable*<InObj1, InObj2, OutObj>() is true[.](#3.sentence-1)

[4](#4)

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

*Preconditions*: *addable*(x,y,z) is true[.](#4.sentence-1)

[5](#5)

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

*Effects*: Computes z=x+y[.](#5.sentence-1)

[6](#6)

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

*Remarks*: z may alias x or y[.](#6.sentence-1)
