Loading...
Searching...
No Matches
IrregularlyPartitionedArray Class Reference

PartitionedArray of arbitrary length partitions. More...

#include <IrregularlyPartitionedArray.h>

Inheritance diagram for IrregularlyPartitionedArray:
PartitionedArray

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.
 
int64_t start (int64_t partitionid) const override
 Logical starting index for a given partitionid.
 
int64_t stop (int64_t partitionid) const override
 Logical stopping index for a given partitionid.
 
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.
 
PartitionedArrayPtr repartition (const std::vector< int64_t > &stops) const override
 Returns this array with a specified (irregular) partitioning.
 
const std::string classname () const override
 User-friendly name of this class.
 
const std::string tostring () const override
 Returns a string representation of this array (multi-line XML).
 
int64_t length () const override
 The length of the full array, summed over all partitions.
 
const PartitionedArrayPtr shallow_copy () const override
 Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers.
 
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.
 
- Public Member Functions inherited from PartitionedArray
 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.
 
const ContentPtrVec partitions () const
 The partitions as a std::vector<std::shared_ptr<Content>>.
 
int64_t numpartitions () const
 The number of partitions in this array.
 
const ContentPtr partition (int64_t partitionid) const
 Returns a single partition as a std::shared_ptr<Content>.
 
virtual int64_t start (int64_t partitionid) const =0
 Logical starting index for a given partitionid.
 
virtual int64_t stop (int64_t partitionid) const =0
 Logical stopping index for a given partitionid.
 
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.
 
virtual PartitionedArrayPtr repartition (const std::vector< int64_t > &stops) const =0
 Returns this array with a specified (irregular) partitioning.
 
virtual const std::string classname () const =0
 User-friendly name of this class.
 
virtual const std::string tostring () const =0
 Returns a string representation of this array (multi-line XML).
 
const std::string tojson (bool pretty, int64_t maxdecimals) const
 Returns a JSON representation of this array.
 
void tojson (FILE *destination, bool pretty, int64_t maxdecimals, int64_t buffersize) const
 Writes a JSON representation of this array to a destination file.
 
virtual int64_t length () const =0
 The length of the full array, summed over all partitions.
 
virtual const PartitionedArrayPtr shallow_copy () const =0
 Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Additional Inherited Members

- Protected Attributes inherited from PartitionedArray
const ContentPtrVec partitions_
 

Detailed Description

PartitionedArray of arbitrary length partitions.

Constructor & Destructor Documentation

◆ IrregularlyPartitionedArray()

IrregularlyPartitionedArray ( const ContentPtrVec partitions,
const std::vector< int64_t >  stops 
)

Member Function Documentation

◆ classname()

const std::string classname ( ) const
overridevirtual

User-friendly name of this class.

Implements PartitionedArray.

◆ copy_to()

const PartitionedArrayPtr copy_to ( kernel::lib  ptr_lib) const
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.

◆ length()

int64_t length ( ) const
overridevirtual

The length of the full array, summed over all partitions.

Implements PartitionedArray.

◆ partitionid_index_at()

void partitionid_index_at ( int64_t  at,
int64_t &  partitionid,
int64_t &  index 
) const
overridevirtual

Gets the partitionid and index for a given logical position in the full array, without handling negative indexing or bounds-checking.

Implements PartitionedArray.

◆ repartition()

PartitionedArrayPtr repartition ( const std::vector< int64_t > &  stops) const
overridevirtual

Returns this array with a specified (irregular) partitioning.

Implements PartitionedArray.

◆ shallow_copy()

const PartitionedArrayPtr shallow_copy ( ) const
overridevirtual

Copies this node without copying any nodes hierarchically nested within it or any array/index/identity buffers.

See also #deep_copy.

Implements PartitionedArray.

◆ start()

int64_t start ( int64_t  partitionid) const
overridevirtual

Logical starting index for a given partitionid.

Implements PartitionedArray.

◆ stop()

int64_t stop ( int64_t  partitionid) const
overridevirtual

Logical stopping index for a given partitionid.

Implements PartitionedArray.

◆ stops()

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.

◆ tostring()

const std::string tostring ( ) const
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.


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