atlas::linalg::SparseMatrixStorage class

SparseMatrixStorage Storage class based on atlas::array::Array with GPU offload capability This class contains only the data and no operators, iterators, or special sparse matrix construction from triplets etc.

The construction is handled via SparseMatrixConvertor class. Examples:

To construct it, taking ownership of a constructed Eigen::SparseMatrix

SparseMatrixStorage s = make_sparse_matrix_storage(std::move(eigen_matrix));

To construct it, taking a copy of a constructed Eigen::SparseMatrix

SparseMatrixStorage s = make_sparse_matrix_storage(eigen_matrix);

To construct it, taking ownership of a constructed eckit::linalg::SparseMatrix, avoiding copies if data types match

SparseMatrixStorage s = make_sparse_matrix_storage(std::move(eckit_matrix));

To construct it, taking a copy of a constructed eckit::linalg::SparseMatrix (no std::move)

SparseMatrixStorage s = make_sparse_matrix_storage(eckit_matrix);

It is also possible to initialise empty and move into it at later stage:

SparseMatrixStorage s;
s = make_sparse_matrix_storage(eckit_matrix);

To construct it, taking a single precision copy of a constructed eckit::linalg::SparseMatrix

s = make_sparse_matrix_storage<float>(eckit_matrix);

Public static functions

static auto make(std::size_t rows, std::size_t cols, std::size_t nnz, std::unique_ptr<atlas::array::Array>&& value, std::unique_ptr<atlas::array::Array>&& inner, std::unique_ptr<atlas::array::Array>&& outer, std::any&& storage) -> SparseMatrixStorage

Constructors, destructors, conversion operators

~SparseMatrixStorage() defaulted virtual
SparseMatrixStorage() defaulted
Default constructor.
SparseMatrixStorage(SparseMatrixStorage&& other)
Move constructor, takes ownership!
SparseMatrixStorage(const SparseMatrixStorage& other)
Copy constructor, makes copy!
template<typename Value, typename Index>
SparseMatrixStorage(const SparseMatrixView<Value, Index>& host_view)
Copy from a SparseMatrixView.

Public functions

auto operator=(SparseMatrixStorage&& other) -> SparseMatrixStorage&
Move assign from other SparseMatrixStorage, takes ownership!
auto operator=(const SparseMatrixStorage& other) -> SparseMatrixStorage&
Copy assign from other SparseMatrixStorage, takes ownership!
auto empty() const -> bool
Empty if rows and cols are zero.
auto footprint() const -> std::size_t
Footprint in bytes in host memory space.
auto value() const -> const atlas::array::Array&
auto outer() const -> const atlas::array::Array&
auto inner() const -> const atlas::array::Array&
auto rows() const -> std::size_t
auto cols() const -> std::size_t
auto nnz() const -> std::size_t
void updateDevice() const
void updateHost() const
auto hostNeedsUpdate() const -> bool
auto deviceNeedsUpdate() const -> bool
void setHostNeedsUpdate(bool v) const
void setDeviceNeedsUpdate(bool v) const
auto deviceAllocated() const -> bool
void allocateDevice() const
void deallocateDevice() const
void swap(SparseMatrixStorage& other)
auto contains(DataType value_type, DataType index_type) -> bool
template<typename value_type, typename index_type>
auto contains() -> bool