Represents an array of integers in a slice (possibly converted from an array of booleans). More...
#include <Slice.h>
Public Member Functions | |
SliceArrayOf (const IndexOf< T > &index, const std::vector< int64_t > &shape, const std::vector< int64_t > &strides, bool frombool) | |
Creates a SliceArrayOf from a full set of parameters. More... | |
const IndexOf< T > | index () const |
A flattened version of the array used for slicing. More... | |
const std::vector< int64_t > | shape () const |
Number of elements in each dimension, like NumPy's array shape. More... | |
const std::vector< int64_t > | strides () const |
Length of each dimension in number of items. The length of strides must match the length of shape . More... | |
bool | frombool () const |
If true , this integer array of positions was derived from a boolean array mask (from NumPy's nonzero or equivalent); false otherwise. More... | |
const int64_t | length () const |
The length of the logical array: shape[0] . More... | |
int64_t | ndim () const |
The number of dimensions: shape.size() . More... | |
const SliceItemPtr | shallow_copy () const override |
Copies this node without copying any associated arrays. More... | |
const std::string | tostring () const override |
Returns a string representation of this slice item (single-line custom format). More... | |
const std::string | tostring_part () const |
bool | preserves_type (const Index64 &advanced) const override |
Returns true if this slice would preserve an array's slice and therefore should pass on Content::parameters. More... | |
virtual bool | referentially_equal (const SliceItemPtr &other) const override |
Returns true if this slice item has all the same buffers and parameters as other ; false otherwise. More... | |
const IndexOf< T > | ravel () const |
Returns a one-dimensional contiguous version of the array, like NumPy's ravel. More... | |
![]() | |
virtual | ~SliceItem () |
Virtual destructor acts as a first non-inline virtual function that determines a specific translation unit in which vtable shall be emitted. More... | |
Represents an array of integers in a slice (possibly converted from an array of booleans).
Currently, the only type specialization is T = int64_t
.
SliceArrayOf | ( | const IndexOf< T > & | index, |
const std::vector< int64_t > & | shape, | ||
const std::vector< int64_t > & | strides, | ||
bool | frombool | ||
) |
Creates a SliceArrayOf from a full set of parameters.
index | A flattened version of the array used for slicing. If the original array was multidimensional, the shape/strides are stored separately. |
shape | Number of elements in each dimension, like NumPy's array shape. Note that unlike NumpyArray::shape, the integer type is int64_t , rather than ssize_t , and it must be at least one-dimensional. |
strides | Length of each dimension in number of items. The length of strides must match the length of shape . Note that unlike NumpyArray::strides, the integer type is int64_t , rather than ssize_t , and it quantifies the number of items, not the number of bytes. |
frombool | If true , this integer array of positions was derived from a boolean array mask (via numpy.nonzero or equivalent); false otherwise. |
bool frombool | ( | ) | const |
If true
, this integer array of positions was derived from a boolean array mask (from NumPy's nonzero or equivalent); false
otherwise.
const IndexOf<T> index | ( | ) | const |
A flattened version of the array used for slicing.
If the original array was multidimensional, the shape/strides are stored separately.
const int64_t length | ( | ) | const |
The length of the logical array: shape[0]
.
If the array is one-dimensional, this is equal to array.length()
.
int64_t ndim | ( | ) | const |
The number of dimensions: shape.size()
.
|
overridevirtual |
Returns true
if this slice would preserve an array's slice and therefore should pass on Content::parameters.
advanced | The index that is passed through Content::getitem_next. |
This is true
for SliceArrayOf if advanced.length() == 0
, false
otherwise.
Implements SliceItem.
const IndexOf<T> ravel | ( | ) | const |
Returns a one-dimensional contiguous version of the array, like NumPy's ravel.
|
overridevirtual |
Returns true
if this slice item has all the same buffers and parameters as other
; false
otherwise.
other | The slice item to compare this with. |
Implements SliceItem.
|
overridevirtual |
Copies this node without copying any associated arrays.
Implements SliceItem.
const std::vector<int64_t> shape | ( | ) | const |
Number of elements in each dimension, like NumPy's array shape.
Note that unlike NumpyArray::shape, the integer type is int64_t
, rather than ssize_t
, and it must be at least one-dimensional.
const std::vector<int64_t> strides | ( | ) | const |
Length of each dimension in number of items. The length of strides must match the length of shape
.
Note that unlike NumpyArray::strides, the integer type is int64_t
, rather than ssize_t
, and it quantifies the number of items, not the number of bytes.
|
overridevirtual |
Returns a string representation of this slice item (single-line custom format).
Implements SliceItem.
const std::string tostring_part | ( | ) | const |