PartitionedArray of arbitrary length partitions. More...
#include <IrregularlyPartitionedArray.h>
Public Member Functions | |
IrregularlyPartitionedArray (const ContentPtrVec &partitions, const std::vector< int64_t > stops) | |
const std::vector< int64_t > | stops () const |
Logical index where each partition ends. More... | |
int64_t | start (int64_t partitionid) const override |
Logical starting index for a given partitionid. More... | |
int64_t | stop (int64_t partitionid) const override |
Logical stopping index for a given partitionid. More... | |
void | partitionid_index_at (int64_t at, int64_t &partitionid, int64_t &index) const override |
Gets the partitionid and index for a given logical position in the full array, without handling negative indexing or bounds-checking. More... | |
PartitionedArrayPtr | repartition (const std::vector< int64_t > &stops) const override |
Returns this array with a specified (irregular) partitioning. More... | |
const std::string | classname () const override |
User-friendly name of this class. More... | |
const std::string | tostring () const override |
Returns a string representation of this array (multi-line XML). More... | |
int64_t | length () const override |
The length of the full array, summed over all partitions. More... | |
const PartitionedArrayPtr | shallow_copy () const override |
Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers. More... | |
const PartitionedArrayPtr | copy_to (kernel::lib ptr_lib) const override |
Recursively copies components of the array from main memory to a GPU (if ptr_lib == kernel::lib::cuda ) or to main memory (if ptr_lib == kernel::lib::cpu ) if those components are not already there. More... | |
![]() | |
PartitionedArray (const ContentPtrVec &partitions) | |
virtual | ~PartitionedArray () |
Virtual destructor acts as a first non-inline virtual function that determines a specific translation unit in which vtable shall be emitted. More... | |
const ContentPtrVec | partitions () const |
The partitions as a std::vector<std::shared_ptr<Content>> . More... | |
int64_t | numpartitions () const |
The number of partitions in this array. More... | |
const ContentPtr | partition (int64_t partitionid) const |
Returns a single partition as a std::shared_ptr<Content> . More... | |
virtual int64_t | start (int64_t partitionid) const =0 |
Logical starting index for a given partitionid. More... | |
virtual int64_t | stop (int64_t partitionid) const =0 |
Logical stopping index for a given partitionid. More... | |
virtual void | partitionid_index_at (int64_t at, int64_t &partitionid, int64_t &index) const =0 |
Gets the partitionid and index for a given logical position in the full array, without handling negative indexing or bounds-checking. More... | |
virtual PartitionedArrayPtr | repartition (const std::vector< int64_t > &stops) const =0 |
Returns this array with a specified (irregular) partitioning. More... | |
virtual const std::string | classname () const =0 |
User-friendly name of this class. More... | |
virtual const std::string | tostring () const =0 |
Returns a string representation of this array (multi-line XML). More... | |
const std::string | tojson (bool pretty, int64_t maxdecimals) const |
Returns a JSON representation of this array. More... | |
void | tojson (FILE *destination, bool pretty, int64_t maxdecimals, int64_t buffersize) const |
Writes a JSON representation of this array to a destination file. More... | |
virtual int64_t | length () const =0 |
The length of the full array, summed over all partitions. More... | |
virtual const PartitionedArrayPtr | shallow_copy () const =0 |
Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers. More... | |
const ContentPtr | getitem_at (int64_t at) const |
Returns the element at a given position in the array, handling negative indexing and bounds-checking like Python. More... | |
const ContentPtr | getitem_at_nowrap (int64_t at) const |
Returns the element at a given position in the array, without handling negative indexing or bounds-checking. More... | |
const PartitionedArrayPtr | getitem_range (int64_t start, int64_t stop, int64_t step) const |
Subinterval of this array, handling negative indexing and bounds-checking like Python. More... | |
const PartitionedArrayPtr | getitem_range_nowrap (int64_t start, int64_t stop, int64_t step) const |
Subinterval of this array, without handling negative indexing or bounds-checking. More... | |
virtual const PartitionedArrayPtr | copy_to (kernel::lib ptr_lib) const =0 |
Recursively copies components of the array from main memory to a GPU (if ptr_lib == kernel::lib::cuda ) or to main memory (if ptr_lib == kernel::lib::cpu ) if those components are not already there. More... | |
Additional Inherited Members | |
![]() | |
const ContentPtrVec | partitions_ |
PartitionedArray of arbitrary length partitions.
IrregularlyPartitionedArray | ( | const ContentPtrVec & | partitions, |
const std::vector< int64_t > | stops | ||
) |
|
overridevirtual |
User-friendly name of this class.
Implements PartitionedArray.
|
overridevirtual |
Recursively copies components of the array from main memory to a GPU (if ptr_lib == kernel::lib::cuda
) or to main memory (if ptr_lib == kernel::lib::cpu
) if those components are not already there.
Implements PartitionedArray.
|
overridevirtual |
The length of the full array, summed over all partitions.
Implements PartitionedArray.
|
overridevirtual |
Gets the partitionid and index for a given logical position in the full array, without handling negative indexing or bounds-checking.
Implements PartitionedArray.
|
overridevirtual |
Returns this array with a specified (irregular) partitioning.
Implements PartitionedArray.
|
overridevirtual |
Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers.
See also #deep_copy.
Implements PartitionedArray.
|
overridevirtual |
Logical starting index for a given partitionid.
Implements PartitionedArray.
|
overridevirtual |
Logical stopping index for a given partitionid.
Implements PartitionedArray.
const std::vector< int64_t > stops | ( | ) | const |
Logical index where each partition ends.
An IrregularlyPartitionedArray could be described in terms of ListOffsetArray::offsets
, but the first entry would always be zero. Hence, ListArray::stops
is sufficient.
|
overridevirtual |
Returns a string representation of this array (multi-line XML).
Although this XML string has detail about every node in the tree, it does not show all elements in the array buffers and therefore does not scale with the size of the dataset (i.e. it is safe to print to the screen).
Thus, it's also not a storage format: see tojson.
Implements PartitionedArray.