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

2.6 KiB
Raw Permalink Blame History

[simd.permute.static]

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.7 vec static permute [simd.permute.static]

🔗

template<simd-size-type N = see below, [simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V, class IdxMap> constexpr resize_t<N, V> permute(const V& v, IdxMap&& idxmap); template<simd-size-type N = see below, [simd-mask-type](simd.expos#concept:simd-mask-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") M, class IdxMap> constexpr resize_t<N, M> permute(const M& v, IdxMap&& idxmap);

1

#

Let:

gen-fn(i) be idxmap(i, V::size()) if that expression is well-formed, and idxmap(i) otherwise.

perm-fn be the following exposition-only function template:template<simd-size-type I>typename V::value_type perm-fn() {constexpr auto src_index = gen-fn(I); if constexpr (src_index == zero_element) {return typename V::value_type(); } else if constexpr (src_index == uninit_element) {return unspecified-value; } else {return v[src_index]; }}

2

#

Constraints: integral<invoke_result_t<IdxMap&, simd-size-type>> ||integral<invoke_result_t<IdxMap&, simd-size-type,simd-size-type>> is true.

3

#

Mandates: gen-fn(i) is a constant expression whose value iszero_element, uninit_element, or in the range [0, V::size()), for all i in the range [0, N).

4

#

Returns: A data-parallel object where theith element is initialized to the result ofperm-fn() for all i in the range [0, N).

5

#

Remarks: The default argument for template parameter N is V::size().