29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.9 Mask permute [simd.permute.mask]

template<simd-vec-type V> constexpr V compress(const V& v, const typename V::mask_type& selector); template<simd-mask-type 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
  • select-value(i) be a function which returns v[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
template<simd-vec-type V> constexpr V compress(const V& v, const typename V::mask_type& selector, const typename V::value_type& fill_value); template<simd-mask-type 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
  • select-value(i) be a function which returns v[bit-index(i)] for i in the range [0, reduce_count(selector)) and fill_value otherwise.
Returns: A data-parallel object where the
template<simd-vec-type V> constexpr V expand(const V& v, const typename V::mask_type& selector, const V& original = {}); template<simd-mask-type 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, in ascending order.
  • bit-lookup(b) be a function which returns the index where b appears in set-indices.
  • select-value(i) be a function which returns v[bit-lookup(i)] if selector[i] is true, otherwise returns original[i].
Returns: A data-parallel object where the

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant