21 #ifndef RAJA_PERMUTEDLAYOUT_HPP
22 #define RAJA_PERMUTEDLAYOUT_HPP
24 #include "RAJA/config.hpp"
65 template<
size_t Rank,
typename IdxLin = Index_type>
67 std::array<IdxLin, Rank> sizes,
70 std::array<IdxLin, Rank> strides;
71 std::array<IdxLin, Rank> folded_strides;
72 for (
size_t i = 0; i < Rank; ++i)
75 folded_strides[i] = sizes[permutation[i]] ? 1 : 0;
76 for (
size_t j = i + 1; j < Rank; ++j)
78 folded_strides[i] *= sizes[permutation[j]] ? sizes[permutation[j]] : 1;
82 for (
size_t i = 0; i < Rank; ++i)
84 strides[permutation[i]] = folded_strides[i];
90 for (
size_t i = 0; i < Rank; ++i)
92 ret.sizes[i] = sizes[i];
93 ret.strides[i] = strides[i];
94 ret.inv_strides[i] = strides[i] ? strides[i] : 1;
95 ret.inv_mods[i] = sizes[i] ? sizes[i] : 1;
100 template<camp::idx_t... Ints>
101 using Perm = camp::idx_seq<Ints...>;
102 template<camp::
idx_t N>
103 using MakePerm =
typename camp::make_idx_seq<N>::type;
RAJA header file for strongly-typed integer class.
RAJA header file defining Layout, a N-dimensional index calculator.
Header file for RAJA operator definitions.
RAJA header file defining permutations.
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
Definition: AlignedRangeIndexSetBuilders.cpp:35
typename camp::make_idx_seq< N >::type MakePerm
Definition: PermutedLayout.hpp:103
camp::idx_seq< Ints... > Perm
Definition: PermutedLayout.hpp:101
constexpr RAJA_INLINE RAJA_HOST_DEVICE auto make_permuted_layout(std::array< IdxLin, Rank > sizes, std::array< camp::idx_t, Rank > permutation) -> Layout< Rank, IdxLin >
Creates a permuted Layout object.
Definition: PermutedLayout.hpp:66
Definition: Layout.hpp:46