![]() |
IOLink Python 1.11.0
|
Public Member Functions | |
| __init__ (self, *args) | |
| __eq__ (self, other) | |
| __ne__ (self, other) | |
| dimension_count (self) | |
| dtype (self) | |
| shape (self, *args) | |
| stride (self, *args) | |
| byte_stride (self, *args) | |
| layout (self, *args) | |
| element_count (self) | |
| byte_count (self) | |
| offset (self, index) | |
| byte_offset (self, index) | |
| is_continuous (self) | |
Properties | |
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
This class is used to index a classic array into a multi dimensional array.
Its main use is to convert a multi-dimensional index into the corresponding
offset in the flat array used for storage. An indexer contains all the needed
tools and describes how the data is really stored. The three main elements are:
the shape, the stride, and the layout.
The shape is simply the size of the indexed array in each dimension, for example
an array with two columns and two rows will have a shape of {2, 2}.
The stride contains the offset between each iteration of a dimension, in elements.
For example, our {2, 2} array will usually have a stride of {1, 2}, as each column
element is adjacent (hence the stride of one), and when iterating element on a line,
you must skip one element on the underlying array (hence the stride of 2).
The stride dimension are in the same order as the shape, but they do not have to
be in ascendent order. Actually, reverse order arrays (C convention) will have
inversed strides, for example, {2, 1} in our {2, 2} array case.
The layout describes in wich order each dimension is ordered internally,
and can be used to enhance performance. The usual IOLink layout is
{0, 1, ..., n - 1, n}. As we use the Fortran convention in IOLink, indexing a C array
would use an inverted layout {n, n-1, ..., 1, 0}. This field enables user to easily know
how data is organised without analysing the strides directly.
| iolink.iolink.Indexer.byte_count | ( | self | ) |
Get the total number of bytes needed to adress this indexer, taking
the padding into account.
:rtype: int
:return: the number of bytes managed by this Indexer.
| iolink.iolink.Indexer.byte_offset | ( | self, | |
| index | |||
| ) |
Computes the offset in bytes to the given index.
:type index: :py:class:`VectorXu64`
:param index: The index of the element for which the offset must be computed.
:rtype: int
:return: the offset in bytes to the given index.
:raises: InvalidArgument If the index is invalid.
| iolink.iolink.Indexer.byte_stride | ( | self, | |
| * | args | ||
| ) |
*Overload 1:*
:rtype: :py:class:`VectorXu64`
:return: the stride in bytes of this Indexer.
|
*Overload 2:*
:rtype: int
:return: the stride in bytes for the given dimension.
| iolink.iolink.Indexer.dimension_count | ( | self | ) |
The number of dimensions managed by this indexer.
| iolink.iolink.Indexer.dtype | ( | self | ) |
:rtype: :py:class:`DataType`
:return: the data type of this Indexer.
| iolink.iolink.Indexer.element_count | ( | self | ) |
Returns the number of elements managed by this Indexer.
| iolink.iolink.Indexer.is_continuous | ( | self | ) |
Checks if the indexed elements are contiguous.
Elements are considered contiguous if they follow each other without any padding.
:rtype: boolean
:return: true if the indexed elements are continuous, false otherwise.
| iolink.iolink.Indexer.layout | ( | self, | |
| * | args | ||
| ) |
*Overload 1:*
Return the layout dimension order.
|
*Overload 2:*
Return the dimension index of the nth one in order.
:type index: int
:param index: Index of the order dimension index.
| iolink.iolink.Indexer.offset | ( | self, | |
| index | |||
| ) |
Return the computed 1D offset corresponding to indexed sample in multi dimensional array.
:type index: :py:class:`VectorXu64`
:param index: The element's position for which offset must be computed.
Deprecated: Deprecated in 1.8, will be dropped in 2.0, you should use the
byteOffset method instead.
| iolink.iolink.Indexer.shape | ( | self, | |
| * | args | ||
| ) |
*Overload 1:*
Return the shape
|
*Overload 2:*
Return the current size for given dimension.
:type index: int
:param index: Index of the dimension to consider
| iolink.iolink.Indexer.stride | ( | self, | |
| * | args | ||
| ) |
*Overload 1:*
Return the stride
Deprecated: Deprecated in 1.8, will be dropped in 2.0, you should use the
byteStride method instead.
|
*Overload 2:*
Return the current stride for given dimension.
:type index: int
:param index: Index of the dimension to consider
Deprecated: Deprecated in 1.8, will be dropped in 2.0, you should use the
byteStride method instead.