xtensor
|
Enumerations | |
enum class | xt::stride_type { xt::stride_type::internal = 0 , xt::stride_type::normal = 1 , xt::stride_type::bytes = 2 } |
Choose stride type. More... | |
Functions | |
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. | |
|
strong |
Choose stride type.
Enumerator | |
---|---|
internal | As used internally (with |
normal | Normal stride corresponding to storage. |
bytes | Normal stride in bytes. |
Definition at line 233 of file xstrides.hpp.
|
inline |
Compute the strides given the shape and the layout of an array.
shape | Shape of the array. |
l | Layout type, see xt::layout_type(). |
strides | (output) Strides of the array. |
Definition at line 566 of file xstrides.hpp.
Return the flat index for an array index.
Given m
arguments, and dimension n
of the array (n == strides.size()
).
m == n
, the index is strides[0] * index[0] + ... + strides[n - 1] * index[n - 1]
.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]
.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]
.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]
.strides | Strides of the array. |
args | Array index. |
Definition at line 453 of file xstrides.hpp.
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)
.
shape | Shape of the array. |
args | (input/output) Array index. |
Definition at line 909 of file xstrides.hpp.
|
inlinenoexcept |
Get stride of an object along an axis.
a | an array |
Definition at line 292 of file xstrides.hpp.
|
inlinenoexcept |
Get strides of an object.
a | an array |
Definition at line 248 of file xstrides.hpp.