5#ifndef GKO_PUBLIC_CORE_BASE_SEGMENTED_ARRAY_HPP_
6#define GKO_PUBLIC_CORE_BASE_SEGMENTED_ARRAY_HPP_
11#include <ginkgo/config.hpp>
12#include <ginkgo/core/base/array.hpp>
150 static std::unique_ptr<segmented_array<T>> create(
155 return std::make_unique<segmented_array<T>>(std::move(exec), *ptr);
157 return std::unique_ptr<segmented_array<T>>(
166 static std::unique_ptr<const segmented_array<T>> create(
170 return std::make_unique<segmented_array<T>>(std::move(exec), *ptr);
177 :
public copy_back_deleter_from_assignment<segmented_array<T>> {
179 using copy_back_deleter_from_assignment<
The first step in using the Ginkgo library consists of creating an executor.
Definition executor.hpp:615
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:166
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:113
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:90
const T * get_const_flat_data() const
Const-access to the flat buffer.
segmented_array(std::shared_ptr< const Executor > exec, const segmented_array &other)
Copies a segmented array to a different executor.
static segmented_array create_from_offsets(gko::array< T > buffer, gko::array< int64 > offsets)
Creates a segmented array from a flat buffer and offsets.
segmented_array(std::shared_ptr< const Executor > exec)
Create an empty segmented array.
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.
size_type get_segment_count() const
Get the number of segments.
segmented_array(std::shared_ptr< const Executor > exec, segmented_array &&other)
Moves a segmented array to a different executor.
T * get_flat_data()
Access to the flat buffer.
size_type get_size() const
Get the total size of the stored buffer.
std::shared_ptr< const Executor > get_executor() const
Access the executor.
static segmented_array create_from_sizes(const gko::array< int64 > &sizes)
Creates an uninitialized segmented array with predefined segment sizes.
const gko::array< int64 > & get_offsets() const
Access to the segment offsets.
static segmented_array create_from_offsets(gko::array< int64 > offsets)
Creates an uninitialized segmented array from offsets.