[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 constexpr auto chunk(const basic_vec& x) noexcept; template constexpr auto chunk(const basic_mask, 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​::​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*, Abi>​::​size() % T​::​size() is not 0, then resize_t<​basic_mask<​*mask-element-size*, 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 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[.](#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 constexpr auto chunk(const basic_vec& x) noexcept; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19175) *Effects*: Equivalent to: return chunk>>(x); [🔗](#lib:chunk,simd__) `template constexpr auto chunk(const basic_mask& x) noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19187) *Effects*: Equivalent to: return chunk>>(x); [🔗](#lib:cat,simd) `template constexpr vec::size() + ...)> cat(const basic_vec&... xs) noexcept; template constexpr basic_mask, (basic_mask::size() + ...)>> cat(const basic_mask&... 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​::​size() + ...)> is enabled[.](#6.1.sentence-1) - [(6.2)](#6.2) For the second overload basic_mask, (basic_mask​::​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)