[simd]

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

## 29.10 Data-parallel types [simd]

### [29.10.1](#general) General [[simd.general]](simd.general)

[1](#general-1)

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

Subclause [simd] defines data-parallel types and operations on these types[.](#general-1.sentence-1)

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

The intent is to support acceleration through data-parallel execution resources
where available, such as SIMD registers and instructions or execution units
driven by a common instruction decoder[.](#general-1.sentence-2)

SIMD stands for âSingle Instruction Stream â Multiple Data Streamâ;
it is defined in Flynn 1966[[bib]](bibliography#bib:flynn-taxonomy "Bibliography")[.](#general-1.sentence-3)

â *end note*]

[2](#general-2)

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

The set of [*vectorizable types*](#def:type,vectorizable "29.10.1 General [simd.general]") comprises

- [(2.1)](#general-2.1)

all standard integer types, character types, and the types float and double ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"));

- [(2.2)](#general-2.2)

std​::​float16_t, std​::​float32_t, and std​::​float64_t if defined ([[basic.extended.fp]](basic.extended.fp "6.9.3 Optional extended floating-point types")); and

- [(2.3)](#general-2.3)

complex<T> where T is a vectorizable floating-point type[.](#general-2.sentence-1)

[3](#general-3)

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

The term [*data-parallel type*](#def:type,data-parallel "29.10.1 General [simd.general]") refers to all enabled specializations of
the basic_vec and basic_mask class templates[.](#general-3.sentence-1)

A [*data-parallel object*](#def:object,data-parallel "29.10.1 General [simd.general]") is an object of data-parallel type[.](#general-3.sentence-2)

[4](#general-4)

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

Each specialization of basic_vec or basic_mask is either
enabled or disabled, as described in [[simd.overview]](#overview "29.10.7.1 Class template basic_­vec overview") and[[simd.mask.overview]](#mask.overview "29.10.9.1 Class template basic_­mask overview")[.](#general-4.sentence-1)

[5](#general-5)

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

A data-parallel type consists of one or more elements of an underlying
vectorizable type, called the [*element type*](#def:type,element "29.10.1 General [simd.general]")[.](#general-5.sentence-1)

The number of elements is a constant for each data-parallel type and called the[*width*](#def:width "29.10.1 General [simd.general]") of that type[.](#general-5.sentence-2)

The elements in a data-parallel type are indexed from 0 to widthâ1[.](#general-5.sentence-3)

[6](#general-6)

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

An [*element-wise operation*](#def:operation,element-wise "29.10.1 General [simd.general]") applies a specified operation to the
elements of one or more data-parallel objects[.](#general-6.sentence-1)

Each such application is unsequenced with respect to the others[.](#general-6.sentence-2)

A [*unary element-wise operation*](#def:operation,unary_element-wise "29.10.1 General [simd.general]") is an element-wise operation that
applies a unary operation to each element of a data-parallel object[.](#general-6.sentence-3)

A [*binary element-wise operation*](#def:operation,binary_element-wise "29.10.1 General [simd.general]") is an element-wise operation that
applies a binary operation to corresponding elements of two data-parallel
objects[.](#general-6.sentence-4)

[7](#general-7)

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

Given a basic_mask<Bytes, Abi> object mask, the[*selected indices*](#def:indices,selected "29.10.1 General [simd.general]") signify the integers i in the range
[0, mask.size()) for which mask[i] is true[.](#general-7.sentence-1)

Given a data-parallel object data, the [*selected elements*](#def:elements,selected "29.10.1 General [simd.general]") signify the elements data[i] for all selected indices i[.](#general-7.sentence-2)

[8](#general-8)

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

The conversion from an arithmetic type U to a vectorizable typeT is [*value-preserving*](#def:value-preserving "29.10.1 General [simd.general]") if all possible values of U can be
represented with type T[.](#general-8.sentence-1)

### [29.10.2](#expos) Exposition-only types, variables, and concepts [[simd.expos]](simd.expos)

using *simd-size-type* = *see below*; // *exposition only*template<size_t Bytes> using *integer-from* = *see below*; // *exposition only*template<class T, class Abi>constexpr *simd-size-type* *simd-size-v* = *see below*; // *exposition only*template<class T> constexpr size_t *mask-element-size* = *see below*; // *exposition only*template<class T>concept [*constexpr-wrapper-like*](#concept:constexpr-wrapper-like "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<T, decltype(T::value)> &&[equality_comparable_with](concept.equalitycomparable#concept:equality_comparable_with "18.5.4 Concept equality_­comparable [concept.equalitycomparable]")<T, decltype(T::value)> && bool_constant<T() == T::value>::value && bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;

template<class T> using *deduced-vec-t* = *see below*; // *exposition only*template<class V, class T> using *make-compatible-simd-t* = *see below*; // *exposition only*template<class V>concept [*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<V, basic_vec<typename V::value_type, typename V::abi_type>> && is_default_constructible_v<V>;

template<class V>concept [*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<V, basic_mask<*mask-element-size*<V>, typename V::abi_type>> && is_default_constructible_v<V>;

template<class V>concept [*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<V> && [floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]")<typename V::value_type>;

template<class V>concept [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<V> && [integral](concepts.arithmetic#concept:integral "18.4.7 Arithmetic concepts [concepts.arithmetic]")<typename V::value_type>;

template<class V>using *simd-complex-value-type* = typename V::value_type::value_type; // *exposition only*template<class V>concept [*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<V> && [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<typename V::value_type, complex<*simd-complex-value-type*<V>>>;

template<class... Ts>concept [*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") = // *exposition only*([*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<*deduced-vec-t*<Ts>> || ...);

template<class... Ts>requires [*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<Ts...>using *math-common-simd-t* = *see below*; // *exposition only*template<class BinaryOperation, class T>concept [*reduction-binary-operation*](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]") = *see below*; // *exposition only*// [[simd.expos.abi]](#expos.abi "29.10.2.2 simd ABI tags"), simd ABI tagstemplate<class T> using *native-abi* = *see below*; // *exposition only*template<class T, *simd-size-type* N> using *deduce-abi-t* = *see below*; // *exposition only*// [[simd.flags]](#flags "29.10.5 Load and store flags"), Load and store flagsstruct *convert-flag*; // *exposition only*struct *aligned-flag*; // *exposition only*template<size_t N> struct *overaligned-flag*; // *exposition only*

#### [29.10.2.1](#expos.defn) Exposition-only helpers [[simd.expos.defn]](simd.expos.defn)

[ð](#expos.defn-itemdecl:1)

`using simd-size-type = see below;
`

[1](#expos.defn-1)

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

*simd-size-type* is an alias for a signed integer type[.](#expos.defn-1.sentence-1)

[ð](#expos.defn-itemdecl:2)

`template<size_t Bytes> using integer-from = see below;
`

[2](#expos.defn-2)

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

*integer-from*<Bytes> is an alias for a signed integer typeT such that sizeof(T) equals Bytes[.](#expos.defn-2.sentence-1)

[ð](#expos.defn-itemdecl:3)

`template<class T, class Abi>
  constexpr simd-size-type simd-size-v = see below;
`

[3](#expos.defn-3)

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

*simd-size-v*<T, Abi> denotes the width of basic_vec<T,
Abi> if the specialization basic_vec<T, Abi> is enabled, or 0 otherwise[.](#expos.defn-3.sentence-1)

[ð](#expos.defn-itemdecl:4)

`template<class T> constexpr size_t mask-element-size = see below;
`

[4](#expos.defn-4)

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

*mask-element-size*<basic_mask<Bytes, Abi>> has the valueBytes[.](#expos.defn-4.sentence-1)

[ð](#expos.defn-itemdecl:5)

`template<class T> using deduced-vec-t = see below;
`

[5](#expos.defn-5)

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

Let x denote an lvalue of type const T[.](#expos.defn-5.sentence-1)

[6](#expos.defn-6)

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

*deduced-vec-t*<T> is an alias for

- [(6.1)](#expos.defn-6.1)

decltype(x + x), if the type of x + x is an enabled
 specialization of basic_vec; otherwise

- [(6.2)](#expos.defn-6.2)

void[.](#expos.defn-6.sentence-1)

[ð](#expos.defn-itemdecl:6)

`template<class V, class T> using make-compatible-simd-t = see below;
`

[7](#expos.defn-7)

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

Let x denote an lvalue of type const T[.](#expos.defn-7.sentence-1)

[8](#expos.defn-8)

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

*make-compatible-simd-t*<V, T> is an alias for

- [(8.1)](#expos.defn-8.1)

*deduced-vec-t*<T>, if that type is not void,
 otherwise

- [(8.2)](#expos.defn-8.2)

vec<decltype(x + x), V​::​size()>[.](#expos.defn-8.sentence-1)

[ð](#expos.defn-itemdecl:7)

`template<class... Ts>
  requires [math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<Ts...>
    using math-common-simd-t = see below;
`

[9](#expos.defn-9)

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

Let T0 denote Ts...[0][.](#expos.defn-9.sentence-1)

Let T1 denote Ts...[1][.](#expos.defn-9.sentence-2)

Let TRest denote a pack such that T0, T1, TRest... is equivalent
to Ts...[.](#expos.defn-9.sentence-3)

[10](#expos.defn-10)

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

Let *math-common-simd-t*<Ts...> be an alias for

- [(10.1)](#expos.defn-10.1)

*deduced-vec-t*<T0>, if sizeof...(Ts) equals 1;
 otherwise

- [(10.2)](#expos.defn-10.2)

common_type_t<*deduced-vec-t*<T0>, *deduced-vec-t*<T1>>, if sizeof...(Ts) equals 2 and [*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<T0> &&[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<T1> is true; otherwise

- [(10.3)](#expos.defn-10.3)

common_type_t<*deduced-vec-t*<T0>, T1>, if sizeof...(Ts) equals 2 and *math-floating-​point*<​T0> is true; otherwise

- [(10.4)](#expos.defn-10.4)

common_type_t<T0, *deduced-vec-t*<T1>>, if sizeof...(Ts) equals 2; otherwise

- [(10.5)](#expos.defn-10.5)

common_type_t<*math-common-simd-t*<T0, T1>, TRest...>, if *math-common-simd-t*<T0, T1> is valid and denotes a type;
 otherwise

- [(10.6)](#expos.defn-10.6)

common_type_t<*math-common-simd-t*<TRest...>, T0, T1>[.](#expos.defn-10.sentence-1)

[ð](#concept:reduction-binary-operation)

`template<class BinaryOperation, class T>
  concept [reduction-binary-operation](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]") =
    requires (const BinaryOperation binary_op, const vec<T, 1> v) {
      { binary_op(v, v) } -> [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<vec<T, 1>>;
    };
`

[11](#expos.defn-11)

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

Types BinaryOperation and T model[*reduction-binary-operation*](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]")<BinaryOperation, T> only if:

- [(11.1)](#expos.defn-11.1)

  BinaryOperation is a binary element-wise operation and the
operation is commutative[.](#expos.defn-11.1.sentence-1)

- [(11.2)](#expos.defn-11.2)

  An object of type BinaryOperation can be invoked with two
arguments of type basic_vec<T, Abi>, with unspecified ABI tagAbi, returning a basic_vec<T, Abi>[.](#expos.defn-11.2.sentence-1)

#### [29.10.2.2](#expos.abi) simd ABI tags [[simd.expos.abi]](simd.expos.abi)

[ð](#expos.abi-itemdecl:1)

`template<class T> using native-abi = see below;
template<class T, simd-size-type N> using deduce-abi-t = see below;
`

[1](#expos.abi-1)

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

An [*ABI tag*](#def:ABI_tag "29.10.2.2 simd ABI tags [simd.expos.abi]") is a type that indicates a choice of size and binary
representation for objects of data-parallel type[.](#expos.abi-1.sentence-1)

[*Note [1](#expos.abi-note-1)*:

The intent is for the size and binary representation to depend on the target
architecture and compiler flags[.](#expos.abi-1.sentence-2)

The ABI tag, together with a given element type, implies the width[.](#expos.abi-1.sentence-3)

â *end note*]

[2](#expos.abi-2)

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

[*Note [2](#expos.abi-note-2)*:

The ABI tag is orthogonal to selecting the machine instruction set[.](#expos.abi-2.sentence-1)

The selected machine instruction set limits the usable ABI tag types, though
(see [[simd.overview]](#overview "29.10.7.1 Class template basic_­vec overview"))[.](#expos.abi-2.sentence-2)

The ABI tags enable users to safely pass objects of data-parallel type between
translation unit boundaries (e.g., function calls or I/O)[.](#expos.abi-2.sentence-3)

â *end note*]

[3](#expos.abi-3)

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

An implementation defines ABI tag types as necessary for the following aliases[.](#expos.abi-3.sentence-1)

[4](#expos.abi-4)

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

*deduce-abi-t*<T, N> is defined if

- [(4.1)](#expos.abi-4.1)

T is a vectorizable type,

- [(4.2)](#expos.abi-4.2)

N is greater than zero, and

- [(4.3)](#expos.abi-4.3)

N is not larger than an implementation-defined maximum[.](#expos.abi-4.sentence-1)

The implementation-defined maximum forN is not smaller than 64 and can differ depending on T[.](#expos.abi-4.sentence-2)

[5](#expos.abi-5)

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

Where present, *deduce-abi-t*<T, N> names an ABI tag type such
that

- [(5.1)](#expos.abi-5.1)

*simd-size-v*<T, *deduce-abi-t*<T, N>> equals N,

- [(5.2)](#expos.abi-5.2)

basic_vec<T, *deduce-abi-t*<T, N>> is
 enabled ([[simd.overview]](#overview "29.10.7.1 Class template basic_­vec overview")), and

- [(5.3)](#expos.abi-5.3)

basic_mask<sizeof(T), *deduce-abi-t*<*integer-from*<sizeof(T)>, N>> is enabled[.](#expos.abi-5.sentence-1)

[6](#expos.abi-6)

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

*native-abi*<T> is an implementation-defined alias for an ABI tag[.](#expos.abi-6.sentence-1)

basic_vec<T, *native-abi*<T>> is an enabled specialization[.](#expos.abi-6.sentence-2)

[*Note [3](#expos.abi-note-3)*:

The intent is to use the ABI tag producing the most efficient data-parallel
execution for the element type T on the currently targeted system[.](#expos.abi-6.sentence-3)

For target architectures with ISA extensions, compiler flags can change the type
of the *native-abi*<T> alias[.](#expos.abi-6.sentence-4)

â *end note*]

[*Example [1](#expos.abi-example-1)*:

Consider a target architecture supporting the ABI tags __simd128 and__simd256, where hardware support for __simd256 exists only for
floating-point types[.](#expos.abi-6.sentence-5)

The implementation therefore defines *native-abi*<T> as an alias
for

- [(6.1)](#expos.abi-6.1)

__simd256 if T is a floating-point type, and

- [(6.2)](#expos.abi-6.2)

__simd128 otherwise[.](#expos.abi-6.sentence-6)

â *end example*]

### [29.10.3](#syn) Header <simd> synopsis [[simd.syn]](simd.syn)

[ð](#header:%3csimd%3e)

namespace std::simd {// [[simd.traits]](#traits "29.10.4 Type traits"), type traitstemplate<class T, class U = typename T::value_type> struct alignment; template<class T, class U = typename T::value_type>constexpr size_t [alignment_v](#lib:simd,alignment_v "29.10.3 Header <simd> synopsis [simd.syn]") = alignment<T, U>::value; template<class T, class V> struct rebind { using type = *see below*; }; template<class T, class V> using [rebind_t](#lib:simd,rebind_t "29.10.3 Header <simd> synopsis [simd.syn]") = typename rebind<T, V>::type; template<*simd-size-type* N, class V> struct resize { using type = *see below*; }; template<*simd-size-type* N, class V> using [resize_t](#lib:simd,resize_t "29.10.3 Header <simd> synopsis [simd.syn]") = typename resize<N, V>::type; // [[simd.flags]](#flags "29.10.5 Load and store flags"), load and store flagstemplate<class... Flags> struct flags; inline constexpr flags<> [flag_default](#lib:simd,flag_default "29.10.3 Header <simd> synopsis [simd.syn]"){}; inline constexpr flags<*convert-flag*> [flag_convert](#lib:simd,flag_convert "29.10.3 Header <simd> synopsis [simd.syn]"){}; inline constexpr flags<*aligned-flag*> [flag_aligned](#lib:simd,flag_aligned "29.10.3 Header <simd> synopsis [simd.syn]"){}; template<size_t N> requires (has_single_bit(N))constexpr flags<*overaligned-flag*<N>> [flag_overaligned](#lib:simd,flag_overaligned "29.10.3 Header <simd> synopsis [simd.syn]"){}; // [[simd.iterator]](#iterator "29.10.6 Class template simd-iterator"), class template *simd-iterator*template<class V>class *simd-iterator*; // *exposition only*// [[simd.class]](#class "29.10.7 Class template basic_­vec"), class template basic_vectemplate<class T, class Abi = *native-abi*<T>> class basic_vec; template<class T, *simd-size-type* N = *simd-size-v*<T, *native-abi*<T>>>using [vec](#lib:simd,vec "29.10.3 Header <simd> synopsis [simd.syn]") = basic_vec<T, *deduce-abi-t*<T, N>>; // [[simd.mask.class]](#mask.class "29.10.9 Class template basic_­mask"), class template basic_masktemplate<size_t Bytes, class Abi = *native-abi*<*integer-from*<Bytes>>> class basic_mask; template<class T, *simd-size-type* N = *simd-size-v*<T, *native-abi*<T>>>using [mask](#lib:simd,mask "29.10.3 Header <simd> synopsis [simd.syn]") = basic_mask<sizeof(T), *deduce-abi-t*<T, N>>; // [[simd.loadstore]](#loadstore "29.10.8.6 basic_­vec load and store functions"), basic_vec load and store functionstemplate<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V unchecked_load(R&& r, flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V unchecked_load(R&& r, const typename V::mask_type& k,
 flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>constexpr V unchecked_load(I first, iter_difference_t<I> n,
 flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>constexpr V unchecked_load(I first, iter_difference_t<I> n, const typename V::mask_type& k, flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>constexpr V unchecked_load(I first, S last, flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>constexpr V unchecked_load(I first, S last, const typename V::mask_type& k,
 flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V partial_load(R&& r, flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V partial_load(R&& r, const typename V::mask_type& k,
 flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>constexpr V partial_load(I first, iter_difference_t<I> n, flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>constexpr V partial_load(I first, iter_difference_t<I> n, const typename V::mask_type& k, flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>constexpr V partial_load(I first, S last, flags<Flags...> f = {}); template<class V = *see below*, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>constexpr V partial_load(I first, S last, const typename V::mask_type& k,
 flags<Flags...> f = {}); template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, R&& r,
 flags<Flags...> f = {}); template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, R&& r, const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first,
 iter_difference_t<I> n, flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first,
 iter_difference_t<I> n, const typename basic_vec<T, Abi>::mask_type& mask,
 flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, S last,
 flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, S last, const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {}); template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>constexpr void partial_store(const basic_vec<T, Abi>& v, R&& r,
 flags<Flags...> f = {}); template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>constexpr void partial_store(const basic_vec<T, Abi>& v, R&& r, const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void partial_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n, flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void partial_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n, const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void partial_store(const basic_vec<T, Abi>& v, I first, S last,
 flags<Flags...> f = {}); template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>constexpr void partial_store(const basic_vec<T, Abi>& v, I first, S last, const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {}); // [[simd.permute.static]](#permute.static "29.10.8.7 vec static permute"), permute by static index generatorstatic constexpr *simd-size-type* [zero_element](#lib:simd,zero_element "29.10.3 Header <simd> synopsis [simd.syn]") = *implementation-defined*; static constexpr *simd-size-type* [uninit_element](#lib:simd,uninit_element "29.10.3 Header <simd> synopsis [simd.syn]") = *implementation-defined*; template<*simd-size-type* N = *see below*, [*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, class IdxMap>constexpr resize_t<N, V> permute(const V& v, IdxMap&& idxmap); template<*simd-size-type* N = *see below*, [*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M, class IdxMap>constexpr resize_t<N, M> permute(const M& v, IdxMap&& idxmap); // [[simd.permute.dynamic]](#permute.dynamic "29.10.8.8 vec dynamic permute"), permute by dynamic indextemplate<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>constexpr resize_t<I::size(), V> permute(const V& v, const I& indices); template<[*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>constexpr resize_t<I::size(), M> permute(const M& v, const I& indices); // [[simd.permute.mask]](#permute.mask "29.10.8.9 vec mask permute"), permute by active mask bitstemplate<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr V compress(const V& v, const typename V::mask_type& selector); template<[*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>constexpr M compress(const M& v, const type_identity_t<M>& selector); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr V compress(const V& v, const typename V::mask_type& selector, const typename V::value_type& fill_value); template<[*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>constexpr M compress(const M& v, const type_identity_t<M>& selector, const typename M::value_type& fill_value); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr V expand(const V& v, const typename V::mask_type& selector, const V& original = {}); template<[*simd-mask-type*](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>constexpr M expand(const M& v, const type_identity_t<M>& selector, const M& original = {}); // [[simd.permute.memory]](#permute.memory "29.10.8.10 simd memory permute"), permute to and from memorytemplate<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V unchecked_gather_from(R&& in, const I& indices, flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V unchecked_gather_from(R&& in, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V partial_gather_from(R&& in, const I& indices, flags<Flags...> f = {}); template<class V = *see below*, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr V partial_gather_from(R&& in, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {}); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr void unchecked_scatter_to(const V& v, R&& out, const I& indices, flags<Flags...> f = {}); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr void unchecked_scatter_to(const V& v, R&& out, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {}); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr void partial_scatter_to(const V& v, R&& out, const I& indices, flags<Flags...> f = {}); template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>constexpr void partial_scatter_to(const V& v, R&& out, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {}); // [[simd.creation]](#creation "29.10.8.11 basic_­vec and basic_­mask creation"), basic_vec and basic_mask creationtemplate<class T, class Abi>constexpr auto chunk(const basic_vec<typename T::value_type, Abi>& x) noexcept; template<class T, class Abi>constexpr auto chunk(const basic_mask<*mask-element-size*<T>, Abi>& x) noexcept; template<*simd-size-type* N, class T, class Abi>constexpr auto chunk(const basic_vec<T, Abi>& x) noexcept; template<*simd-size-type* N, size_t Bytes, class Abi>constexpr auto chunk(const basic_mask<Bytes, Abi>& x) noexcept; template<class T, class... Abis>constexpr basic_vec<T, *deduce-abi-t*<T, (basic_vec<T, Abis>::size() + ...)>> cat(const basic_vec<T, Abis>&...) noexcept; template<size_t Bytes, class... Abis>constexpr basic_mask<Bytes, *deduce-abi-t*<*integer-from*<Bytes>, (basic_mask<Bytes, Abis>::size() + ...)>> cat(const basic_mask<Bytes, Abis>&...) noexcept; // [[simd.mask.reductions]](#mask.reductions "29.10.10.5 basic_­mask reductions"), basic_mask reductionstemplate<size_t Bytes, class Abi>constexpr bool all_of(const basic_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi>constexpr bool any_of(const basic_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi>constexpr bool none_of(const basic_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi>constexpr *simd-size-type* reduce_count(const basic_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi>constexpr *simd-size-type* reduce_min_index(const basic_mask<Bytes, Abi>&); template<size_t Bytes, class Abi>constexpr *simd-size-type* reduce_max_index(const basic_mask<Bytes, Abi>&); constexpr bool all_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto) noexcept; constexpr bool any_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto) noexcept; constexpr bool none_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto) noexcept; constexpr *simd-size-type* reduce_count([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto) noexcept; constexpr *simd-size-type* reduce_min_index([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto); constexpr *simd-size-type* reduce_max_index([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto); // [[simd.reductions]](#reductions "29.10.8.5 basic_­vec reductions"), basic_vec reductionstemplate<class T, class Abi, class BinaryOperation = plus<>>constexpr T reduce(const basic_vec<T, Abi>&, BinaryOperation = {}); template<class T, class Abi, class BinaryOperation = plus<>>constexpr T reduce(const basic_vec<T, Abi>& x, const typename basic_vec<T, Abi>::mask_type& mask,
 BinaryOperation binary_op = {}, type_identity_t<T> identity_element = *see below*); template<class T, class Abi>constexpr T reduce_min(const basic_vec<T, Abi>&) noexcept; template<class T, class Abi>constexpr T reduce_min(const basic_vec<T, Abi>&, const typename basic_vec<T, Abi>::mask_type&) noexcept; template<class T, class Abi>constexpr T reduce_max(const basic_vec<T, Abi>&) noexcept; template<class T, class Abi>constexpr T reduce_max(const basic_vec<T, Abi>&, const typename basic_vec<T, Abi>::mask_type&) noexcept; // [[simd.alg]](#alg "29.10.8.12 Algorithms"), algorithmstemplate<class T, class Abi>constexpr basic_vec<T, Abi> min(const basic_vec<T, Abi>& a, const basic_vec<T, Abi>& b) noexcept; template<class T, class Abi>constexpr basic_vec<T, Abi> max(const basic_vec<T, Abi>& a, const basic_vec<T, Abi>& b) noexcept; template<class T, class Abi>constexpr pair<basic_vec<T, Abi>, basic_vec<T, Abi>> minmax(const basic_vec<T, Abi>& a, const basic_vec<T, Abi>& b) noexcept; template<class T, class Abi>constexpr basic_vec<T, Abi> clamp(const basic_vec<T, Abi>& v, const basic_vec<T, Abi>& lo, const basic_vec<T, Abi>& hi); template<class T, class U>constexpr auto select(bool c, const T& a, const U& b)-> remove_cvref_t<decltype(c ? a : b)>; template<size_t Bytes, class Abi, class T, class U>constexpr auto select(const basic_mask<Bytes, Abi>& c, const T& a, const U& b)noexcept -> decltype(*simd-select-impl*(c, a, b)); // [[simd.math]](#math "29.10.8.13 Mathematical functions"), mathematical functionstemplate<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> acos(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> asin(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> atan(const V& x); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> atan2(const V0& y, const V1& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> cos(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> sin(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> tan(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> acosh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> asinh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> atanh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> cosh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> sinh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> tanh(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> exp(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> exp2(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> expm1(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> frexp(const V& value, rebind_t<int, *deduced-vec-t*<V>>* exp); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<int, *deduced-vec-t*<V>> ilogb(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> ldexp(const V& x, const rebind_t<int, *deduced-vec-t*<V>>& exp); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> log(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> log10(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> log1p(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> log2(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> logb(const V& x); template<class T, class Abi>constexpr basic_vec<T, Abi> modf(const type_identity_t<basic_vec<T, Abi>>& value, basic_vec<T, Abi>* iptr); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> scalbn(const V& x, const rebind_t<int, *deduced-vec-t*<V>>& n); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> scalbln(const V& x, const rebind_t<long int, *deduced-vec-t*<V>>& n); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> cbrt(const V& x); template<[signed_integral](concepts.arithmetic#concept:signed_integral "18.4.7 Arithmetic concepts [concepts.arithmetic]") T, class Abi>constexpr basic_vec<T, Abi> abs(const basic_vec<T, Abi>& j); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> abs(const V& j); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> fabs(const V& x); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> hypot(const V0& x, const V1& y); template<class V0, class V1, class V2>constexpr *math-common-simd-t*<V0, V1, V2> hypot(const V0& x, const V1& y, const V2& z); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> pow(const V0& x, const V1& y); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> sqrt(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> erf(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> erfc(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> lgamma(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> tgamma(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> ceil(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr *deduced-vec-t*<V> floor(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> *deduced-vec-t*<V> nearbyint(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> *deduced-vec-t*<V> rint(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> rebind_t<long int, *deduced-vec-t*<V>> lrint(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> rebind_t<long long int, V> llrint(const *deduced-vec-t*<V>& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> round(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<long int, *deduced-vec-t*<V>> lround(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<long long int, *deduced-vec-t*<V>> llround(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr *deduced-vec-t*<V> trunc(const V& x); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> fmod(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> remainder(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> remquo(const V0& x, const V1& y, rebind_t<int, *math-common-simd-t*<V0, V1>>* quo); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> copysign(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> nextafter(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> fdim(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> fmax(const V0& x, const V1& y); template<class V0, class V1>constexpr *math-common-simd-t*<V0, V1> fmin(const V0& x, const V1& y); template<class V0, class V1, class V2>constexpr *math-common-simd-t*<V0, V1, V2> fma(const V0& x, const V1& y, const V2& z); template<class V0, class V1, class V2>constexpr *math-common-simd-t*<V0, V1, V2> lerp(const V0& a, const V1& b, const V2& t) noexcept; template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<int, *deduced-vec-t*<V>> fpclassify(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename *deduced-vec-t*<V>::mask_type isfinite(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename *deduced-vec-t*<V>::mask_type isinf(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename *deduced-vec-t*<V>::mask_type isnan(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename *deduced-vec-t*<V>::mask_type isnormal(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename *deduced-vec-t*<V>::mask_type signbit(const V& x); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 isgreater(const V0& x, const V1& y); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 isgreaterequal(const V0& x, const V1& y); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 isless(const V0& x, const V1& y); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 islessequal(const V0& x, const V1& y); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 islessgreater(const V0& x, const V1& y); template<class V0, class V1>constexpr typename *math-common-simd-t*<V0, V1>::mask_type
 isunordered(const V0& x, const V1& y); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> assoc_laguerre(const rebind_t<unsigned, *deduced-vec-t*<V>>& n, const rebind_t<unsigned, *deduced-vec-t*<V>>& m, const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> assoc_legendre(const rebind_t<unsigned, *deduced-vec-t*<V>>& l, const rebind_t<unsigned, *deduced-vec-t*<V>>& m, const V& x); template<class V0, class V1>*math-common-simd-t*<V0, V1> beta(const V0& x, const V1& y); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> *deduced-vec-t*<V> comp_ellint_1(const V& k); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> *deduced-vec-t*<V> comp_ellint_2(const V& k); template<class V0, class V1>*math-common-simd-t*<V0, V1> comp_ellint_3(const V0& k, const V1& nu); template<class V0, class V1>*math-common-simd-t*<V0, V1> cyl_bessel_i(const V0& nu, const V1& x); template<class V0, class V1>*math-common-simd-t*<V0, V1> cyl_bessel_j(const V0& nu, const V1& x); template<class V0, class V1>*math-common-simd-t*<V0, V1> cyl_bessel_k(const V0& nu, const V1& x); template<class V0, class V1>*math-common-simd-t*<V0, V1> cyl_neumann(const V0& nu, const V1& x); template<class V0, class V1>*math-common-simd-t*<V0, V1> ellint_1(const V0& k, const V1& phi); template<class V0, class V1>*math-common-simd-t*<V0, V1> ellint_2(const V0& k, const V1& phi); template<class V0, class V1, class V2>*math-common-simd-t*<V0, V1, V2> ellint_3(const V0& k, const V1& nu, const V2& phi); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> *deduced-vec-t*<V> expint(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> hermite(const rebind_t<unsigned, *deduced-vec-t*<V>>& n, const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> laguerre(const rebind_t<unsigned, *deduced-vec-t*<V>>& n, const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> legendre(const rebind_t<unsigned, *deduced-vec-t*<V>>& l, const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> riemann_zeta(const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> sph_bessel(const rebind_t<unsigned, *deduced-vec-t*<V>>& n, const V& x); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> sph_legendre(const rebind_t<unsigned, *deduced-vec-t*<V>>& l, const rebind_t<unsigned, *deduced-vec-t*<V>>& m, const V& theta); template<[*math-floating-point*](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>*deduced-vec-t*<V> sph_neumann(const rebind_t<unsigned, *deduced-vec-t*<V>>& n, const V& x); // [[simd.bit]](#bit "29.10.8.14 basic_­vec bit library"), bit manipulationtemplate<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V byteswap(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V bit_ceil(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V bit_floor(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr typename V::mask_type has_single_bit(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V0, [*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V1>constexpr V0 rotl(const V0& v, const V1& s) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr V rotl(const V& v, int s) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V0, [*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V1>constexpr V0 rotr(const V0& v, const V1& s) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr V rotr(const V& v, int s) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> bit_width(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_zero(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_one(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_zero(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_one(const V& v) noexcept; template<[*simd-vec-type*](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<make_signed_t<typename V::value_type>, V> popcount(const V& v) noexcept; // [[simd.complex.math]](#complex.math "29.10.8.15 vec complex math"), vec complex mathtemplate<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<*simd-complex-value-type<V>*, V> real(const V&) noexcept; template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<*simd-complex-value-type<V>*, V> imag(const V&) noexcept; template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<*simd-complex-value-type<V>*, V> abs(const V&); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<*simd-complex-value-type<V>*, V> arg(const V&); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr rebind_t<*simd-complex-value-type<V>*, V> norm(const V&); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V conj(const V&); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V proj(const V&); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V exp(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V log(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V log10(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sqrt(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sin(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V asin(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V cos(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V acos(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V tan(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V atan(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sinh(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V asinh(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V cosh(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V acosh(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V tanh(const V& v); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V atanh(const V& v); template<[*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> rebind_t<complex<typename V::value_type>, V> polar(const V& x, const V& y = {}); template<[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V pow(const V& x, const V& y);}namespace std {// See [[simd.alg]](#alg "29.10.8.12 Algorithms"), algorithmsusing simd::min; using simd::max; using simd::minmax; using simd::clamp; // See [[simd.math]](#math "29.10.8.13 Mathematical functions"), mathematical functionsusing simd::acos; using simd::asin; using simd::atan; using simd::atan2; using simd::cos; using simd::sin; using simd::tan; using simd::acosh; using simd::asinh; using simd::atanh; using simd::cosh; using simd::sinh; using simd::tanh; using simd::exp; using simd::exp2; using simd::expm1; using simd::frexp; using simd::ilogb; using simd::ldexp; using simd::log; using simd::log10; using simd::log1p; using simd::log2; using simd::logb; using simd::modf; using simd::scalbn; using simd::scalbln; using simd::cbrt; using simd::abs; using simd::fabs; using simd::hypot; using simd::pow; using simd::sqrt; using simd::erf; using simd::erfc; using simd::lgamma; using simd::tgamma; using simd::ceil; using simd::floor; using simd::nearbyint; using simd::rint; using simd::lrint; using simd::llrint; using simd::round; using simd::lround; using simd::llround; using simd::trunc; using simd::fmod; using simd::remainder; using simd::remquo; using simd::copysign; using simd::nextafter; using simd::fdim; using simd::fmax; using simd::fmin; using simd::fma; using simd::lerp; using simd::fpclassify; using simd::isfinite; using simd::isinf; using simd::isnan; using simd::isnormal; using simd::signbit; using simd::isgreater; using simd::isgreaterequal; using simd::isless; using simd::islessequal; using simd::islessgreater; using simd::isunordered; using simd::assoc_laguerre; using simd::assoc_legendre; using simd::beta; using simd::comp_ellint_1; using simd::comp_ellint_2; using simd::comp_ellint_3; using simd::cyl_bessel_i; using simd::cyl_bessel_j; using simd::cyl_bessel_k; using simd::cyl_neumann; using simd::ellint_1; using simd::ellint_2; using simd::ellint_3; using simd::expint; using simd::hermite; using simd::laguerre; using simd::legendre; using simd::riemann_zeta; using simd::sph_bessel; using simd::sph_legendre; using simd::sph_neumann; // See [[simd.bit]](#bit "29.10.8.14 basic_­vec bit library"), bit manipulationusing simd::byteswap; using simd::bit_ceil; using simd::bit_floor; using simd::has_single_bit; using simd::rotl; using simd::rotr; using simd::bit_width; using simd::countl_zero; using simd::countl_one; using simd::countr_zero; using simd::countr_one; using simd::popcount; // See [[simd.complex.math]](#complex.math "29.10.8.15 vec complex math"), vec complex mathusing simd::real; using simd::imag; using simd::arg; using simd::norm; using simd::conj; using simd::proj; using simd::polar;}

### [29.10.4](#traits) Type traits [[simd.traits]](simd.traits)

[ð](#lib:alignment,simd)

`template<class T, class U = typename T::value_type> struct alignment { see below };
`

[1](#traits-1)

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

alignment<T, U> has a member value if and only if

- [(1.1)](#traits-1.1)

T is a specialization of basic_mask and U is bool, or

- [(1.2)](#traits-1.2)

T is a specialization of basic_vec and U is a
 vectorizable type[.](#traits-1.sentence-1)

[2](#traits-2)

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

If value is present, the type alignment<T, U> is aBinaryTypeTrait with a base characteristic ofintegral_constant<size_t, N> for some unspecifiedN ([[simd.ctor]](#ctor "29.10.7.2 basic_­vec constructors"), [[simd.loadstore]](#loadstore "29.10.8.6 basic_­vec load and store functions"))[.](#traits-2.sentence-1)

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

value identifies the alignment restrictions on pointers used for
(converting) loads and stores for the given type T on arrays of typeU[.](#traits-2.sentence-2)

â *end note*]

[3](#traits-3)

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

The behavior of a program that adds specializations for alignment is undefined[.](#traits-3.sentence-1)

[ð](#lib:rebind,simd)

`template<class T, class V> struct rebind { using type = see below; };
`

[4](#traits-4)

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

The member type is present if and only if

- [(4.1)](#traits-4.1)

V is a data-parallel type,

- [(4.2)](#traits-4.2)

T is a vectorizable type, and

- [(4.3)](#traits-4.3)

*deduce-abi-t*<T, V​::​size()> has a member type type[.](#traits-4.sentence-1)

[5](#traits-5)

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

If V is a specialization of basic_vec, let Abi1 denote
an ABI tag such that basic_vec<T, Abi1>​::​​size() equalsV​::​size()[.](#traits-5.sentence-1)

If V is a specialization of basic_mask, let Abi1 denote an ABI tag such that basic_mask<sizeof(T),
Abi1>​::​​size() equals V​::​size()[.](#traits-5.sentence-2)

[6](#traits-6)

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

Where present, the member typedef type names basic_vec<T, Abi1> if V is a specialization of basic_vec orbasic_mask<sizeof(T), Abi1> if V is a specialization ofbasic_mask[.](#traits-6.sentence-1)

[ð](#lib:resize,simd)

`template<simd-size-type N, class V> struct resize { using type = see below; };
`

[7](#traits-7)

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

Let T denote

- [(7.1)](#traits-7.1)

typename V​::​value_type if V is a specialization of basic_vec,

- [(7.2)](#traits-7.2)

otherwise *integer-from*<*mask-element-size*<V>> if V is a specialization of basic_mask[.](#traits-7.sentence-1)

[8](#traits-8)

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

The member type is present if and only if

- [(8.1)](#traits-8.1)

V is a data-parallel type, and

- [(8.2)](#traits-8.2)

*deduce-abi-t*<T, N> has a member type type[.](#traits-8.sentence-1)

[9](#traits-9)

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

If V is a specialization of basic_vec, let Abi1 denote an
ABI tag such that basic_vec<T, Abi1>​::​​size() equals N[.](#traits-9.sentence-1)

If V is a specialization of basic_mask, let Abi1 denote an ABI tag such that basic_mask<sizeof(T), Abi1>​::​size() equals N[.](#traits-9.sentence-2)

[10](#traits-10)

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

Where present, the member typedef type names basic_vec<T, Abi1> if V is a specialization of basic_vec orbasic_mask<sizeof(T), Abi1> if V is a specialization ofbasic_mask[.](#traits-10.sentence-1)

### [29.10.5](#flags) Load and store flags [[simd.flags]](simd.flags)

#### [29.10.5.1](#flags.overview) Class template flags overview [[simd.flags.overview]](simd.flags.overview)

[ð](#lib:flags,simd)

namespace std::simd {template<class... Flags> struct flags {// [[simd.flags.oper]](#flags.oper "29.10.5.2 flags operators"), flags operatorstemplate<class... Other>friend consteval auto operator|(flags, flags<Other...>); };}

[1](#flags.overview-1)

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

[*Note [1](#flags.overview-note-1)*:

The class template flags acts like an integer bit-flag for types[.](#flags.overview-1.sentence-1)

â *end note*]

[2](#flags.overview-2)

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

*Constraints*: Every type in the parameter pack Flags is one of *convert-flag*,*aligned-flag*, or *overaligned-​flag*<N>[.](#flags.overview-2.sentence-1)

#### [29.10.5.2](#flags.oper) flags operators [[simd.flags.oper]](simd.flags.oper)

[ð](#lib:operator%7c,simd::flags)

`template<class... Other>
  friend consteval auto operator|(flags a, flags<Other...> b);
`

[1](#flags.oper-1)

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

*Returns*: A default-initialized object of type flags<Flags2...> for some Flags2 where every type in Flags2 is present either in template parameter pack Flags or in template parameter pack Other, and every type in template parameter
 packs Flags and Other is present in Flags2[.](#flags.oper-1.sentence-1)

If the packs Flags and Other contain two
 different specializations *overaligned-flag*<N1> and *overaligned-flag*<N2>, Flags2 is not required to contain the
 specialization *overaligned-flag*<std​::​min(N1, N2)>[.](#flags.oper-1.sentence-2)

### [29.10.6](#iterator) Class template *simd-iterator* [[simd.iterator]](simd.iterator)

[ð](#lib:iterator,basic_vec)

namespace std::simd {template<class V>class *simd-iterator* { // *exposition only* V* *data_* = nullptr; // *exposition only**simd-size-type* *offset_* = 0; // *exposition only*constexpr *simd-iterator*(V& d, *simd-size-type* off) noexcept; // *exposition only*public:using value_type = typename V::value_type; using iterator_category = input_iterator_tag; using iterator_concept = random_access_iterator_tag; using difference_type = *simd-size-type*; constexpr *simd-iterator*() = default; constexpr *simd-iterator*(const *simd-iterator*&) = default; constexpr *simd-iterator*& operator=(const *simd-iterator*&) = default; constexpr *simd-iterator*(const *simd-iterator*<remove_const_t<V>>&) requires is_const_v<V>; constexpr value_type operator*() const; constexpr *simd-iterator*& operator++(); constexpr *simd-iterator* operator++(int); constexpr *simd-iterator*& operator--(); constexpr *simd-iterator* operator--(int); constexpr *simd-iterator*& operator+=(difference_type n); constexpr *simd-iterator*& operator-=(difference_type n); constexpr value_type operator[](difference_type n) const; friend constexpr bool operator==(*simd-iterator* a, *simd-iterator* b) = default; friend constexpr bool operator==(*simd-iterator* a, default_sentinel_t) noexcept; friend constexpr auto operator<=>(*simd-iterator* a, *simd-iterator* b); friend constexpr *simd-iterator* operator+(*simd-iterator* i, difference_type n); friend constexpr *simd-iterator* operator+(difference_type n, *simd-iterator* i); friend constexpr *simd-iterator* operator-(*simd-iterator* i, difference_type n); friend constexpr difference_type operator-(*simd-iterator* a, *simd-iterator* b); friend constexpr difference_type operator-(*simd-iterator* i, default_sentinel_t) noexcept; friend constexpr difference_type operator-(default_sentinel_t, *simd-iterator* i) noexcept; };}

[ð](#iterator-itemdecl:1)

`constexpr simd-iterator(V& d, simd-size-type off) noexcept;
`

[1](#iterator-1)

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

*Effects*: Initializes *data_* with addressof(d) and *offset_* with off[.](#iterator-1.sentence-1)

[ð](#iterator-itemdecl:2)

`constexpr simd-iterator(const simd-iterator<remove_const_t<V>>& i) requires is_const_v<V>;
`

[2](#iterator-2)

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

*Effects*: Initializes *data_* with i.*data_* and *offset_* with i.*offset_*[.](#iterator-2.sentence-1)

[ð](#iterator-itemdecl:3)

`constexpr value_type operator*() const;
`

[3](#iterator-3)

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

*Effects*: Equivalent to: return (**data_*)[*offset_*];

[ð](#iterator-itemdecl:4)

`constexpr simd-iterator& operator++();
`

[4](#iterator-4)

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

*Effects*: Equivalent to: return *this += 1;

[ð](#iterator-itemdecl:5)

`constexpr simd-iterator operator++(int);
`

[5](#iterator-5)

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

*Effects*: Equivalent to:*simd-iterator* tmp = *this;*this += 1;return tmp;

[ð](#iterator-itemdecl:6)

`constexpr simd-iterator& operator--();
`

[6](#iterator-6)

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

*Effects*: Equivalent to: return *this -= 1;

[ð](#iterator-itemdecl:7)

`constexpr simd-iterator operator--(int);
`

[7](#iterator-7)

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

*Effects*: Equivalent to:*simd-iterator* tmp = *this;*this -= 1;return tmp;

[ð](#iterator-itemdecl:8)

`constexpr simd-iterator& operator+=(difference_type n);
`

[8](#iterator-8)

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

*Preconditions*: *offset_* + n is in the range [0, V​::​size()][.](#iterator-8.sentence-1)

[9](#iterator-9)

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

*Effects*: Equivalent to:*offset_* += n;return *this;

[ð](#iterator-itemdecl:9)

`constexpr simd-iterator& operator-=(difference_type n);
`

[10](#iterator-10)

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

*Preconditions*: *offset_* - n is in the range [0, V​::​size()][.](#iterator-10.sentence-1)

[11](#iterator-11)

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

*Effects*: Equivalent to:*offset_* -= n;return *this;

[ð](#iterator-itemdecl:10)

`constexpr value_type operator[](difference_type n) const;
`

[12](#iterator-12)

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

*Effects*: Equivalent to: return (**data_*)[*offset_* + n];

[ð](#iterator-itemdecl:11)

`friend constexpr bool operator==(simd-iterator i, default_sentinel_t) noexcept;
`

[13](#iterator-13)

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

*Effects*: Equivalent to: return i.*offset_* == V​::​size();

[ð](#iterator-itemdecl:12)

`friend constexpr auto operator<=>(simd-iterator a, simd-iterator b);
`

[14](#iterator-14)

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

*Preconditions*: a.*data_* == b.*data_* is true[.](#iterator-14.sentence-1)

[15](#iterator-15)

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

*Effects*: Equivalent to: return a.*offset_* <=> b.*offset_*;

[ð](#iterator-itemdecl:13)

`friend constexpr simd-iterator operator+(simd-iterator i, difference_type n);
friend constexpr simd-iterator operator+(difference_type n, simd-iterator i);
`

[16](#iterator-16)

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

*Effects*: Equivalent to: return i += n;

[ð](#iterator-itemdecl:14)

`friend constexpr simd-iterator operator-(simd-iterator i, difference_type n);
`

[17](#iterator-17)

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

*Effects*: Equivalent to: return i -= n;

[ð](#iterator-itemdecl:15)

`friend constexpr difference_type operator-(simd-iterator a, simd-iterator b);
`

[18](#iterator-18)

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

*Preconditions*: a.*data_* == b.*data_* is true[.](#iterator-18.sentence-1)

[19](#iterator-19)

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

*Effects*: Equivalent to: return a.*offset_* - b.*offset_*;

[ð](#iterator-itemdecl:16)

`friend constexpr difference_type operator-(simd-iterator i, default_sentinel_t) noexcept;
`

[20](#iterator-20)

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

*Effects*: Equivalent to: return i.*offset_* - V​::​size();

[ð](#iterator-itemdecl:17)

`friend constexpr difference_type operator-(default_sentinel_t, simd-iterator i) noexcept;
`

[21](#iterator-21)

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

*Effects*: Equivalent to: return V​::​size() - i.*offset_*;

### [29.10.7](#class) Class template basic_vec [[simd.class]](simd.class)

#### [29.10.7.1](#overview) Class template basic_vec overview [[simd.overview]](simd.overview)

[ð](#lib:basic_vec)

namespace std::simd {template<class T, class Abi> class basic_vec {public:using [value_type](#lib:basic_vec,value_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = T; using [mask_type](#lib:basic_vec,mask_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = basic_mask<sizeof(T), Abi>; using [abi_type](#lib:basic_vec,abi_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = Abi; using [iterator](#lib:basic_vec,iterator "29.10.7.1 Class template basic_­vec overview [simd.overview]") = *simd-iterator*<basic_vec>; using [const_iterator](#lib:basic_vec,const_iterator "29.10.7.1 Class template basic_­vec overview [simd.overview]") = *simd-iterator*<const basic_vec>; constexpr iterator [begin](#lib:basic_vec,begin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() noexcept { return {*this, 0}; }constexpr const_iterator [begin](#lib:basic_vec,begin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {*this, 0}; }constexpr const_iterator [cbegin](#lib:basic_vec,cbegin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {*this, 0}; }constexpr default_sentinel_t [end](#lib:basic_vec,end "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {}; }constexpr default_sentinel_t [cend](#lib:basic_vec,cend "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {}; }static constexpr integral_constant<*simd-size-type*, *simd-size-v*<T, Abi>> [size](#lib:basic_vec,size "29.10.7.1 Class template basic_­vec overview [simd.overview]") {}; constexpr basic_vec() noexcept = default; // [[simd.ctor]](#ctor "29.10.7.2 basic_­vec constructors"), basic_vec constructorstemplate<class U>constexpr explicit(*see below*) basic_vec(U&& value) noexcept; template<class U, class UAbi>constexpr explicit(*see below*) basic_vec(const basic_vec<U, UAbi>&) noexcept; template<class G>constexpr explicit basic_vec(G&& gen) noexcept; template<class R, class... Flags>constexpr basic_vec(R&& range, flags<Flags...> = {}); template<class R, class... Flags>constexpr basic_vec(R&& range, const mask_type& mask, flags<Flags...> = {}); template<[*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr explicit(*see below*) basic_vec(const V& reals, const V& imags = {}) noexcept; // [[simd.subscr]](#subscr "29.10.7.3 basic_­vec subscript operator"), basic_vec subscript operatorsconstexpr value_type operator[](*simd-size-type*) const; template<[*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>constexpr resize_t<I::size(), basic_vec> operator[](const I& indices) const; // [[simd.complex.access]](#complex.access "29.10.7.4 basic_­vec complex accessors"), basic_vec complex accessorsconstexpr auto real() const noexcept; constexpr auto imag() const noexcept; template<[*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr void real(const V& v) noexcept; template<[*simd-floating-point*](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr void imag(const V& v) noexcept; // [[simd.unary]](#unary "29.10.7.5 basic_­vec unary operators"), basic_vec unary operatorsconstexpr basic_vec& operator++() noexcept; constexpr basic_vec operator++(int) noexcept; constexpr basic_vec& operator--() noexcept; constexpr basic_vec operator--(int) noexcept; constexpr mask_type operator!() const noexcept; constexpr basic_vec operator~() const noexcept; constexpr basic_vec operator+() const noexcept; constexpr basic_vec operator-() const noexcept; // [[simd.binary]](#binary "29.10.8.1 basic_­vec binary operators"), basic_vec binary operatorsfriend constexpr basic_vec operator+(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator-(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator*(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator/(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator%(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator&(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator|(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator^(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator<<(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator>>(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator<<(const basic_vec&, *simd-size-type*) noexcept; friend constexpr basic_vec operator>>(const basic_vec&, *simd-size-type*) noexcept; // [[simd.cassign]](#cassign "29.10.8.2 basic_­vec compound assignment"), basic_vec compound assignmentfriend constexpr basic_vec& operator+=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator-=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator*=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator/=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator%=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator&=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator|=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator^=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator<<=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator>>=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator<<=(basic_vec&, *simd-size-type*) noexcept; friend constexpr basic_vec& operator>>=(basic_vec&, *simd-size-type*) noexcept; // [[simd.comparison]](#comparison "29.10.8.3 basic_­vec compare operators"), basic_vec compare operatorsfriend constexpr mask_type operator==(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator!=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator>=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator<=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator>(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator<(const basic_vec&, const basic_vec&) noexcept; // [[simd.cond]](#cond "29.10.8.4 basic_­vec exposition only conditional operators"), basic_vec exposition only conditional operatorsfriend constexpr basic_vec *simd-select-impl*( // *exposition only*const mask_type&, const basic_vec&, const basic_vec&) noexcept; }; template<class R, class... Ts> basic_vec(R&& r, Ts...) -> *see below*;}

[1](#overview-1)

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

Every specialization of basic_vec is a complete type[.](#overview-1.sentence-1)

The specialization of basic_vec<T, Abi> is

- [(1.1)](#overview-1.1)

enabled, if T is a vectorizable type, and there exists value N in the range [1, 64], such that Abi is *deduce-abi-t*<T, N>,

- [(1.2)](#overview-1.2)

otherwise, disabled, if T is not a vectorizable type,

- [(1.3)](#overview-1.3)

otherwise, it is implementation-defined if such a specialization is enabled[.](#overview-1.sentence-2)

If basic_vec<T, Abi> is disabled, then the specialization has a
deleted default constructor, deleted destructor, deleted copy constructor, and
deleted copy assignment[.](#overview-1.sentence-3)

In addition only the value_type, abi_type, andmask_type members are present[.](#overview-1.sentence-4)

If basic_vec<T, Abi> is enabled, then basic_vec<T, Abi> is
trivially copyable, default-initialization of an object of such a type
default-initializes all elements, and value-initialization value-initializes
all elements ([[dcl.init.general]](dcl.init.general "9.5.1 General"))[.](#overview-1.sentence-5)

[2](#overview-2)

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

*Recommended practice*: Implementations should support implicit conversions between specializations ofbasic_vec and appropriate implementation-defined types[.](#overview-2.sentence-1)

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

Appropriate types are non-standard vector types which are available in the
implementation[.](#overview-2.sentence-2)

â *end note*]

#### [29.10.7.2](#ctor) basic_vec constructors [[simd.ctor]](simd.ctor)

[ð](#lib:basic_vec,constructor)

`template<class U> constexpr explicit(see below) basic_vec(U&& value) noexcept;
`

[1](#ctor-1)

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

Let From denote the type remove_cvref_t<U>[.](#ctor-1.sentence-1)

[2](#ctor-2)

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

*Constraints*: value_type satisfies [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<U>[.](#ctor-2.sentence-1)

[3](#ctor-3)

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

*Effects*: Initializes each element to the value of the argument after conversion tovalue_type[.](#ctor-3.sentence-1)

[4](#ctor-4)

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

*Remarks*: The expression inside explicit evaluates to false if and only ifU satisfies [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<value_type>, and either

- [(4.1)](#ctor-4.1)

From is not an arithmetic type and does not satisfy [*constexpr-wrapper-like*](#concept:constexpr-wrapper-like "29.10.2 Exposition-only types, variables, and concepts [simd.expos]"),

- [(4.2)](#ctor-4.2)

From is an arithmetic type and the conversion from From to value_type is value-preserving ([[simd.general]](#general "29.10.1 General")), or

- [(4.3)](#ctor-4.3)

From satisfies [*constexpr-wrapper-like*](#concept:constexpr-wrapper-like "29.10.2 Exposition-only types, variables, and concepts [simd.expos]"), remove_const_t<decltype(From​::​value)> is an arithmetic type, and From​::​value is representable by value_type[.](#ctor-4.sentence-1)

[ð](#lib:basic_vec,constructor_)

`template<class U, class UAbi>
  constexpr explicit(see below) basic_vec(const basic_vec<U, UAbi>& x) noexcept;
`

[5](#ctor-5)

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

*Constraints*: *simd-size-v*<U, UAbi> == size() is true[.](#ctor-5.sentence-1)

[6](#ctor-6)

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

*Effects*: Initializes the ith element with static_cast<T>(x[i]) for
all i in the range of [0, size())[.](#ctor-6.sentence-1)

[7](#ctor-7)

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

*Remarks*: The expression inside explicit evaluates to true if either

- [(7.1)](#ctor-7.1)

the conversion from U to value_type is not value-preserving,
 or

- [(7.2)](#ctor-7.2)

both U and value_type are integral types and the integer
 conversion rank ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) of U is greater than the integer
 conversion rank of value_type, or

- [(7.3)](#ctor-7.3)

both U and value_type are floating-point types and the
 floating-point conversion rank ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) of U is greater than
 the floating-point conversion rank of value_type[.](#ctor-7.sentence-1)

[ð](#lib:basic_vec,constructor__)

`template<class G> constexpr explicit basic_vec(G&& gen);
`

[8](#ctor-8)

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

Let Fromi denote the typedecltype(gen(integral_constant<*simd-size-type*, i>()))[.](#ctor-8.sentence-1)

[9](#ctor-9)

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

*Constraints*: Fromi satisfies [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<value_type> for all i in
the range of [0, size())[.](#ctor-9.sentence-1)

In addition, for all i in the range of [0, size()), if Fromi is an arithmetic type, conversion from Fromi to value_type is value-preserving[.](#ctor-9.sentence-2)

[10](#ctor-10)

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

*Effects*: Initializes the ith element withstatic_cast<value_type>(gen(integral_constant<*simd-​size-​type*,
i>())) for all i in the range of [0, size())[.](#ctor-10.sentence-1)

[11](#ctor-11)

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

*Remarks*: gen is invoked exactly once for each i, in increasing order of i[.](#ctor-11.sentence-1)

[ð](#lib:basic_vec,constructor___)

`template<class R, class... Flags>
  constexpr basic_vec(R&& r, flags<Flags...> = {});
template<class R, class... Flags>
  constexpr basic_vec(R&& r, const mask_type& mask, flags<Flags...> = {});
`

[12](#ctor-12)

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

Let mask be mask_type(true) for the overload with nomask parameter[.](#ctor-12.sentence-1)

[13](#ctor-13)

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

*Constraints*: 

- [(13.1)](#ctor-13.1)

R models ranges​::​[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") and ranges​::​[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]"),

- [(13.2)](#ctor-13.2)

ranges​::​size(r) is a constant expression, and

- [(13.3)](#ctor-13.3)

ranges​::​size(r) is equal to size()[.](#ctor-13.sentence-1)

[14](#ctor-14)

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

*Mandates*: 

- [(14.1)](#ctor-14.1)

ranges​::​range_value_t<R> is a vectorizable type, and

- [(14.2)](#ctor-14.2)

if the template parameter pack Flags does not contain *convert-flag*, then the conversion from ranges​::​range_value_t<R> to value_type is value-preserving[.](#ctor-14.sentence-1)

[15](#ctor-15)

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

*Preconditions*: 

- [(15.1)](#ctor-15.1)

  If the template parameter pack Flags contains *aligned-flag*, ranges​::​data(r) points to
 storage aligned by alignment_v<basic_vec,
 ranges​::​range_value_t<R>>[.](#ctor-15.1.sentence-1)

- [(15.2)](#ctor-15.2)

  If the template parameter pack Flags contains *overaligned-flag*<N>, ranges​::​data(r) points to
 storage aligned by N[.](#ctor-15.2.sentence-1)

[16](#ctor-16)

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

*Effects*: Initializes the ith element with mask[i] ?static_cast<T>(​ranges​::​​data(r)[i]) : T() for all i in the
range of [0, size())[.](#ctor-16.sentence-1)

[ð](#ctor-itemdecl:5)

`template<class R, class... Ts>
  basic_vec(R&& r, Ts...) -> see below;
`

[17](#ctor-17)

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

*Constraints*: 

- [(17.1)](#ctor-17.1)

R models ranges​::​[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") and ranges​::​[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]"), and

- [(17.2)](#ctor-17.2)

ranges​::​size(r) is a constant expression[.](#ctor-17.sentence-1)

[18](#ctor-18)

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

*Remarks*: The deduced type is equivalent to vec<ranges​::​range_value_t<R>,
ranges​::​size(r)>[.](#ctor-18.sentence-1)

[ð](#lib:basic_vec,constructor____)

`template<[simd-floating-point](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr explicit(see below)
    basic_vec(const V& reals, const V& imags = {}) noexcept;
`

[19](#ctor-19)

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

*Constraints*: 

- [(19.1)](#ctor-19.1)

[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled, and

- [(19.2)](#ctor-19.2)

V​::​size() == size() is true[.](#ctor-19.sentence-1)

[20](#ctor-20)

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

*Effects*: Initializes the ith element with value_type(reals[i],
imags[i]) for all i in the range [0, size())[.](#ctor-20.sentence-1)

[21](#ctor-21)

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

*Remarks*: The expression inside explicit evaluates to false if and only
if the floating-point conversion rank of T​::​value_type is greater than
or equal to the floating-point conversion rank of V​::​value_type[.](#ctor-21.sentence-1)

#### [29.10.7.3](#subscr) basic_vec subscript operator [[simd.subscr]](simd.subscr)

[ð](#lib:operator%5b%5d,basic_vec)

`constexpr value_type operator[](simd-size-type i) const;
`

[1](#subscr-1)

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

*Preconditions*: i >= 0 && i < size() is true[.](#subscr-1.sentence-1)

[2](#subscr-2)

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

*Returns*: The value of the ith element[.](#subscr-2.sentence-1)

[3](#subscr-3)

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

*Throws*: Nothing[.](#subscr-3.sentence-1)

[ð](#lib:operator%5b%5d,basic_vec_)

`template<[simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>
  constexpr resize_t<I::size(), basic_vec> operator[](const I& indices) const;
`

[4](#subscr-4)

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

*Effects*: Equivalent to: return permute(*this, indices);

#### [29.10.7.4](#complex.access) basic_vec complex accessors [[simd.complex.access]](simd.complex.access)

[ð](#lib:real,basic_vec)

`constexpr auto real() const noexcept;
constexpr auto imag() const noexcept;
`

[1](#complex.access-1)

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

*Constraints*: [*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled[.](#complex.access-1.sentence-1)

[2](#complex.access-2)

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

*Returns*: An object of type rebind_t<typename T​::​value_type, basic_vec> where the ith element is initialized to the result of*cmplx-func*(operator[](i)) for all i in the range
[0, size()), where *cmplx-func* is the corresponding function
from [<complex>](complex.syn#header:%3ccomplex%3e "29.4.2 Header <complex> synopsis [complex.syn]")[.](#complex.access-2.sentence-1)

[ð](#lib:real,basic_vec_)

`template<[simd-floating-point](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr void real(const V& v) noexcept;
template<[simd-floating-point](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr void imag(const V& v) noexcept;
`

[3](#complex.access-3)

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

*Constraints*: 

- [(3.1)](#complex.access-3.1)

[*simd-complex*](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled,

- [(3.2)](#complex.access-3.2)

[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<typename V​::​value_type, typename T​::​value_type> is modeled, and

- [(3.3)](#complex.access-3.3)

V​::​size() == size() is true[.](#complex.access-3.sentence-1)

[4](#complex.access-4)

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

*Effects*: Replaces each element of the basic_vec object such that theith element is replaced with value_type(v[i],operator[](i).imag()) or value_type(operator[](i).real(), v[i]) for real and imag respectively, for all i in the range [0, size())[.](#complex.access-4.sentence-1)

#### [29.10.7.5](#unary) basic_vec unary operators [[simd.unary]](simd.unary)

[1](#unary-1)

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

Effects in [[simd.unary]](#unary "29.10.7.5 basic_­vec unary operators") are applied as unary element-wise operations[.](#unary-1.sentence-1)

[ð](#lib:operator++,basic_vec)

`constexpr basic_vec& operator++() noexcept;
`

[2](#unary-2)

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

*Constraints*: requires (value_type a) { ++a; } is true[.](#unary-2.sentence-1)

[3](#unary-3)

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

*Effects*: Increments every element by one[.](#unary-3.sentence-1)

[4](#unary-4)

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

*Returns*: *this[.](#unary-4.sentence-1)

[ð](#lib:operator++,basic_vec_)

`constexpr basic_vec operator++(int) noexcept;
`

[5](#unary-5)

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

*Constraints*: requires (value_type a) { a++; } is true[.](#unary-5.sentence-1)

[6](#unary-6)

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

*Effects*: Increments every element by one[.](#unary-6.sentence-1)

[7](#unary-7)

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

*Returns*: A copy of *this before incrementing[.](#unary-7.sentence-1)

[ð](#lib:operator--,basic_vec)

`constexpr basic_vec& operator--() noexcept;
`

[8](#unary-8)

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

*Constraints*: requires (value_type a) { --a; } is true[.](#unary-8.sentence-1)

[9](#unary-9)

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

*Effects*: Decrements every element by one[.](#unary-9.sentence-1)

[10](#unary-10)

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

*Returns*: *this[.](#unary-10.sentence-1)

[ð](#lib:operator--,basic_vec_)

`constexpr basic_vec operator--(int) noexcept;
`

[11](#unary-11)

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

*Constraints*: requires (value_type a) { a--; } is true[.](#unary-11.sentence-1)

[12](#unary-12)

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

*Effects*: Decrements every element by one[.](#unary-12.sentence-1)

[13](#unary-13)

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

*Returns*: A copy of *this before decrementing[.](#unary-13.sentence-1)

[ð](#lib:operator,operator,basic_vec)

`constexpr mask_type operator!() const noexcept;
`

[14](#unary-14)

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

*Constraints*: requires (const value_type a) { !a; } is true[.](#unary-14.sentence-1)

[15](#unary-15)

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

*Returns*: A basic_mask object with the ith element set to!operator[](i) for all i in the range of [0, size())[.](#unary-15.sentence-1)

[ð](#lib:operator~,basic_vec)

`constexpr basic_vec operator~() const noexcept;
`

[16](#unary-16)

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

*Constraints*: requires (const value_type a) { ~a; } is true[.](#unary-16.sentence-1)

[17](#unary-17)

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

*Returns*: A basic_vec object with the ith element set to~operator[](i) for all i in the range of [0, size())[.](#unary-17.sentence-1)

[ð](#lib:operator+,basic_vec)

`constexpr basic_vec operator+() const noexcept;
`

[18](#unary-18)

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

*Constraints*: requires (const value_type a) { +a; } is true[.](#unary-18.sentence-1)

[19](#unary-19)

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

*Returns*: *this[.](#unary-19.sentence-1)

[ð](#lib:operator-,basic_vec)

`constexpr basic_vec operator-() const noexcept;
`

[20](#unary-20)

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

*Constraints*: requires (const value_type a) { -a; } is true[.](#unary-20.sentence-1)

[21](#unary-21)

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

*Returns*: A basic_vec object where the ith element is initialized to-operator[](i) for all i in the range of [0, size())[.](#unary-21.sentence-1)

### [29.10.8](#nonmembers) basic_vec non-member operations [[simd.nonmembers]](simd.nonmembers)

#### [29.10.8.1](#binary) basic_vec binary operators [[simd.binary]](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](#binary-1)

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

Let *op* be the operator[.](#binary-1.sentence-1)

[2](#binary-2)

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

*Constraints*: requires (value_type a, value_type b) { a *op* b; } istrue[.](#binary-2.sentence-1)

[3](#binary-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[.](#binary-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](#binary-4)

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

Let *op* be the operator[.](#binary-4.sentence-1)

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

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

#### [29.10.8.2](#cassign) basic_vec compound assignment [[simd.cassign]](simd.cassign)

[ð](#lib:operator+=,basic_vec)

`friend constexpr basic_vec& operator+=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator-=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator*=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator/=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator%=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator&=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator|=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator^=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator<<=(basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr basic_vec& operator>>=(basic_vec& lhs, const basic_vec& rhs) noexcept;
`

[1](#cassign-1)

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

Let *op* be the operator[.](#cassign-1.sentence-1)

[2](#cassign-2)

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

*Constraints*: requires (value_type a, value_type b) { a *op* b; } istrue[.](#cassign-2.sentence-1)

[3](#cassign-3)

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

*Effects*: These operators apply the indicated operator to lhs and rhs as
an element-wise operation[.](#cassign-3.sentence-1)

[4](#cassign-4)

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

*Returns*: lhs[.](#cassign-4.sentence-1)

[ð](#lib:operator%3c%3c=,basic_vec_)

`friend constexpr basic_vec& operator<<=(basic_vec& lhs, simd-size-type n) noexcept;
friend constexpr basic_vec& operator>>=(basic_vec& lhs, simd-size-type n) noexcept;
`

[5](#cassign-5)

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

Let *op* be the operator[.](#cassign-5.sentence-1)

[6](#cassign-6)

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

*Constraints*: requires (value_type a, *simd-size-type* b) { a*op* b; } is true[.](#cassign-6.sentence-1)

[7](#cassign-7)

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

*Effects*: Equivalent to: return operator *op* (lhs, basic_vec(n));

#### [29.10.8.3](#comparison) basic_vec compare operators [[simd.comparison]](simd.comparison)

[ð](#lib:operator==,basic_vec)

`friend constexpr mask_type operator==(const basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr mask_type operator!=(const basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr mask_type operator>=(const basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr mask_type operator<=(const basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr mask_type operator>(const basic_vec& lhs, const basic_vec& rhs) noexcept;
friend constexpr mask_type operator<(const basic_vec& lhs, const basic_vec& rhs) noexcept;
`

[1](#comparison-1)

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

Let *op* be the operator[.](#comparison-1.sentence-1)

[2](#comparison-2)

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

*Constraints*: requires (value_type a, value_type b) { a *op* b; } istrue[.](#comparison-2.sentence-1)

[3](#comparison-3)

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

*Returns*: A basic_mask object initialized with the results of applying*op* to lhs and rhs as a binary element-wise
operation[.](#comparison-3.sentence-1)

#### [29.10.8.4](#cond) basic_vec exposition only conditional operators [[simd.cond]](simd.cond)

[ð](#cond-itemdecl:1)

`friend constexpr basic_vec
simd-select-impl(const mask_type& mask, const basic_vec& a, const basic_vec& b) noexcept;
`

[1](#cond-1)

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

*Returns*: A basic_vec object where the ith element equalsmask[i] ? a[i] : b[i] for all i in the range of
[0, size())[.](#cond-1.sentence-1)

#### [29.10.8.5](#reductions) basic_vec reductions [[simd.reductions]](simd.reductions)

[ð](#lib:reduce,simd)

`template<class T, class Abi, class BinaryOperation = plus<>>
  constexpr T reduce(const basic_vec<T, Abi>& x, BinaryOperation binary_op = {});
`

[1](#reductions-1)

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

*Constraints*: BinaryOperation models[*reduction-binary-operation*](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]")<T>[.](#reductions-1.sentence-1)

[2](#reductions-2)

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

*Preconditions*: binary_op does not modify x[.](#reductions-2.sentence-1)

[3](#reductions-3)

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

*Returns*: *GENERALIZED_SUM*(binary_op, vec<T, 1>(x[0]), …,
vec<T, 1>(x[x.size() - 1]))[​0] ([[numerics.defns]](numerics.defns "26.10.2 Definitions"))[.](#reductions-3.sentence-1)

[4](#reductions-4)

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

*Throws*: Any exception thrown from binary_op[.](#reductions-4.sentence-1)

[ð](#lib:reduce,simd_)

`template<class T, class Abi, class BinaryOperation = plus<>>
  constexpr T reduce(
    const basic_vec<T, Abi>& x, const typename basic_vec<T, Abi>::mask_type& mask,
    BinaryOperation binary_op = {}, type_identity_t<T> identity_element = see below);
`

[5](#reductions-5)

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

*Constraints*: 

- [(5.1)](#reductions-5.1)

  BinaryOperation models [*reduction-binary-operation*](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]")<T>[.](#reductions-5.1.sentence-1)

- [(5.2)](#reductions-5.2)

  An argument for identity_element is provided for the invocation,
 unless BinaryOperation is one of plus<>, multiplies<>, bit_and<>, bit_or<>, or bit_xor<>[.](#reductions-5.2.sentence-1)

[6](#reductions-6)

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

*Preconditions*: 

- [(6.1)](#reductions-6.1)

  binary_op does not modify x[.](#reductions-6.1.sentence-1)

- [(6.2)](#reductions-6.2)

  For all finite values y representable by T, the results of y == binary_op(vec<T, 1>(identity_element), vec<T, 1>(y))[0] and y == binary_op(vec<T, 1>(y), vec<T, 1>(identity_element))[0] are true[.](#reductions-6.2.sentence-1)

[7](#reductions-7)

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

*Returns*: If none_of(mask) is true, returns identity_element[.](#reductions-7.sentence-1)

Otherwise, returns *GENERALIZED_SUM*(binary_op, vec<T,1>(x[k0]), …, vec<T, 1>(x[kn]))[0] where k0,â¦,kn are
the selected indices of mask[.](#reductions-7.sentence-2)

[8](#reductions-8)

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

*Throws*: Any exception thrown from binary_op[.](#reductions-8.sentence-1)

[9](#reductions-9)

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

*Remarks*: The default argument for identity_element is equal to

- [(9.1)](#reductions-9.1)

T() if BinaryOperation is plus<>,

- [(9.2)](#reductions-9.2)

T(1) if BinaryOperation is multiplies<>,

- [(9.3)](#reductions-9.3)

T(~T()) if BinaryOperation is bit_and<>,

- [(9.4)](#reductions-9.4)

T() if BinaryOperation is bit_or<>, or

- [(9.5)](#reductions-9.5)

T() if BinaryOperation is bit_xor<>[.](#reductions-9.sentence-1)

[ð](#lib:reduce_min,simd)

`template<class T, class Abi> constexpr T reduce_min(const basic_vec<T, Abi>& x) noexcept;
`

[10](#reductions-10)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#reductions-10.sentence-1)

[11](#reductions-11)

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

*Returns*: The value of an element x[j] for which x[i] < x[j] isfalse for all i in the range of [0, basic_vec<T, Abi>​::​size())[.](#reductions-11.sentence-1)

[ð](#lib:reduce_min,simd_)

`template<class T, class Abi>
  constexpr T reduce_min(
    const basic_vec<T, Abi>&, const typename basic_vec<T, Abi>::mask_type&) noexcept;
`

[12](#reductions-12)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#reductions-12.sentence-1)

[13](#reductions-13)

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

*Returns*: If none_of(mask) is true, returnsnumeric_limits<T>​::​max()[.](#reductions-13.sentence-1)

Otherwise, returns the value of a selected element x[j] for whichx[i] < x[j] is false for all selected indices i ofmask[.](#reductions-13.sentence-2)

[ð](#lib:reduce_max,simd)

`template<class T, class Abi> constexpr T reduce_max(const basic_vec<T, Abi>& x) noexcept;
`

[14](#reductions-14)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#reductions-14.sentence-1)

[15](#reductions-15)

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

*Returns*: The value of an element x[j] for which x[j] < x[i] isfalse for all i in the range of [0, basic_vec<T, Abi>​::​size())[.](#reductions-15.sentence-1)

[ð](#lib:reduce_max,simd_)

`template<class T, class Abi>
  constexpr T reduce_max(
    const basic_vec<T, Abi>&, const typename basic_vec<T, Abi>::mask_type&) noexcept;
`

[16](#reductions-16)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#reductions-16.sentence-1)

[17](#reductions-17)

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

*Returns*: If none_of(mask) is true, returnsnumeric_limits<V​::​value_type>​::​lowest()[.](#reductions-17.sentence-1)

Otherwise, returns the value of a selected element x[j] for whichx[j] < x[i] is false for all selected indices i ofmask[.](#reductions-17.sentence-2)

#### [29.10.8.6](#loadstore) basic_vec load and store functions [[simd.loadstore]](simd.loadstore)

[ð](#lib:unchecked_load,simd)

`template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V unchecked_load(R&& r, flags<Flags...> f = {});
template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V unchecked_load(R&& r, const typename V::mask_type& mask, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  constexpr V unchecked_load(I first, iter_difference_t<I> n, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  constexpr V unchecked_load(I first, iter_difference_t<I> n, const typename V::mask_type& mask,
                             flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  constexpr V unchecked_load(I first, S last, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  constexpr V unchecked_load(I first, S last, const typename V::mask_type& mask,
                             flags<Flags...> f = {});
`

[1](#loadstore-1)

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

Let

- [(1.1)](#loadstore-1.1)

mask be V​::​mask_type(true) for the overloads with no mask parameter;

- [(1.2)](#loadstore-1.2)

R be span<const iter_value_t<I>> for the overloads with no
 template parameter R;

- [(1.3)](#loadstore-1.3)

r be R(first, n) for the overloads with an n parameter and R(first, last) for the overloads with a last parameter[.](#loadstore-1.sentence-1)

[2](#loadstore-2)

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

*Mandates*: If ranges​::​size(r) is a constant expression thenranges​::​size(r)  â¥  V​::​size()[.](#loadstore-2.sentence-1)

[3](#loadstore-3)

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

*Preconditions*: 

- [(3.1)](#loadstore-3.1)

  [first, first + n) is a valid range for the overloads with an n parameter[.](#loadstore-3.1.sentence-1)

- [(3.2)](#loadstore-3.2)

  [first, last) is a valid range for the overloads with a last parameter[.](#loadstore-3.2.sentence-1)

- [(3.3)](#loadstore-3.3)

  ranges​::​size(r)  â¥  V​::​size()

[4](#loadstore-4)

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

*Effects*: Equivalent to: return partial_load<V>(r, mask, f);

[5](#loadstore-5)

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

*Remarks*: The default argument for template parameter V isbasic_vec<ranges​::​range_value_t<R>>[.](#loadstore-5.sentence-1)

[ð](#lib:partial_load,simd)

`template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V partial_load(R&& r, flags<Flags...> f = {});
template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V partial_load(R&& r, const typename V::mask_type& mask, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  constexpr V partial_load(I first, iter_difference_t<I> n, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  constexpr V partial_load(I first, iter_difference_t<I> n, const typename V::mask_type& mask,
                           flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  constexpr V partial_load(I first, S last, flags<Flags...> f = {});
template<class V = see below, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  constexpr V partial_load(I first, S last, const typename V::mask_type& mask,
                           flags<Flags...> f = {});
`

[6](#loadstore-6)

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

Let

- [(6.1)](#loadstore-6.1)

mask be V​::​mask_type(true) for the overloads with no mask parameter;

- [(6.2)](#loadstore-6.2)

R be span<const iter_value_t<I>> for the overloads with no
 template parameter R;

- [(6.3)](#loadstore-6.3)

r be R(first, n) for the overloads with an n parameter and R(first, last) for the overloads with a last parameter[.](#loadstore-6.sentence-1)

[7](#loadstore-7)

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

*Mandates*: 

- [(7.1)](#loadstore-7.1)

ranges​::​range_value_t<R> is a vectorizable type,

- [(7.2)](#loadstore-7.2)

same_as<remove_cvref_t<V>, V> is true,

- [(7.3)](#loadstore-7.3)

V is an enabled specialization of basic_vec, and

- [(7.4)](#loadstore-7.4)

if the template parameter pack Flags does not contain *convert-flag*, then the conversion from ranges​::​range_value_t<R> to V​::​value_type is
 value-preserving[.](#loadstore-7.sentence-1)

[8](#loadstore-8)

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

*Preconditions*: 

- [(8.1)](#loadstore-8.1)

  [first, first + n) is a valid range for the overloads with an n parameter[.](#loadstore-8.1.sentence-1)

- [(8.2)](#loadstore-8.2)

  [first, last) is a valid range for the overloads with a last parameter[.](#loadstore-8.2.sentence-1)

- [(8.3)](#loadstore-8.3)

  If the template parameter pack Flags contains *aligned-flag*, ranges​::​data(r) points to storage
 aligned by alignment_v<V, ranges​::​range_value_t<R>>[.](#loadstore-8.3.sentence-1)

- [(8.4)](#loadstore-8.4)

  If the template parameter pack Flags contains *overaligned-flag*<N>, ranges​::​data(r) points to
 storage aligned by N[.](#loadstore-8.4.sentence-1)

[9](#loadstore-9)

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

*Effects*: Initializes the ith element with  

mask[i] && i < ranges​::​size(r) ?static_cast<T>(​ranges​::​data(r)[i]) : T() for all i in the range of
[0, V​::​size())[.](#loadstore-9.sentence-2)

[10](#loadstore-10)

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

*Remarks*: The default argument for template parameter V isbasic_vec<ranges​::​range_value_t<R>>[.](#loadstore-10.sentence-1)

[ð](#lib:unchecked_store,simd)

`template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, R&& r, flags<Flags...> f = {});
template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, R&& r,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n,
                                 flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, S last,
                                 flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void unchecked_store(const basic_vec<T, Abi>& v, I first, S last,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
`

[11](#loadstore-11)

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

Let

- [(11.1)](#loadstore-11.1)

mask be basic_vec<T, Abi>​::​mask_type(true) for the
 overloads with no mask parameter;

- [(11.2)](#loadstore-11.2)

R be span<iter_value_t<I>> for the overloads with no
 template parameter R;

- [(11.3)](#loadstore-11.3)

r be R(first, n) for the overloads with an n parameter and R(first, last) for the overloads with a last parameter[.](#loadstore-11.sentence-1)

[12](#loadstore-12)

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

*Mandates*: If ranges​::​size(r) is a constant expression thenranges​::​size(r)  â¥  *simd-size-v*<T, Abi>[.](#loadstore-12.sentence-1)

[13](#loadstore-13)

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

*Preconditions*: 

- [(13.1)](#loadstore-13.1)

  [first, first + n) is a valid range for the overloads with an n parameter[.](#loadstore-13.1.sentence-1)

- [(13.2)](#loadstore-13.2)

  [first, last) is a valid range for the overloads with a last parameter[.](#loadstore-13.2.sentence-1)

- [(13.3)](#loadstore-13.3)

  ranges​::​size(r)  â¥  *simd-size-v*<T, Abi>

[14](#loadstore-14)

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

*Effects*: Equivalent to: partial_store(v, r, mask, f)[.](#loadstore-14.sentence-1)

[ð](#lib:partial_store,simd)

`template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, R&& r, flags<Flags...> f = {});
template<class T, class Abi, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> && [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<ranges::iterator_t<R>, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, R&& r,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n,
                               flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, I first, iter_difference_t<I> n,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, I first, S last,
                               flags<Flags...> f = {});
template<class T, class Abi, [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<I> S, class... Flags>
  requires [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")<I, T>
  constexpr void partial_store(const basic_vec<T, Abi>& v, I first, S last,
    const typename basic_vec<T, Abi>::mask_type& mask, flags<Flags...> f = {});
`

[15](#loadstore-15)

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

Let

- [(15.1)](#loadstore-15.1)

mask be basic_vec<T, Abi>​::​mask_type(true) for the
 overloads with no mask parameter;

- [(15.2)](#loadstore-15.2)

R be span<iter_value_t<I>> for the overloads with no
 template parameter R;

- [(15.3)](#loadstore-15.3)

r be R(first, n) for the overloads with an n parameter and R(first, last) for the overloads with a last parameter[.](#loadstore-15.sentence-1)

[16](#loadstore-16)

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

*Mandates*: 

- [(16.1)](#loadstore-16.1)

ranges​::​range_value_t<R> is a vectorizable type, and

- [(16.2)](#loadstore-16.2)

if the template parameter pack Flags does not contain *convert-flag*, then the conversion from T to ranges​::​range_value_t<R> is value-preserving[.](#loadstore-16.sentence-1)

[17](#loadstore-17)

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

*Preconditions*: 

- [(17.1)](#loadstore-17.1)

  [first, first + n) is a valid range for the overloads with an n parameter[.](#loadstore-17.1.sentence-1)

- [(17.2)](#loadstore-17.2)

  [first, last) is a valid range for the overloads with a last parameter[.](#loadstore-17.2.sentence-1)

- [(17.3)](#loadstore-17.3)

  If the template parameter pack Flags contains *aligned-flag*, ranges​::​data(r) points to storage
 aligned by alignment_v<basic_vec<T, Abi>,
 ranges​::​range_value_t<R>>[.](#loadstore-17.3.sentence-1)

- [(17.4)](#loadstore-17.4)

  If the template parameter pack Flags contains *overaligned-flag*<N>, ranges​::​data(r) points to
 storage aligned by N[.](#loadstore-17.4.sentence-1)

[18](#loadstore-18)

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

*Effects*: For all i in the range of [0, basic_vec<T, Abi>​::​size()), ifmask[i] && i < ranges​::​​size(r) is true, evaluatesranges​::​data(r)[i] = v[i][.](#loadstore-18.sentence-1)

#### [29.10.8.7](#permute.static) vec static permute [[simd.permute.static]](simd.permute.static)

[ð](#lib:permute,simd)

`template<simd-size-type N = see below, [simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, class IdxMap>
  constexpr resize_t<N, V> permute(const V& v, IdxMap&& idxmap);
template<simd-size-type N = see below, [simd-mask-type](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M, class IdxMap>
  constexpr resize_t<N, M> permute(const M& v, IdxMap&& idxmap);
`

[1](#permute.static-1)

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

Let:

- [(1.1)](#permute.static-1.1)

*gen-fn*(i) be idxmap(i, V​::​size()) if that expression is well-formed, and idxmap(i) otherwise.

- [(1.2)](#permute.static-1.2)

*perm-fn* be the following exposition-only function template:template<*simd-size-type* I>typename V::value_type *perm-fn*() {constexpr auto src_index = *gen-fn*(I); if constexpr (src_index == zero_element) {return typename V::value_type(); } else if constexpr (src_index == uninit_element) {return *unspecified-value*; } else {return v[src_index]; }}

[2](#permute.static-2)

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

*Constraints*: [integral](concepts.arithmetic#concept:integral "18.4.7 Arithmetic concepts [concepts.arithmetic]")<invoke_result_t<IdxMap&, *simd-size-type*>> ||[integral](concepts.arithmetic#concept:integral "18.4.7 Arithmetic concepts [concepts.arithmetic]")<invoke_result_t<IdxMap&, *simd-size-type*,*simd-size-type*>> is true[.](#permute.static-2.sentence-1)

[3](#permute.static-3)

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

*Mandates*: *gen-fn*(i) is a constant expression whose value iszero_element, uninit_element, or in the range
[0, V​::​size()), for all i in the range [0, N)[.](#permute.static-3.sentence-1)

[4](#permute.static-4)

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

*Returns*: A data-parallel object where theith element is initialized to the result of*perm-fn*<i>() for all i in the range [0, N)[.](#permute.static-4.sentence-1)

[5](#permute.static-5)

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

*Remarks*: The default argument for template parameter N is V​::​size()[.](#permute.static-5.sentence-1)

#### [29.10.8.8](#permute.dynamic) vec dynamic permute [[simd.permute.dynamic]](simd.permute.dynamic)

[ð](#lib:permute,simd_)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>
  constexpr resize_t<I::size(), V> permute(const V& v, const I& indices);
template<[simd-mask-type](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>
  constexpr resize_t<I::size(), M> permute(const M& v, const I& indices);
`

[1](#permute.dynamic-1)

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

*Preconditions*: All values in indices are in the range [0, V​::​size())[.](#permute.dynamic-1.sentence-1)

[2](#permute.dynamic-2)

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

*Returns*: A data-parallel object where the ith element is initialized to the result of v[indices[i]] for all i in
the range [0, I​::​size())[.](#permute.dynamic-2.sentence-1)

#### [29.10.8.9](#permute.mask) vec mask permute [[simd.permute.mask]](simd.permute.mask)

[ð](#lib:compress,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr V compress(const V& v, const typename V::mask_type& selector);
template<[simd-mask-type](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>
  constexpr M compress(const M& v, const type_identity_t<M>& selector);
`

[1](#permute.mask-1)

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

Let:

- [(1.1)](#permute.mask-1.1)

  *bit-index*(i) be a function which returns the index
of the ith element of selector that is true[.](#permute.mask-1.1.sentence-1)

- [(1.2)](#permute.mask-1.2)

  *select-value*(i) be a function which returnsv[*bit-index*(i)] for i in the range
[0, reduce_count(selector)) and a valid but unspecified value
otherwise[.](#permute.mask-1.2.sentence-1)
  [*Note [1](#permute.mask-note-1)*:
  Different calls to *select-value* can return different unspecified values[.](#permute.mask-1.2.sentence-2)
 â *end note*]

[2](#permute.mask-2)

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

*Returns*: A data-parallel object where the ith element is initialized to the result of *select-value*(i) for all i in the range [0, V​::​size())[.](#permute.mask-2.sentence-1)

[ð](#lib:compress,simd_)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr V compress(const V& v, const typename V::mask_type& selector,
                       const typename V::value_type& fill_value);
template<[simd-mask-type](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>
  constexpr M compress(const M& v, const type_identity_t<M>& selector,
                       const typename M::value_type& fill_value);
`

[3](#permute.mask-3)

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

Let:

- [(3.1)](#permute.mask-3.1)

  *bit-index*(i) be a function which returns the index
of the ith element of selector that is true[.](#permute.mask-3.1.sentence-1)

- [(3.2)](#permute.mask-3.2)

  *select-value*(i) be a function which returnsv[*bit-index*(i)] for i in the range
[0, reduce_count(selector)) and fill_value otherwise[.](#permute.mask-3.2.sentence-1)

[4](#permute.mask-4)

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

*Returns*: A data-parallel object where the ith element is initialized to the result of *select-value*(i) for all i in the range [0, V​::​size())[.](#permute.mask-4.sentence-1)

[ð](#lib:expand,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr V expand(const V& v, const typename V::mask_type& selector, const V& original = {});
template<[simd-mask-type](#concept:simd-mask-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") M>
  constexpr M expand(const M& v, const type_identity_t<M>& selector, const M& original = {});
`

[5](#permute.mask-5)

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

Let:

- [(5.1)](#permute.mask-5.1)

  *set-indices* be a list of the index positions of true elements in selector[.](#permute.mask-5.1.sentence-1)

- [(5.2)](#permute.mask-5.2)

  *bit-lookup*(b) be a function which returns the index
where b appears in *set-indices*[.](#permute.mask-5.2.sentence-1)

- [(5.3)](#permute.mask-5.3)

  *select-value*(i) be a function which returnsv[*bit-lookup*(i)] if selector[i] istrue, otherwise returns original[i][.](#permute.mask-5.3.sentence-1)

[6](#permute.mask-6)

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

*Returns*: A data-parallel object where the ith element is initialized to the result of *select-value*(i) for all i in the range [0, V​::​size())[.](#permute.mask-6.sentence-1)

#### [29.10.8.10](#permute.memory) simd memory permute [[simd.permute.memory]](simd.permute.memory)

[ð](#lib:unchecked_gather_from,simd)

`template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V unchecked_gather_from(R&& in, const I& indices, flags<Flags...> f = {});
template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V unchecked_gather_from(R&& in, const typename I::mask_type& mask,
                                    const I& indices, flags<Flags...> f = {});
`

[1](#permute.memory-1)

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

Let mask be typename I​::​mask_type(true) for the overload with
no mask parameter[.](#permute.memory-1.sentence-1)

[2](#permute.memory-2)

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

*Preconditions*: All values in select(mask, indices, typename I​::​value_type()) are in
the range [0, ranges​::​size(in))[.](#permute.memory-2.sentence-1)

[3](#permute.memory-3)

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

*Effects*: Equivalent to: return partial_gather_from<V>(in, mask, indices, f);

[4](#permute.memory-4)

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

*Remarks*: The default argument for template parameter V isvec<ranges​::​range_value_t<R>, I​::​​size()>[.](#permute.memory-4.sentence-1)

[ð](#lib:partial_gather_from,simd)

`template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V partial_gather_from(R&& in, const I& indices, flags<Flags...> f = {});
template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr V partial_gather_from(R&& in, const typename I::mask_type& mask,
                                  const I& indices, flags<Flags...> f = {});
`

[5](#permute.memory-5)

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

Let:

- [(5.1)](#permute.memory-5.1)

mask be typename I​::​mask_type(true) for the overload with no mask parameter;

- [(5.2)](#permute.memory-5.2)

T be typename V​::​value_type[.](#permute.memory-5.sentence-1)

[6](#permute.memory-6)

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

*Mandates*: 

- [(6.1)](#permute.memory-6.1)

ranges​::​range_value_t<R> is a vectorizable type,

- [(6.2)](#permute.memory-6.2)

same_as<remove_cvref_t<V>, V> is true,

- [(6.3)](#permute.memory-6.3)

V is an enabled specialization of basic_vec,

- [(6.4)](#permute.memory-6.4)

V​::​size() == I​::​size() is true, and

- [(6.5)](#permute.memory-6.5)

if the template parameter pack Flags does not contain*convert-flag*, then the conversion fromranges​::​range_value_t<R> to T is value-preserving[.](#permute.memory-6.sentence-1)

[7](#permute.memory-7)

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

*Preconditions*: 

- [(7.1)](#permute.memory-7.1)

  If the template parameter pack Flags contains*aligned-flag*, ranges​::​data(in) points to storage aligned byalignment_v<V, ranges​::​range_value_t<R>>[.](#permute.memory-7.1.sentence-1)

- [(7.2)](#permute.memory-7.2)

  If the template parameter pack Flags contains*overaligned-flag*<N>, ranges​::​data(in) points to
storage aligned by N[.](#permute.memory-7.2.sentence-1)

[8](#permute.memory-8)

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

*Returns*: A basic_vec object where the ith element is initialized to the result ofmask[i] && indices[i] < ranges::size(in) ? static_cast<T>(ranges::data(in)[indices[i]]) : T() for all i in the range [0, I​::​size())[.](#permute.memory-8.sentence-1)

[9](#permute.memory-9)

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

*Remarks*: The default argument for template parameter V isvec<ranges​::​range_value_t<R>, I​::​​size()>[.](#permute.memory-9.sentence-1)

[ð](#lib:unchecked_scatter_to,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr void unchecked_scatter_to(const V& v, R&& out, const I& indices,
                                      flags<Flags...> f = {});
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr void unchecked_scatter_to(const V& v, R&& out, const typename I::mask_type& mask,
                                      const I& indices, flags<Flags...> f = {});
`

[10](#permute.memory-10)

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

Let mask be typename I​::​mask_type(true) for the overload with
no mask parameter[.](#permute.memory-10.sentence-1)

[11](#permute.memory-11)

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

*Preconditions*: All values in select(mask, indices, typename I​::​value_type()) are in
the range [0, ranges​::​size(out))[.](#permute.memory-11.sentence-1)

[12](#permute.memory-12)

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

*Effects*: Equivalent to: partial_scatter_to(v, out, mask, indices, f);

[ð](#lib:partial_scatter_to,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr void
  partial_scatter_to(const V& v, R&& out, const I& indices, flags<Flags...> f = {});
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") R, [simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I, class... Flags>
  requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>
  constexpr void partial_scatter_to(const V& v, R&& out, const typename I::mask_type& mask,
                                    const I& indices, flags<Flags...> f = {});
`

[13](#permute.memory-13)

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

Let mask be typename I​::​mask_type(true) for the overload with
no mask parameter[.](#permute.memory-13.sentence-1)

[14](#permute.memory-14)

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

*Constraints*: V​::​size() == I​::​size() is true[.](#permute.memory-14.sentence-1)

[15](#permute.memory-15)

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

*Mandates*: 

- [(15.1)](#permute.memory-15.1)

ranges​::​range_value_t<R> is a vectorizable type, and

- [(15.2)](#permute.memory-15.2)

if the template parameter pack Flags does not contain *convert-flag*,
then the conversion from typename V​::​value_type to ranges​::​range_value_t<R> is value-preserving[.](#permute.memory-15.sentence-1)

[16](#permute.memory-16)

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

*Preconditions*: 

- [(16.1)](#permute.memory-16.1)

  For all selected indices i the values indices[i] are unique[.](#permute.memory-16.1.sentence-1)

- [(16.2)](#permute.memory-16.2)

  If the template parameter pack Flags contains *aligned-flag*,ranges​::​data(out) points to storage aligned byalignment_v<V, ranges​::​range_value_t<R>>[.](#permute.memory-16.2.sentence-1)

- [(16.3)](#permute.memory-16.3)

  If the template parameter pack Flags contains*overaligned-flag*<N>,ranges​::​data(out) points to storage aligned by N[.](#permute.memory-16.3.sentence-1)

[17](#permute.memory-17)

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

*Effects*: For all i in the range [0, I​::​size()), if mask[i] &&(indices[i] < ranges​::​size(out)) is true, evaluatesranges​::​data(out)[indices[i]] = v[i][.](#permute.memory-17.sentence-1)

#### [29.10.8.11](#creation) basic_vec and basic_mask creation [[simd.creation]](simd.creation)

[ð](#lib:chunk,simd)

`template<class T, class Abi>
  constexpr auto chunk(const basic_vec<typename T::value_type, Abi>& x) noexcept;
template<class T, class Abi>
  constexpr auto chunk(const basic_mask<mask-element-size<T>, Abi>& x) noexcept;
`

[1](#creation-1)

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

*Constraints*: 

- [(1.1)](#creation-1.1)

  For the first overload, T is an enabled specialization of basic_vec[.](#creation-1.1.sentence-1)
  If basic_vec<​typename T​::​​value_type, Abi>​::​size() % T​::​size() is not 0, then resize_t<basic_vec<​typename T​::​​value_type, Abi>​::​size()% T​::​size(), T> is valid and denotes a type[.](#creation-1.1.sentence-2)

- [(1.2)](#creation-1.2)

  For the second overload, T is an enabled specialization of basic_mask[.](#creation-1.2.sentence-1)
  If basic_mask<*mask-element-size*<T>, Abi>​::​size() % T​::​size() is not 0, then resize_t<​basic_mask<​*mask-element-size*<T>,
 Abi>​::​size() % T​::​size(), T> is valid and denotes a type[.](#creation-1.2.sentence-2)

[2](#creation-2)

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

Let N be x.size() / T​::​size()[.](#creation-2.sentence-1)

[3](#creation-3)

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

*Returns*: 

- [(3.1)](#creation-3.1)

  If x.size() % T​::​size() == 0 is true, an array<T, N> with the ith basic_vec or basic_mask element of the jth array element initialized to the value
 of the element in x with index i + j * T​::​size()[.](#creation-3.1.sentence-1)

- [(3.2)](#creation-3.2)

  Otherwise, a tuple of N objects of type T and one object
 of type resize_t<x.size() % T​::​size(), T>[.](#creation-3.2.sentence-1)
  The ith basic_vec or basic_mask element of
 the jth tuple element of type T is initialized to
 the value of the element in x with index i + j * T​::​size()[.](#creation-3.2.sentence-2)
  The ith basic_vec or basic_mask element of
 the Nth tuple element is initialized to the value of the
 element in x with index i + N * T​::​size()[.](#creation-3.2.sentence-3)

[ð](#lib:chunk,simd_)

`template<simd-size-type N, class T, class Abi>
  constexpr auto chunk(const basic_vec<T, Abi>& x) noexcept;
`

[4](#creation-4)

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

*Effects*: Equivalent to: return chunk<resize_t<N, basic_vec<T, Abi>>>(x);

[ð](#lib:chunk,simd__)

`template<simd-size-type N, size_t Bytes, class Abi>
  constexpr auto chunk(const basic_mask<Bytes, Abi>& x) noexcept;
`

[5](#creation-5)

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

*Effects*: Equivalent to: return chunk<resize_t<N, basic_mask<Bytes, Abi>>>(x);

[ð](#lib:cat,simd)

`template<class T, class... Abis>
  constexpr vec<T, (basic_vec<T, Abis>::size() + ...)>
    cat(const basic_vec<T, Abis>&... xs) noexcept;
template<size_t Bytes, class... Abis>
  constexpr basic_mask<Bytes, deduce-abi-t<integer-from<Bytes>,
                            (basic_mask<Bytes, Abis>::size() + ...)>>
    cat(const basic_mask<Bytes, Abis>&... xs) noexcept;
`

[6](#creation-6)

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

*Constraints*: 

- [(6.1)](#creation-6.1)

  For the first overload vec<T, (basic_vec<T, Abis>​::​size() + ...)> is enabled[.](#creation-6.1.sentence-1)

- [(6.2)](#creation-6.2)

  For the second overload basic_mask<Bytes, *deduce-abi-t*<*integer-from*<Bytes>, (basic_mask<Bytes, Abis>​::​size() + ...)>> is enabled[.](#creation-6.2.sentence-1)

[7](#creation-7)

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

*Returns*: A data-parallel object initialized with the concatenated values in thexs pack of data-parallel objects: The ithbasic_vec/basic_mask element of the jth parameter in the xs pack is copied to the return value's element with
index i + the sum of the width of the first j parameters in the xs pack[.](#creation-7.sentence-1)

#### [29.10.8.12](#alg) Algorithms [[simd.alg]](simd.alg)

[ð](#lib:min,simd)

`template<class T, class Abi>
  constexpr basic_vec<T, Abi> min(const basic_vec<T, Abi>& a,
                                  const basic_vec<T, Abi>& b) noexcept;
`

[1](#alg-1)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#alg-1.sentence-1)

[2](#alg-2)

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

*Returns*: The result of the element-wise application of min(a[i], b[i]) for
all i in the range of [0, basic_vec<T, Abi>​::​size())[.](#alg-2.sentence-1)

[ð](#lib:max,simd)

`template<class T, class Abi>
  constexpr basic_vec<T, Abi> max(const basic_vec<T, Abi>& a,
                                  const basic_vec<T, Abi>& b) noexcept;
`

[3](#alg-3)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#alg-3.sentence-1)

[4](#alg-4)

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

*Returns*: The result of the element-wise application of max(a[i], b[i]) for
all i in the range of [0, basic_vec<T, Abi>​::​size())[.](#alg-4.sentence-1)

[ð](#lib:minmax,simd)

`template<class T, class Abi>
  constexpr pair<basic_vec<T, Abi>, basic_vec<T, Abi>>
    minmax(const basic_vec<T, Abi>& a, const basic_vec<T, Abi>& b) noexcept;
`

[5](#alg-5)

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

*Effects*: Equivalent to: return pair{min(a, b), max(a, b)};

[ð](#lib:clamp,simd)

`template<class T, class Abi>
  constexpr basic_vec<T, Abi> clamp(
    const basic_vec<T, Abi>& v, const basic_vec<T, Abi>& lo, const basic_vec<T, Abi>& hi);
`

[6](#alg-6)

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

*Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#alg-6.sentence-1)

[7](#alg-7)

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

*Preconditions*: No element in lo shall be greater than the corresponding element inhi[.](#alg-7.sentence-1)

[8](#alg-8)

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

*Returns*: The result of element-wise application of clamp(v[i], lo[i],
hi[i]) for all i in the range of [0, basic_vec<T, Abi>​::​size())[.](#alg-8.sentence-1)

[ð](#lib:select,simd)

`template<class T, class U>
  constexpr auto select(bool c, const T& a, const U& b)
  -> remove_cvref_t<decltype(c ? a : b)>;
`

[9](#alg-9)

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

*Effects*: Equivalent to: return c ? a : b;

[ð](#lib:select,simd_)

`template<size_t Bytes, class Abi, class T, class U>
  constexpr auto select(const basic_mask<Bytes, Abi>& c, const T& a, const U& b)
  noexcept -> decltype(simd-select-impl(c, a, b));
`

[10](#alg-10)

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

*Effects*: Equivalent to:return *simd-select-impl*(c, a, b); where *simd-select-impl* is found by argument-dependent
lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup")) contrary to [[contents]](contents "16.4.2.2 Library contents")[.](#alg-10.sentence-1)

#### [29.10.8.13](#math) Mathematical functions [[simd.math]](simd.math)

[ð](#lib:ilogb,simd)

`template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<int, deduced-vec-t<V>> ilogb(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> ldexp(const V& x, const rebind_t<int, deduced-vec-t<V>>& exp);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> scalbn(const V& x, const rebind_t<int, deduced-vec-t<V>>& n);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V>
    scalbln(const V& x, const rebind_t<long int, deduced-vec-t<V>>& n);
template<[signed_integral](concepts.arithmetic#concept:signed_integral "18.4.7 Arithmetic concepts [concepts.arithmetic]") T, class Abi>
  constexpr basic_vec<T, Abi> abs(const basic_vec<T, Abi>& j);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> abs(const V& j);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> fabs(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> ceil(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> floor(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  deduced-vec-t<V> nearbyint(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  deduced-vec-t<V> rint(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  rebind_t<long int, deduced-vec-t<V>> lrint(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  rebind_t<long long int, deduced-vec-t<V>> llrint(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> round(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<long int, deduced-vec-t<V>> lround(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<long long int, deduced-vec-t<V>> llround(const V& x);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> fmod(const V0& x, const V1& y);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> trunc(const V& x);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> remainder(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> copysign(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> nextafter(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> fdim(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> fmax(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> fmin(const V0& x, const V1& y);
template<class V0, class V1, class V2>
  constexpr math-common-simd-t<V0, V1, V2> fma(const V0& x, const V1& y, const V2& z);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<int, deduced-vec-t<V>> fpclassify(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename deduced-vec-t<V>::mask_type isfinite(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename deduced-vec-t<V>::mask_type isinf(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename deduced-vec-t<V>::mask_type isnan(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename deduced-vec-t<V>::mask_type isnormal(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename deduced-vec-t<V>::mask_type signbit(const V& x);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type isgreater(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type
    isgreaterequal(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type isless(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type islessequal(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type islessgreater(const V0& x, const V1& y);
template<class V0, class V1>
  constexpr typename math-common-simd-t<V0, V1>::mask_type isunordered(const V0& x, const V1& y);
`

[1](#math-1)

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

Let Ret denote the return type of the specialization of a function
template with the name *math-func*[.](#math-1.sentence-1)

Let *math-func-vec* denote:template<class... Args> Ret *math-func-vec*(Args... args) {return Ret([&](*simd-size-type* i) {*math-func*(*make-compatible-simd-t*<Ret, Args>(args)[i]...); });}

[2](#math-2)

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

*Returns*: A value ret of type Ret, that is element-wise equal to the
result of calling *math-func-vec* with the arguments of the above
functions[.](#math-2.sentence-1)

If in an invocation of a scalar overload of *math-func* for indexi in *math-func-vec* a domain, pole, or range error would
occur, the value of ret[i] is unspecified[.](#math-2.sentence-2)

[3](#math-3)

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

*Remarks*: It is unspecified whether errno ([[errno]](errno "19.4 Error numbers")) is accessed[.](#math-3.sentence-1)

[ð](#lib:acos,simd)

`template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> acos(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> asin(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> atan(const V& x);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> atan2(const V0& y, const V1& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> cos(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> sin(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> tan(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> acosh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> asinh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> atanh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> cosh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> sinh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> tanh(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> exp(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> exp2(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> expm1(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> log(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> log10(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> log1p(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> log2(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> logb(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> cbrt(const V& x);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> hypot(const V0& x, const V1& y);
template<class V0, class V1, class V2>
  constexpr math-common-simd-t<V0, V1, V2> hypot(const V0& x, const V1& y, const V2& z);
template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> pow(const V0& x, const V1& y);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> sqrt(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> erf(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> erfc(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> lgamma(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr deduced-vec-t<V> tgamma(const V& x);
template<class V0, class V1, class V2>
  constexpr math-common-simd-t<V0, V1, V2> lerp(const V0& a, const V1& b, const V2& t) noexcept;
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  deduced-vec-t<V> assoc_laguerre(const rebind_t<unsigned, deduced-vec-t<V>>& n, const
    rebind_t<unsigned, deduced-vec-t<V>>& m,
                   const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  deduced-vec-t<V> assoc_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l, const
    rebind_t<unsigned, deduced-vec-t<V>>& m,
                   const V& x);
template<class V0, class V1>
  math-common-simd-t<V0, V1> beta(const V0& x, const V1& y);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> comp_ellint_1(const V& k);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> comp_ellint_2(const V& k);
template<class V0, class V1>
  math-common-simd-t<V0, V1> comp_ellint_3(const V0& k, const V1& nu);
template<class V0, class V1>
  math-common-simd-t<V0, V1> cyl_bessel_i(const V0& nu, const V1& x);
template<class V0, class V1>
  math-common-simd-t<V0, V1> cyl_bessel_j(const V0& nu, const V1& x);
template<class V0, class V1>
  math-common-simd-t<V0, V1> cyl_bessel_k(const V0& nu, const V1& x);
template<class V0, class V1>
  math-common-simd-t<V0, V1> cyl_neumann(const V0& nu, const V1& x);
template<class V0, class V1>
  math-common-simd-t<V0, V1> ellint_1(const V0& k, const V1& phi);
template<class V0, class V1>
  math-common-simd-t<V0, V1> ellint_2(const V0& k, const V1& phi);
template<class V0, class V1, class V2>
  math-common-simd-t<V0, V1, V2> ellint_3(const V0& k, const V1& nu, const V2& phi);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> expint(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> hermite(const rebind_t<unsigned,
deduced-vec-t<V>>& n, const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> laguerre(const rebind_t<unsigned,
deduced-vec-t<V>>& n, const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> legendre(const rebind_t<unsigned,
deduced-vec-t<V>>& l, const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> riemann_zeta(const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> sph_bessel(const rebind_t<unsigned,
deduced-vec-t<V>>& n, const V& x);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  deduced-vec-t<V> sph_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l,
                                 const rebind_t<unsigned, deduced-vec-t<V>>& m,
                                 const V& theta);
template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> deduced-vec-t<V> sph_neumann(const rebind_t<unsigned,
deduced-vec-t<V>>& n, const V& x);
`

[4](#math-4)

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

Let Ret denote the return type of the specialization of a function
template with the name *math-func*[.](#math-4.sentence-1)

Let *math-func-vec* denote:template<class... Args> Ret *math-func-vec*(Args... args) {return Ret([&](*simd-size-type* i) {*math-func*(*make-compatible-simd-t*<Ret, Args>(args)[i]...); });}

[5](#math-5)

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

*Returns*: A value ret of type Ret, that is element-wise approximately
equal to the result of calling *math-func-vec* with the arguments
of the above functions[.](#math-5.sentence-1)

If in an invocation of a scalar overload of *math-func* for indexi in *math-func-vec* a domain, pole, or range error would
occur, the value of ret[i] is unspecified[.](#math-5.sentence-2)

[6](#math-6)

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

*Remarks*: It is unspecified whether errno ([[errno]](errno "19.4 Error numbers")) is accessed[.](#math-6.sentence-1)

[ð](#lib:frexp,simd)

`template<[math-floating-point](#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr deduced-vec-t<V> frexp(const V& value, rebind_t<int, deduced-vec-t<V>>* exp);
`

[7](#math-7)

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

Let Ret be *deduced-vec-t*<V>[.](#math-7.sentence-1)

Let *frexp-vec* denote:template<class V> pair<Ret, rebind_t<int, Ret>> *frexp-vec*(const V& x) {int r1[Ret::size()];
 Ret r0([&](*simd-size-type* i) { frexp(*make-compatible-simd-t*<Ret, V>(x)[i], &r1[i]); }); return {r0, rebind_t<int, Ret>(r1)};}

Let ret be a value of type pair<Ret, rebind_t<int, Ret>> that is the same value as the result of calling*frexp-vec*(x)[.](#math-7.sentence-3)

[8](#math-8)

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

*Effects*: Sets *exp to ret.second[.](#math-8.sentence-1)

[9](#math-9)

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

*Returns*: ret.first[.](#math-9.sentence-1)

[ð](#lib:remquo,simd)

`template<class V0, class V1>
  constexpr math-common-simd-t<V0, V1> remquo(const V0& x, const V1& y,
                                              rebind_t<int, math-common-simd-t<V0, V1>>* quo);
`

[10](#math-10)

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

Let Ret be *math-common-simd-t*<V0, V1>[.](#math-10.sentence-1)

Let *remquo-vec* denote:template<class V0, class V1> pair<Ret, rebind_t<int, Ret>> *remquo-vec*(const V0& x, const V1& y) {int r1[Ret::size()];
 Ret r0([&](*simd-size-type* i) { remquo(*make-compatible-simd-t*<Ret, V0>(x)[i], *make-compatible-simd-t*<Ret, V1>(y)[i], &r1[i]); }); return {r0, rebind_t<int, Ret>(r1)};}

Let ret be a value of type pair<Ret, rebind_t<int, Ret>> that is the same value as the result of calling*remquo-vec*(x, y)[.](#math-10.sentence-3)

If in an invocation of a scalar overload of remquo for index i in *remquo-vec* a domain, pole, or range error would occur, the
value of ret[i] is unspecified[.](#math-10.sentence-4)

[11](#math-11)

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

*Effects*: Sets *quo to ret.second[.](#math-11.sentence-1)

[12](#math-12)

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

*Returns*: ret.first[.](#math-12.sentence-1)

[13](#math-13)

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

*Remarks*: It is unspecified whether errno ([[errno]](errno "19.4 Error numbers")) is accessed[.](#math-13.sentence-1)

[ð](#lib:modf,simd)

`template<class T, class Abi>
  constexpr basic_vec<T, Abi> modf(const type_identity_t<basic_vec<T, Abi>>& value,
                                    basic_vec<T, Abi>* iptr);
`

[14](#math-14)

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

Let V be basic_vec<T, Abi>[.](#math-14.sentence-1)

Let *modf-vec* denote:pair<V, V> *modf-vec*(const V& x) { T r1[Ret::size()];
 V r0([&](*simd-size-type* i) { modf(V(x)[i], &r1[i]); }); return {r0, V(r1)};}

Let ret be a value of type pair<V, V> that is the same value as
the result of calling *modf-vec*(value)[.](#math-14.sentence-3)

[15](#math-15)

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

*Effects*: Sets *iptr to ret.second[.](#math-15.sentence-1)

[16](#math-16)

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

*Returns*: ret.first[.](#math-16.sentence-1)

#### [29.10.8.14](#bit) basic_vec bit library [[simd.bit]](simd.bit)

[ð](#lib:byteswap,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V byteswap(const V& v) noexcept;
`

[1](#bit-1)

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

*Constraints*: The type V​::​value_type models [integral](concepts.arithmetic#concept:integral "18.4.7 Arithmetic concepts [concepts.arithmetic]")[.](#bit-1.sentence-1)

[2](#bit-2)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of std​::​byteswap(v[i]) for all i in the range
[0, V​::​size())[.](#bit-2.sentence-1)

[ð](#lib:bit_ceil,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V bit_ceil(const V& v) noexcept;
`

[3](#bit-3)

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

*Constraints*: The type V​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#bit-3.sentence-1)

[4](#bit-4)

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

*Preconditions*: For every i in the range [0, V​::​size()), the smallest power of 2
greater than or equal to v[i] is representable as a value of typeV​::​value_type[.](#bit-4.sentence-1)

[5](#bit-5)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of std​::​bit_ceil(v[i]) for all i in the range
[0, V​::​size())[.](#bit-5.sentence-1)

[6](#bit-6)

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

*Remarks*: A function call expression that violates the precondition in the *Preconditions*: element is not a core constant expression ([[expr.const]](expr.const "7.7 Constant expressions"))[.](#bit-6.sentence-1)

[ð](#lib:bit_floor,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V bit_floor(const V& v) noexcept;
`

[7](#bit-7)

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

*Constraints*: The type V​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#bit-7.sentence-1)

[8](#bit-8)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of std​::​bit_floor(v[i]) for all i in the range
[0, V​::​size())[.](#bit-8.sentence-1)

[ð](#lib:has_single_bit,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr typename V::mask_type has_single_bit(const V& v) noexcept;
`

[9](#bit-9)

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

*Constraints*: The type V​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#bit-9.sentence-1)

[10](#bit-10)

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

*Returns*: A basic_mask object where the ith element is initialized
to the result of std​::​has_single_bit(v[i]) for all i in the range
[0, V​::​size())[.](#bit-10.sentence-1)

[ð](#lib:rotl,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V0, [simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V1>
  constexpr V0 rotl(const V0& v0, const V1& v1) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V0, [simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V1>
  constexpr V0 rotr(const V0& v0, const V1& v1) noexcept;
`

[11](#bit-11)

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

*Constraints*: 

- [(11.1)](#bit-11.1)

The type V0​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types")),

- [(11.2)](#bit-11.2)

the type V1​::​value_type models [integral](concepts.arithmetic#concept:integral "18.4.7 Arithmetic concepts [concepts.arithmetic]"),

- [(11.3)](#bit-11.3)

V0​::​size() == V1​::​size() is true, and

- [(11.4)](#bit-11.4)

sizeof(typename V0​::​value_type) == sizeof(typename V1​::​value_type) is true[.](#bit-11.sentence-1)

[12](#bit-12)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of *bit-func*(v0[i],static_cast<int>(v1[i])) for all i in the range [0, V0​::​size()),
where *bit-func* is the corresponding scalar function from [<bit>](bit.general#header:%3cbit%3e "22.11.1 General [bit.general]")[.](#bit-12.sentence-1)

[ð](#lib:rotl,simd_)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V rotl(const V& v, int s) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V rotr(const V& v, int s) noexcept;
`

[13](#bit-13)

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

*Constraints*: The type V​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#bit-13.sentence-1)

[14](#bit-14)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of *bit-func*(v[i], s) for all i in the
range [0, V​::​size()), where *bit-func* is the corresponding
scalar function from [<bit>](bit.general#header:%3cbit%3e "22.11.1 General [bit.general]")[.](#bit-14.sentence-1)

[ð](#lib:bit_width,simd)

`template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> bit_width(const V& v) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_zero(const V& v) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_one(const V& v) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_zero(const V& v) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_one(const V& v) noexcept;
template<[simd-vec-type](#concept:simd-vec-type "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<make_signed_t<typename V::value_type>, V> popcount(const V& v) noexcept;
`

[15](#bit-15)

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

*Constraints*: The type V​::​value_type is an unsigned integer type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#bit-15.sentence-1)

[16](#bit-16)

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

*Returns*: A basic_vec object where the ith element is initialized to
the result of *bit-func*(v[i]) for all i in the range
[0, V​::​size()), where *bit-func* is the corresponding scalar
function from [<bit>](bit.general#header:%3cbit%3e "22.11.1 General [bit.general]")[.](#bit-16.sentence-1)

#### [29.10.8.15](#complex.math) vec complex math [[simd.complex.math]](simd.complex.math)

[ð](#lib:real,simd)

`template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<simd-complex-value-type<V>, V> real(const V&) noexcept;
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<simd-complex-value-type<V>, V> imag(const V&) noexcept;

template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<simd-complex-value-type<V>, V> abs(const V&);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<simd-complex-value-type<V>, V> arg(const V&);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr rebind_t<simd-complex-value-type<V>, V> norm(const V&);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V conj(const V&);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V proj(const V&);

template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V exp(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V log(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V log10(const V& v);

template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sqrt(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sin(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V asin(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V cos(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V acos(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V tan(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V atan(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V sinh(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V asinh(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V cosh(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V acosh(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V tanh(const V& v);
template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V atanh(const V& v);
`

[1](#complex.math-1)

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

*Returns*: A basic_vec object ret where the ith element is
initialized to the result of *cmplx-func*(v[i]) for alli in the range [0, V​::​size()), where *cmplx-func* is the
corresponding function from [<complex>](complex.syn#header:%3ccomplex%3e "29.4.2 Header <complex> synopsis [complex.syn]")[.](#complex.math-1.sentence-1)

If in an invocation of*cmplx-func* for index i a domain, pole, or range error would
occur, the value of ret[i] is unspecified[.](#complex.math-1.sentence-2)

[2](#complex.math-2)

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

*Remarks*: It is unspecified whether errno ([[errno]](errno "19.4 Error numbers")) is accessed[.](#complex.math-2.sentence-1)

[ð](#lib:polar,simd)

`template<[simd-floating-point](#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  rebind_t<complex<typename V::value_type>, V> polar(const V& x, const V& y = {});

template<[simd-complex](#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V> constexpr V pow(const V& x, const V& y);
`

[3](#complex.math-3)

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

*Returns*: A basic_vec object ret where the ith element is
initialized to the result of *cmplx-func*(x[i], y[i]) for all i in the range [0, V​::​size()), where *cmplx-func* is the corresponding function from [<complex>](complex.syn#header:%3ccomplex%3e "29.4.2 Header <complex> synopsis [complex.syn]")[.](#complex.math-3.sentence-1)

If in an invocation of*cmplx-func* for index i a domain, pole, or range error would
occur, the value of ret[i] is unspecified[.](#complex.math-3.sentence-2)

[4](#complex.math-4)

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

*Remarks*: It is unspecified whether errno ([[errno]](errno "19.4 Error numbers")) is accessed[.](#complex.math-4.sentence-1)

### [29.10.9](#mask.class) Class template basic_mask [[simd.mask.class]](simd.mask.class)

#### [29.10.9.1](#mask.overview) Class template basic_mask overview [[simd.mask.overview]](simd.mask.overview)

namespace std::simd {template<size_t Bytes, class Abi> class basic_mask {public:using [value_type](#lib:basic_mask,value_type "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]") = bool; using [abi_type](#lib:basic_mask,abi_type "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]") = Abi; using [iterator](#lib:basic_mask,iterator "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]") = *simd-iterator*<basic_mask>; using [const_iterator](#lib:basic_mask,const_iterator "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]") = *simd-iterator*<const basic_mask>; constexpr iterator [begin](#lib:basic_mask,begin "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]")() noexcept { return {*this, 0}; }constexpr const_iterator [begin](#lib:basic_mask,begin "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]")() const noexcept { return {*this, 0}; }constexpr const_iterator [cbegin](#lib:basic_mask,cbegin "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]")() const noexcept { return {*this, 0}; }constexpr default_sentinel_t [end](#lib:basic_mask,end "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]")() const noexcept { return {}; }constexpr default_sentinel_t [cend](#lib:basic_mask,cend "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]")() const noexcept { return {}; }static constexpr integral_constant<*simd-size-type*, *simd-size-v*<*integer-from*<Bytes>, Abi>>[size](#lib:basic_mask,size "29.10.9.1 Class template basic_­mask overview [simd.mask.overview]") {}; constexpr basic_mask() noexcept = default; // [[simd.mask.ctor]](#mask.ctor "29.10.9.2 basic_­mask constructors"), basic_mask constructorsconstexpr explicit basic_mask(value_type) noexcept; template<size_t UBytes, class UAbi>constexpr explicit basic_mask(const basic_mask<UBytes, UAbi>&) noexcept; template<class G>constexpr explicit basic_mask(G&& gen) noexcept; constexpr basic_mask(const bitset<size()>& b) noexcept; constexpr explicit basic_mask([unsigned_integral](concepts.arithmetic#concept:unsigned_integral "18.4.7 Arithmetic concepts [concepts.arithmetic]") auto val) noexcept; // [[simd.mask.subscr]](#mask.subscr "29.10.9.3 basic_­mask subscript operator"), basic_mask subscript operatorsconstexpr value_type operator[](*simd-size-type*) const; template<[*simd-integral*](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>constexpr resize_t<I::size(), basic_mask> operator[](const I& indices) const; // [[simd.mask.unary]](#mask.unary "29.10.9.4 basic_­mask unary operators"), basic_mask unary operatorsconstexpr basic_mask operator!() const noexcept; constexpr basic_vec<*integer-from*<Bytes>, Abi> operator+() const noexcept; constexpr basic_vec<*integer-from*<Bytes>, Abi> operator-() const noexcept; constexpr basic_vec<*integer-from*<Bytes>, Abi> operator~() const noexcept; // [[simd.mask.conv]](#mask.conv "29.10.9.5 basic_­mask conversions"), basic_mask conversionstemplate<class U, class A>constexpr explicit(sizeof(U) != Bytes) operator basic_vec<U, A>() const noexcept; constexpr bitset<size()> to_bitset() const noexcept; constexpr unsigned long long to_ullong() const; // [[simd.mask.binary]](#mask.binary "29.10.10.1 basic_­mask binary operators"), basic_mask binary operatorsfriend constexpr basic_mask operator&&(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator||(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator&(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator|(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator^(const basic_mask&, const basic_mask&) noexcept; // [[simd.mask.cassign]](#mask.cassign "29.10.10.2 basic_­mask compound assignment"), basic_mask compound assignmentfriend constexpr basic_mask&operator&=(basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask&operator|=(basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask&operator^=(basic_mask&, const basic_mask&) noexcept; // [[simd.mask.comparison]](#mask.comparison "29.10.10.3 basic_­mask comparisons"), basic_mask comparisonsfriend constexpr basic_mask operator==(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator!=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator>=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator<=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator>(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator<(const basic_mask&, const basic_mask&) noexcept; // [[simd.mask.cond]](#mask.cond "29.10.10.4 basic_­mask exposition only conditional operators"), basic_mask exposition only conditional operatorsfriend constexpr basic_mask *simd-select-impl*( // *exposition only*const basic_mask&, const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask *simd-select-impl*( // *exposition only*const basic_mask&, [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto, [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto) noexcept; template<class T0, class T1>friend constexpr vec<*see below*, size()>*simd-select-impl*(const basic_mask&, const T0&, const T1&) noexcept; // *exposition only*};}

[1](#mask.overview-1)

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

Every specialization of basic_mask is a complete type[.](#mask.overview-1.sentence-1)

The specialization of basic_mask<Bytes, Abi> is:

- [(1.1)](#mask.overview-1.1)

disabled, if there is no vectorizable type T such that Bytes is equal to sizeof(T),

- [(1.2)](#mask.overview-1.2)

otherwise, enabled, if there exists a vectorizable type T and a
 value N in the range [1, 64] such that Bytes is equal
 to sizeof(T) and Abi is *deduce-abi-t*<T,
 N>,

- [(1.3)](#mask.overview-1.3)

otherwise, it is implementation-defined if such a specialization is enabled[.](#mask.overview-1.sentence-2)

If basic_mask<Bytes, Abi> is disabled, the specialization has a
deleted default constructor, deleted destructor, deleted copy constructor, and
deleted copy assignment[.](#mask.overview-1.sentence-3)

In addition only the value_type and abi_type members are
present[.](#mask.overview-1.sentence-4)

If basic_mask<Bytes, Abi> is enabled,basic_mask<Bytes, Abi> is trivially copyable[.](#mask.overview-1.sentence-5)

[2](#mask.overview-2)

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

*Recommended practice*: Implementations should support implicit conversions between
specializations of basic_mask and appropriate implementation-defined types[.](#mask.overview-2.sentence-1)

[*Note [1](#mask.overview-note-1)*:

Appropriate types are non-standard vector types which are available in the
implementation[.](#mask.overview-2.sentence-2)

â *end note*]

#### [29.10.9.2](#mask.ctor) basic_mask constructors [[simd.mask.ctor]](simd.mask.ctor)

[ð](#lib:basic_mask,constructor)

`constexpr explicit basic_mask(value_type x) noexcept;
`

[1](#mask.ctor-1)

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

*Effects*: Initializes each element with x[.](#mask.ctor-1.sentence-1)

[ð](#lib:basic_mask,constructor_)

`template<size_t UBytes, class UAbi>
  constexpr explicit basic_mask(const basic_mask<UBytes, UAbi>& x) noexcept;
`

[2](#mask.ctor-2)

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

*Constraints*: basic_mask<UBytes, UAbi>​::​size() == size() istrue[.](#mask.ctor-2.sentence-1)

[3](#mask.ctor-3)

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

*Effects*: Initializes the ith element with x[i] for all i in the
range of [0, size())[.](#mask.ctor-3.sentence-1)

[ð](#lib:basic_mask,constructor__)

`template<class G> constexpr explicit basic_mask(G&& gen);
`

[4](#mask.ctor-4)

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

*Constraints*: The expression gen(integral_constant<*simd-size-type*, i>()) is
well-formed and its type is bool for all i in the range of
[0, size())[.](#mask.ctor-4.sentence-1)

[5](#mask.ctor-5)

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

*Effects*: Initializes the ith element withgen(integral_constant<*simd-size-type*, i>()) for all i in
the range of [0, size())[.](#mask.ctor-5.sentence-1)

[6](#mask.ctor-6)

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

*Remarks*: gen is invoked exactly once for each i, in increasing order of i[.](#mask.ctor-6.sentence-1)

[ð](#lib:basic_mask,constructor___)

`constexpr basic_mask(const bitset<size()>& b) noexcept;
`

[7](#mask.ctor-7)

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

*Effects*: Initializes the ith element with b[i] for all i in the
range [0, size())[.](#mask.ctor-7.sentence-1)

[ð](#lib:basic_mask,constructor____)

`constexpr explicit basic_mask([unsigned_integral](concepts.arithmetic#concept:unsigned_integral "18.4.7 Arithmetic concepts [concepts.arithmetic]") auto val) noexcept;
`

[8](#mask.ctor-8)

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

*Effects*: Initializes the first M elements to the corresponding bit values inval, where M is the smaller of size() and the number of bits in
the value representation ([[basic.types.general]](basic.types.general "6.9.1 General")) of the type of val[.](#mask.ctor-8.sentence-1)

IfM is less than size(), the remaining elements are initialized to
zero[.](#mask.ctor-8.sentence-2)

#### [29.10.9.3](#mask.subscr) basic_mask subscript operator [[simd.mask.subscr]](simd.mask.subscr)

[ð](#lib:operator%5b%5d,basic_mask)

`constexpr value_type operator[](simd-size-type i) const;
`

[1](#mask.subscr-1)

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

*Preconditions*: i >= 0 && i < size() is true[.](#mask.subscr-1.sentence-1)

[2](#mask.subscr-2)

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

*Returns*: The value of the ith element[.](#mask.subscr-2.sentence-1)

[3](#mask.subscr-3)

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

*Throws*: Nothing[.](#mask.subscr-3.sentence-1)

[ð](#lib:operator%5b%5d,basic_mask_)

`template<[simd-integral](#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>
  constexpr resize_t<I::size(), basic_mask> operator[](const I& indices) const;
`

[4](#mask.subscr-4)

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

*Effects*: Equivalent to: return permute(*this, indices);

#### [29.10.9.4](#mask.unary) basic_mask unary operators [[simd.mask.unary]](simd.mask.unary)

[ð](#lib:operator,operator,basic_mask)

`constexpr basic_mask operator!() const noexcept;
constexpr basic_vec<integer-from<Bytes>, Abi> operator+() const noexcept;
constexpr basic_vec<integer-from<Bytes>, Abi> operator-() const noexcept;
constexpr basic_vec<integer-from<Bytes>, Abi> operator~() const noexcept;
`

[1](#mask.unary-1)

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

Let *op* be the operator[.](#mask.unary-1.sentence-1)

[2](#mask.unary-2)

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

*Returns*: A data-parallel object where the ith element is initialized to the
results of applying *op* to operator[](i) for all i in
the range of [0, size())[.](#mask.unary-2.sentence-1)

#### [29.10.9.5](#mask.conv) basic_mask conversions [[simd.mask.conv]](simd.mask.conv)

[ð](#lib:operator_basic_vec,basic_mask)

`template<class U, class A>
  constexpr explicit(sizeof(U) != Bytes) operator basic_vec<U, A>() const noexcept;
`

[1](#mask.conv-1)

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

*Constraints*: *simd-size-v*<U, A> == *simd-size-v*<T, Abi>[.](#mask.conv-1.sentence-1)

[2](#mask.conv-2)

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

*Returns*: A data-parallel object where the ith element is initialized tostatic_cast<U>(operator[](i))[.](#mask.conv-2.sentence-1)

[ð](#lib:to_bitset,basic_mask)

`constexpr bitset<size()> to_bitset() const noexcept;
`

[3](#mask.conv-3)

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

*Returns*: A bitset<size()> object where the ith element is initialized tooperator[](i) for all i in the range [0, size())[.](#mask.conv-3.sentence-1)

[ð](#lib:to_ullong,basic_mask)

`constexpr unsigned long long to_ullong() const;
`

[4](#mask.conv-4)

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

Let N be the width of unsigned long long[.](#mask.conv-4.sentence-1)

[5](#mask.conv-5)

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

*Preconditions*: 

- [(5.1)](#mask.conv-5.1)

size() <= N is true, or

- [(5.2)](#mask.conv-5.2)

for all i in the range [N, size()), operator[](i) returns false[.](#mask.conv-5.sentence-1)

[6](#mask.conv-6)

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

*Returns*: The integral value corresponding to the bits in *this[.](#mask.conv-6.sentence-1)

[7](#mask.conv-7)

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

*Throws*: Nothing[.](#mask.conv-7.sentence-1)

### [29.10.10](#mask.nonmembers) basic_mask non-member operations [[simd.mask.nonmembers]](simd.mask.nonmembers)

#### [29.10.10.1](#mask.binary) basic_mask binary operators [[simd.mask.binary]](simd.mask.binary)

[ð](#lib:operator&&,basic_mask)

`friend constexpr basic_mask
  operator&&(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator||(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator& (const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator| (const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator^ (const basic_mask& lhs, const basic_mask& rhs) noexcept;
`

[1](#mask.binary-1)

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

Let *op* be the operator[.](#mask.binary-1.sentence-1)

[2](#mask.binary-2)

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

*Returns*: A basic_mask object initialized with the results of applying*op* to lhs and rhs as a binary element-wise
operation[.](#mask.binary-2.sentence-1)

#### [29.10.10.2](#mask.cassign) basic_mask compound assignment [[simd.mask.cassign]](simd.mask.cassign)

[ð](#lib:operator&=,basic_mask)

`friend constexpr basic_mask&
  operator&=(basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask&
  operator|=(basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask&
  operator^=(basic_mask& lhs, const basic_mask& rhs) noexcept;
`

[1](#mask.cassign-1)

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

Let *op* be the operator[.](#mask.cassign-1.sentence-1)

[2](#mask.cassign-2)

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

*Effects*: These operators apply *op* to lhs and rhs as a
binary element-wise operation[.](#mask.cassign-2.sentence-1)

[3](#mask.cassign-3)

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

*Returns*: lhs[.](#mask.cassign-3.sentence-1)

#### [29.10.10.3](#mask.comparison) basic_mask comparisons [[simd.mask.comparison]](simd.mask.comparison)

[ð](#lib:operator==,basic_mask)

`friend constexpr basic_mask
  operator==(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator!=(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator>=(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator<=(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator>(const basic_mask& lhs, const basic_mask& rhs) noexcept;
friend constexpr basic_mask
  operator<(const basic_mask& lhs, const basic_mask& rhs) noexcept;
`

[1](#mask.comparison-1)

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

Let *op* be the operator[.](#mask.comparison-1.sentence-1)

[2](#mask.comparison-2)

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

*Returns*: A basic_mask object initialized with the results of applying*op* to lhs and rhs as a binary element-wise
operation[.](#mask.comparison-2.sentence-1)

#### [29.10.10.4](#mask.cond) basic_mask exposition only conditional operators [[simd.mask.cond]](simd.mask.cond)

[ð](#mask.cond-itemdecl:1)

`friend constexpr basic_mask simd-select-impl(
  const basic_mask& mask, const basic_mask& a, const basic_mask& b) noexcept;
`

[1](#mask.cond-1)

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

*Returns*: A basic_mask object where the ith element equalsmask[i] ? a[i] : b[i] for all i in the range of
[0, size())[.](#mask.cond-1.sentence-1)

[ð](#mask.cond-itemdecl:2)

`friend constexpr basic_mask
simd-select-impl(const basic_mask& mask, [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto a, [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto b) noexcept;
`

[2](#mask.cond-2)

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

*Returns*: A basic_mask object where the ith element equalsmask[i] ? a : b for all i in the range of [0, size())[.](#mask.cond-2.sentence-1)

[ð](#mask.cond-itemdecl:3)

`template<class T0, class T1>
  friend constexpr vec<see below, size()>
    simd-select-impl(const basic_mask& mask, const T0& a, const T1& b) noexcept;
`

[3](#mask.cond-3)

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

*Constraints*: 

- [(3.1)](#mask.cond-3.1)

same_as<T0, T1> is true,

- [(3.2)](#mask.cond-3.2)

T0 is a vectorizable type, and

- [(3.3)](#mask.cond-3.3)

sizeof(T0) == Bytes[.](#mask.cond-3.sentence-1)

[4](#mask.cond-4)

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

*Returns*: A vec<T0, size()> object where the ith element equalsmask[i] ? a : b for all i in the range of [0, size())[.](#mask.cond-4.sentence-1)

#### [29.10.10.5](#mask.reductions) basic_mask reductions [[simd.mask.reductions]](simd.mask.reductions)

[ð](#lib:all_of,simd)

`template<size_t Bytes, class Abi>
  constexpr bool all_of(const basic_mask<Bytes, Abi>& k) noexcept;
`

[1](#mask.reductions-1)

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

*Returns*: true if all boolean elements in k are true, otherwisefalse[.](#mask.reductions-1.sentence-1)

[ð](#lib:any_of,simd)

`template<size_t Bytes, class Abi>
  constexpr bool any_of(const basic_mask<Bytes, Abi>& k) noexcept;
`

[2](#mask.reductions-2)

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

*Returns*: true if at least one boolean element in k is true,
otherwise false[.](#mask.reductions-2.sentence-1)

[ð](#lib:none_of,simd)

`template<size_t Bytes, class Abi>
  constexpr bool none_of(const basic_mask<Bytes, Abi>& k) noexcept;
`

[3](#mask.reductions-3)

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

*Returns*: !any_of(k)[.](#mask.reductions-3.sentence-1)

[ð](#lib:reduce_count,simd)

`template<size_t Bytes, class Abi>
  constexpr simd-size-type reduce_count(const basic_mask<Bytes, Abi>& k) noexcept;
`

[4](#mask.reductions-4)

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

*Returns*: The number of boolean elements in k that are true[.](#mask.reductions-4.sentence-1)

[ð](#lib:reduce_min_index,simd)

`template<size_t Bytes, class Abi>
  constexpr simd-size-type reduce_min_index(const basic_mask<Bytes, Abi>& k);
`

[5](#mask.reductions-5)

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

*Preconditions*: any_of(k) is true[.](#mask.reductions-5.sentence-1)

[6](#mask.reductions-6)

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

*Returns*: The lowest element index i where k[i] is true[.](#mask.reductions-6.sentence-1)

[ð](#lib:reduce_max_index,simd)

`template<size_t Bytes, class Abi>
  constexpr simd-size-type reduce_max_index(const basic_mask<Bytes, Abi>& k);
`

[7](#mask.reductions-7)

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

*Preconditions*: any_of(k) is true[.](#mask.reductions-7.sentence-1)

[8](#mask.reductions-8)

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

*Returns*: The greatest element index i where k[i] is true[.](#mask.reductions-8.sentence-1)

[ð](#lib:all_of,simd_)

`constexpr bool all_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x) noexcept;
constexpr bool any_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x) noexcept;
constexpr simd-size-type reduce_count([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x) noexcept;
`

[9](#mask.reductions-9)

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

*Returns*: x[.](#mask.reductions-9.sentence-1)

[ð](#lib:none_of,simd_)

`constexpr bool none_of([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x) noexcept;
`

[10](#mask.reductions-10)

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

*Returns*: !x[.](#mask.reductions-10.sentence-1)

[ð](#lib:reduce_min_index,simd_)

`constexpr simd-size-type reduce_min_index([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x);
constexpr simd-size-type reduce_max_index([same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<bool> auto x);
`

[11](#mask.reductions-11)

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

*Preconditions*: x is true[.](#mask.reductions-11.sentence-1)

[12](#mask.reductions-12)

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

*Returns*: 0[.](#mask.reductions-12.sentence-1)
