|
| template<class offset_type, class S, class Arg, class... Args> |
| offset_type | xt::data_offset (const S &strides, Arg arg, Args... args) noexcept |
| | Return the flat index for an array index.
|
| |
| template<layout_type L = layout_type::dynamic, class shape_type, class strides_type> |
| std::size_t | xt::compute_strides (const shape_type &shape, layout_type l, strides_type &strides) |
| | Compute the strides given the shape and the layout of an array.
|
| |
| template<class S, class... Args> |
| void | xt::normalize_periodic (const S &shape, Args &... args) |
| | Normalise an index of a periodic array.
|
| |
| template<class E> |
| auto | xt::strides (const E &e, stride_type type=stride_type::normal) noexcept |
| | Get strides of an object.
|
| |
| template<class E> |
| auto | xt::strides (const E &e, std::size_t axis, stride_type type=stride_type::normal) noexcept |
| | Get stride of an object along an axis.
|
| |
template<class offset_type, class S, class Arg, class... Args>
| offset_type xt::data_offset |
( |
const S & | strides, |
|
|
Arg | arg, |
|
|
Args... | args ) |
|
inlinenoexcept |
Return the flat index for an array index.
Given m arguments, and dimension nof the array (n == strides.size()).
- If
m == n, the index is strides[0] * index[0] + ... + strides[n - 1] * index[n - 1].
- If
m < n and the last argument is xt::missing the indices are zero-padded at the end to match the dimension of the array. The index is then strides[0] * index[0] + ... + strides[m - 1] * index[m - 1].
- If
m < n (and the last argument is not xt::missing), the index is strides[n - m - 1] * index[0] + ... + strides[n - 1] * index[m - 1].
- If
m > n, then the first m - n arguments are ignored. The index is then strides[0] * index[m - n] + ... + strides[n - 1] * index[m - 1].
- Parameters
-
| strides | Strides of the array. |
| args | Array index. |
- Returns
- The flat index.
Definition at line 453 of file xstrides.hpp.
template<class S, class... Args>
| void xt::normalize_periodic |
( |
const S & | shape, |
|
|
Args &... | args ) |
|
inline |
Normalise an index of a periodic array.
For example if the shape is (3, 4) and the index is (3, -4) the result is (0, 0).
- Parameters
-
| shape | Shape of the array. |
| args | (input/output) Array index. |
Definition at line 909 of file xstrides.hpp.