[simd.general]

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

## 29.10 Data-parallel types [[simd]](simd#general)

### 29.10.1 General [simd.general]

[1](#1)

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

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

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

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

â *end note*]

[2](#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)](#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)](#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)](#2.3)

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

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

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

[4](#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]](simd.overview "29.10.7.1 Class template basic_­vec overview") and[[simd.mask.overview]](simd.mask.overview "29.10.9.1 Class template basic_­mask overview")[.](#4.sentence-1)

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

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

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

Each such application is unsequenced with respect to the others[.](#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[.](#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[.](#6.sentence-4)

[7](#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[.](#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[.](#7.sentence-2)

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