68 lines
2.7 KiB
Markdown
68 lines
2.7 KiB
Markdown
[simd.binary]
|
|
|
|
# 29 Numerics library [[numerics]](./#numerics)
|
|
|
|
## 29.10 Data-parallel types [[simd]](simd#binary)
|
|
|
|
### 29.10.8 basic_vec non-member operations [[simd.nonmembers]](simd.nonmembers#simd.binary)
|
|
|
|
#### 29.10.8.1 basic_vec binary operators [simd.binary]
|
|
|
|
[ð](#lib:operator+,basic_vec)
|
|
|
|
`friend constexpr basic_vec operator+(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator-(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator*(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator/(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator%(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator&(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator|(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator^(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator<<(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
friend constexpr basic_vec operator>>(const basic_vec& lhs, const basic_vec& rhs) noexcept;
|
|
`
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18153)
|
|
|
|
Let *op* be the operator[.](#1.sentence-1)
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18156)
|
|
|
|
*Constraints*: requires (value_type a, value_type b) { a *op* b; } istrue[.](#2.sentence-1)
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18161)
|
|
|
|
*Returns*: A basic_vec object initialized with the results of applying*op* to lhs and rhs as a binary element-wise
|
|
operation[.](#3.sentence-1)
|
|
|
|
[ð](#lib:operator%3c%3c,basic_vec_)
|
|
|
|
`friend constexpr basic_vec operator<<(const basic_vec& v, simd-size-type n) noexcept;
|
|
friend constexpr basic_vec operator>>(const basic_vec& v, simd-size-type n) noexcept;
|
|
`
|
|
|
|
[4](#4)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18176)
|
|
|
|
Let *op* be the operator[.](#4.sentence-1)
|
|
|
|
[5](#5)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18179)
|
|
|
|
*Constraints*: requires (value_type a, *simd-size-type* b) { a*op* b; } is true[.](#5.sentence-1)
|
|
|
|
[6](#6)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L18184)
|
|
|
|
*Returns*: A basic_vec object where the ith element is initialized to
|
|
the result of applying *op* to v[i] and n for alli in the range of [0, size())[.](#6.sentence-1)
|