Awkward Array: SliceArrayOf< T > Class Template Reference

Loading...
Searching...
No Matches
Public Member Functions | List of all members
SliceArrayOf< T > Class Template Reference

Represents an array of integers in a slice (possibly converted from an array of booleans). More...

`#include <Slice.h>`

Inheritance diagram for SliceArrayOf< T >:

## 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...
Public Member Functions inherited from SliceItem
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...
virtual const SliceItemPtr | shallow_copy () const =0
| Copies this node without copying any associated arrays. More...
virtual const std::string | tostring () const =0
| Returns a string representation of this slice item (single-line custom format). More...
virtual bool | preserves_type (const Index64 &advanced) const =0
| 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 =0
| Returns `true` if this slice item has all the same buffers and parameters as `other`; `false` otherwise. More...

## Detailed Description

template<typename T>
class awkward::SliceArrayOf< T >

Represents an array of integers in a slice (possibly converted from an array of booleans).

Currently, the only type specialization is `T = int64_t`.

## Constructor & Destructor Documentation

## ◆ SliceArrayOf()

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.

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.

## Member Function Documentation

## ◆ frombool()

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.

## ◆ index()

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.

## ◆ length()

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()`.

## ◆ ndim()

int64_t ndim | ( |  | ) | const

The number of dimensions: `shape.size()`.

## ◆ preserves_type()

bool preserves_type | ( | const Index64 & | advanced | ) | const
| overridevirtual

Returns `true` if this slice would preserve an array's slice and therefore should pass on `Content::parameters`.

Parameters

  advanced | The index that is passed through `Content::getitem_next`.

This is `true` for SliceArrayOf if `advanced.length() == 0`, `false` otherwise.

Implements SliceItem.

## ◆ ravel()

const IndexOf< T > ravel | ( |  | ) | const

Returns a one-dimensional contiguous version of the array, like NumPy's ravel.

## ◆ referentially_equal()

virtual bool referentially_equal | ( | const SliceItemPtr & | other | ) | const
| overridevirtual

Returns `true` if this slice item has all the same buffers and parameters as `other`; `false` otherwise.

Parameters

  other | The slice item to compare this with.

Implements SliceItem.

## ◆ shallow_copy()

const SliceItemPtr shallow_copy | ( |  | ) | const
| overridevirtual

Copies this node without copying any associated arrays.

Implements SliceItem.

## ◆ shape()

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.

## ◆ strides()

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.

## ◆ tostring()

const std::string tostring | ( |  | ) | const
| overridevirtual

Returns a string representation of this slice item (single-line custom format).

Implements SliceItem.

## ◆ tostring_part()

const std::string tostring_part | ( |  | ) | const

The documentation for this class was generated from the following file:

- include/awkward/Slice.h