Files
2025-10-25 03:02:53 +03:00

119 lines
4.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[simd.creation]
# 29 Numerics library [[numerics]](./#numerics)
## 29.10 Data-parallel types [[simd]](simd#creation)
### 29.10.8 basic_vec non-member operations [[simd.nonmembers]](simd.nonmembers#simd.creation)
#### 29.10.8.11 basic_vec and basic_mask 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](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19123)
*Constraints*:
- [(1.1)](#1.1)
For the first overload, T is an enabled specialization of basic_vec[.](#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[.](#1.1.sentence-2)
- [(1.2)](#1.2)
For the second overload, T is an enabled specialization of basic_mask[.](#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[.](#1.2.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19143)
Let N be x.size() / T::size()[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19146)
*Returns*:
- [(3.1)](#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()[.](#3.1.sentence-1)
- [(3.2)](#3.2)
Otherwise, a tuple of N objects of type T and one object
of type resize_t<x.size() % T::size(), T>[.](#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()[.](#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()[.](#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](#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](#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](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19204)
*Constraints*:
- [(6.1)](#6.1)
For the first overload vec<T, (basic_vec<T, Abis>::size() + ...)> is enabled[.](#6.1.sentence-1)
- [(6.2)](#6.2)
For the second overload basic_mask<Bytes, *deduce-abi-t*<*integer-from*<Bytes>, (basic_mask<Bytes, Abis>::size() + ...)>> is enabled[.](#6.2.sentence-1)
[7](#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[.](#7.sentence-1)