Ginkgo: gko::segmented_array< T > Struct Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::segmented_array< T > Struct Template Reference

A minimal interface for a segmented array. More...

`#include <ginkgo/core/base/segmented_array.hpp>`

Inheritance diagram for gko::segmented_array< T >:
[legend]

## Public Member Functions
| segmented_array (std::shared_ptr< const Executor > exec)
| Create an empty segmented array.
| segmented_array (std::shared_ptr< const Executor > exec, const segmented_array &other)
| Copies a segmented array to a different executor.
| segmented_array (std::shared_ptr< const Executor > exec, segmented_array &&other)
| Moves a segmented array to a different executor.
| segmented_array (const segmented_array &other)
| segmented_array (segmented_array &&other) noexcept(false)
segmented_array & | operator= (const segmented_array &other)
segmented_array & | operator= (segmented_array &&) noexcept(false)
size_type | get_size () const
| Get the total size of the stored buffer.
size_type | get_segment_count () const
| Get the number of segments.
T * | get_flat_data ()
| Access to the flat buffer.
const T * | get_const_flat_data () const
| Const-access to the flat buffer.
const gko::array< int64 > & | get_offsets () const
| Access to the segment offsets.
std::shared_ptr< const Executor > | get_executor () const
| Access the executor.

## Static Public Member Functions
static segmented_array | create_from_sizes (const gko::array< int64 > &sizes)
| Creates an uninitialized segmented array with predefined segment sizes.
static segmented_array | create_from_sizes (gko::array< T > buffer, const gko::array< int64 > &sizes)
| Creates a segmented array from a flat buffer and segment sizes.
static segmented_array | create_from_offsets (gko::array< int64 > offsets)
| Creates an uninitialized segmented array from offsets.
static segmented_array | create_from_offsets (gko::array< T > buffer, gko::array< int64 > offsets)
| Creates a segmented array from a flat buffer and offsets.

## Detailed Description

template<typename T>
struct gko::segmented_array< T >

A minimal interface for a segmented array.

The segmented array is stored as a flat buffer with an offsets array. The segment i contains the index range [offset[i], offset[i + 1]) of the flat buffer.

Template Parameters

  T | value type stored in the arrays

## Constructor & Destructor Documentation

## ◆ segmented_array() [1/3]

template<typename T>

gko::segmented_array< T >::segmented_array | ( | std::shared_ptr< const Executor > | exec | ) |
| explicit

Create an empty segmented array.

Parameters

  exec | executor for storage arrays

Referenced by create_from_offsets(), create_from_offsets(), create_from_sizes(), create_from_sizes(), get_executor(), segmented_array(), and segmented_array().

## ◆ segmented_array() [2/3]

template<typename T>

gko::segmented_array< T >::segmented_array | ( | std::shared_ptr< const Executor > | exec,
|  | const segmented_array< T > & | other )

Copies a segmented array to a different executor.

Parameters

  exec | the executor to copy to
  other | the segmented array to copy from

References segmented_array().

## ◆ segmented_array() [3/3]

template<typename T>

gko::segmented_array< T >::segmented_array | ( | std::shared_ptr< const Executor > | exec,
|  | segmented_array< T > && | other )

Moves a segmented array to a different executor.

Parameters

  exec | the executor to move to
  other | the segmented array to move from

References segmented_array().

## Member Function Documentation

## ◆ create_from_offsets() [1/2]

template<typename T>

segmented_array gko::segmented_array< T >::create_from_offsets | ( | gko::array< int64 > | offsets | ) |
| static

Creates an uninitialized segmented array from offsets.

Parameters

  offsets | the index offsets for each segment, and the total size of the buffer as last element

References segmented_array().

Referenced by get_executor().

## ◆ create_from_offsets() [2/2]

template<typename T>

segmented_array gko::segmented_array< T >::create_from_offsets | ( | gko::array< T > | buffer,
|  | gko::array< int64 > | offsets )
| static

Creates a segmented array from a flat buffer and offsets.

Parameters

  buffer | the flat buffer whose size has to match the last element of offsets
  offsets | the index offsets for each segment, and the total size of the buffer as last element

References segmented_array().

## ◆ create_from_sizes() [1/2]

template<typename T>

segmented_array gko::segmented_array< T >::create_from_sizes | ( | const gko::array< int64 > & | sizes | ) |
| static

Creates an uninitialized segmented array with predefined segment sizes.

Parameters

  exec | executor for storage arrays
  sizes | the sizes of each segment

References segmented_array().

## ◆ create_from_sizes() [2/2]

template<typename T>

segmented_array gko::segmented_array< T >::create_from_sizes | ( | gko::array< T > | buffer,
|  | const gko::array< int64 > & | sizes )
| static

Creates a segmented array from a flat buffer and segment sizes.

Parameters

  buffer | the flat buffer whose size has to match the sum of sizes
  sizes | the sizes of each segment

References segmented_array().

## ◆ get_const_flat_data()

template<typename T>

const T * gko::segmented_array< T >::get_const_flat_data | ( |  | ) | const

Const-access to the flat buffer.

Returns
  the flat buffer

References get_const_flat_data().

Referenced by get_const_flat_data().

## ◆ get_executor()

template<typename T>

std::shared_ptr< const Executor > gko::segmented_array< T >::get_executor | ( |  | ) | const

Access the executor.

Returns
  the executor

References create_from_offsets(), get_executor(), get_offsets(), and segmented_array().

Referenced by get_executor().

## ◆ get_flat_data()

template<typename T>

T * gko::segmented_array< T >::get_flat_data | ( |  | ) |

Access to the flat buffer.

Returns
  the flat buffer

References get_flat_data().

Referenced by get_flat_data().

## ◆ get_offsets()

template<typename T>

const gko::array< int64 > & gko::segmented_array< T >::get_offsets | ( |  | ) | const

Access to the segment offsets.

Returns
  the segment offsets

References get_offsets().

Referenced by get_executor(), and get_offsets().

## ◆ get_segment_count()

template<typename T>

size_type gko::segmented_array< T >::get_segment_count | ( |  | ) | const

Get the number of segments.

Returns
  the number of segments

References get_segment_count().

Referenced by get_segment_count().

## ◆ get_size()

template<typename T>

size_type gko::segmented_array< T >::get_size | ( |  | ) | const

Get the total size of the stored buffer.

Returns
  the total size of the stored buffer.

References get_size().

Referenced by get_size().

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

- ginkgo/core/base/segmented_array.hpp