|
Ginkgo
Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_BASE_DEVICE_MATRIX_DATA_HPP_
6 #define GKO_PUBLIC_CORE_BASE_DEVICE_MATRIX_DATA_HPP_
9 #include <ginkgo/core/base/array.hpp>
10 #include <ginkgo/core/base/dim.hpp>
11 #include <ginkgo/core/base/exception_helpers.hpp>
12 #include <ginkgo/core/base/executor.hpp>
13 #include <ginkgo/core/base/matrix_data.hpp>
14 #include <ginkgo/core/base/temporary_clone.hpp>
35 template <
typename ValueType,
typename IndexType>
38 using value_type = ValueType;
39 using index_type = IndexType;
82 template <
typename InputValueType,
typename RowIndexType,
83 typename ColIndexType>
85 "explicitly construct the gko::array arguments instead of passing "
88 std::initializer_list<RowIndexType> row_idxs,
89 std::initializer_list<ColIndexType> col_idxs,
90 std::initializer_list<InputValueType> values)
115 std::shared_ptr<const Executor> exec,
const host_type& data);
160 GKO_DEPRECATED(
"use get_num_stored_elements()")
266 template <
typename ValueType,
typename IndexType>
268 static std::unique_ptr<device_matrix_data<ValueType, IndexType>> create(
269 std::shared_ptr<const Executor> exec,
273 return std::make_unique<device_matrix_data<ValueType, IndexType>>(
274 std::move(exec), *ptr);
276 return std::make_unique<device_matrix_data<ValueType, IndexType>>(
283 template <
typename ValueType,
typename IndexType>
284 struct temporary_clone_helper<const device_matrix_data<ValueType, IndexType>> {
285 static std::unique_ptr<const device_matrix_data<ValueType, IndexType>>
286 create(std::shared_ptr<const Executor> exec,
287 const device_matrix_data<ValueType, IndexType>* ptr,
bool)
289 return std::make_unique<const device_matrix_data<ValueType, IndexType>>(
290 std::move(exec), *ptr);
295 template <
typename ValueType,
typename IndexType>
296 class copy_back_deleter<device_matrix_data<ValueType, IndexType>>
297 :
public copy_back_deleter_from_assignment<
298 device_matrix_data<ValueType, IndexType>> {
300 using copy_back_deleter_from_assignment<device_matrix_data<
301 ValueType, IndexType>>::copy_back_deleter_from_assignment;
309 #endif // GKO_PUBLIC_CORE_BASE_DEVICE_MATRIX_DATA_HPP_
host_type copy_to_host() const
Copies the device_matrix_data entries to the host to return a regular matrix_data object with the sam...
value_type * get_values()
Returns a pointer to the value array.
Definition: device_matrix_data.hpp:209
const index_type * get_const_row_idxs() const
Returns a pointer to the constant row index array.
Definition: device_matrix_data.hpp:182
Type used to store nonzeros.
Definition: matrix_data.hpp:61
std::shared_ptr< const Executor > get_executor() const
Returns the executor used to store the device_matrix_data entries.
Definition: device_matrix_data.hpp:143
index_type * get_row_idxs()
Returns a pointer to the row index array.
Definition: device_matrix_data.hpp:175
static device_matrix_data create_from_host(std::shared_ptr< const Executor > exec, const host_type &data)
Creates a device_matrix_data object from the given host data on the given executor.
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:108
void remove_zeros()
Removes all zero entries from the storage.
arrays empty_out()
Moves out the internal arrays of the device_matrix_data object and resets it to an empty 0x0 matrix.
void sum_duplicates()
Sums up all duplicate entries pointing to the same non-zero location.
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
size_type get_num_elems() const
Returns the number of stored elements of the matrix.
Definition: device_matrix_data.hpp:161
index_type * get_col_idxs()
Returns a pointer to the column index array.
Definition: device_matrix_data.hpp:192
This structure is used as an intermediate data type to store a sparse matrix.
Definition: matrix_data.hpp:127
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition: array.hpp:674
dim< 2 > get_size() const
Returns the dimensions of the matrix.
Definition: device_matrix_data.hpp:153
const value_type * get_const_values() const
Returns a pointer to the constant value array.
Definition: device_matrix_data.hpp:216
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor associated with the array.
Definition: array.hpp:690
size_type get_num_stored_elements() const
Returns the number of stored elements of the matrix.
Definition: device_matrix_data.hpp:168
The first step in using the Ginkgo library consists of creating an executor.
Definition: executor.hpp:616
const value_type * get_const_data() const noexcept
Returns a constant pointer to the block of memory used to store the elements of the array.
Definition: array.hpp:683
void sort_row_major()
Sorts the matrix entries in row-major order This means that they will be sorted by row index first,...
size_type get_size() const noexcept
Returns the number of elements in the array.
Definition: array.hpp:657
device_matrix_data(std::shared_ptr< const Executor > exec, dim< 2 > size={}, size_type num_entries=0)
Initializes a new device_matrix_data object.
This type is a device-side equivalent to matrix_data.
Definition: device_matrix_data.hpp:36
void resize_and_reset(size_type new_num_entries)
Resizes the internal storage to the given number of stored matrix entries.
const index_type * get_const_col_idxs() const
Returns a pointer to the constant column index array.
Definition: device_matrix_data.hpp:199
Stores the internal arrays of a device_matrix_data object.
Definition: device_matrix_data.hpp:241