4.1 KiB
[simd.permute.mask]
29 Numerics library [numerics]
29.10 Data-parallel types [simd]
29.10.8 basic_vec non-member operations [simd.nonmembers]
29.10.8.9 vec mask permute [simd.permute.mask]
template<[simd-vec-type](simd.expos#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](simd.expos#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);
Let:
-
bit-index(i) be a function which returns the index of the ith element of selector that is true.
-
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. [Note 1: Different calls to select-value can return different unspecified values. â end note]
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()).
template<[simd-vec-type](simd.expos#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](simd.expos#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);
Let:
-
bit-index(i) be a function which returns the index of the ith element of selector that is true.
-
select-value(i) be a function which returnsv[bit-index(i)] for i in the range [0, reduce_count(selector)) and fill_value otherwise.
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()).
template<[simd-vec-type](simd.expos#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](simd.expos#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 = {});
Let:
-
set-indices be a list of the index positions of true elements in selector.
-
bit-lookup(b) be a function which returns the index where b appears in set-indices.
-
select-value(i) be a function which returnsv[bit-lookup(i)] if selector[i] istrue, otherwise returns original[i].
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()).