33#ifndef GKO_PUBLIC_CORE_MATRIX_BATCH_ELL_HPP_
34#define GKO_PUBLIC_CORE_MATRIX_BATCH_ELL_HPP_
37#include <initializer_list>
41#include <ginkgo/core/base/array.hpp>
42#include <ginkgo/core/base/batch_lin_op.hpp>
43#include <ginkgo/core/base/batch_multi_vector.hpp>
44#include <ginkgo/core/base/executor.hpp>
45#include <ginkgo/core/base/mtx_io.hpp>
46#include <ginkgo/core/base/range_accessors.hpp>
47#include <ginkgo/core/base/types.hpp>
48#include <ginkgo/core/base/utils.hpp>
49#include <ginkgo/core/matrix/ell.hpp>
79template <
typename ValueType = default_precision,
typename IndexType =
int32>
83 public ConvertibleTo<Ell<next_precision<ValueType>, IndexType>> {
88 static_assert(std::is_same<IndexType, int32>::value,
89 "IndexType must be a 32 bit integer");
95 using value_type = ValueType;
96 using index_type = IndexType;
170 return num_elems_per_row_;
270 gko::detail::const_array_view<value_type>&& values,
271 gko::detail::const_array_view<index_type>&& col_idxs);
329 Ell(std::shared_ptr<const Executor> exec,
349 template <
typename ValuesArray,
typename IndicesArray>
350 Ell(std::shared_ptr<const Executor> exec,
const batch_dim<2>& size,
360 this->get_num_batch_items();
374 index_type num_elems_per_row_;
ConvertibleTo interface is used to mark that the implementer can be converted to the object of Result...
Definition polymorphic_object.hpp:499
This mixin implements a static create() method on ConcreteType that dynamically allocates the memory,...
Definition polymorphic_object.hpp:776
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:187
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition array.hpp:646
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:655
size_type get_num_elems() const noexcept
Returns the number of elements in the array.
Definition array.hpp:637
Definition batch_lin_op.hpp:88
The EnableBatchLinOp mixin can be used to provide sensible default implementations of the majority of...
Definition batch_lin_op.hpp:281
MultiVector stores multiple vectors in a batched fashion and is useful for batched operations.
Definition batch_multi_vector.hpp:85
Ell is a sparse matrix format that stores the same number of nonzeros in each row,...
Definition batch_ell.hpp:83
const Ell * apply(ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x) const
const index_type * get_const_col_idxs_for_item(size_type batch_id) const noexcept
Returns a pointer to the array of col_idxs of the matrix.
Definition batch_ell.hpp:216
static std::unique_ptr< const Ell > create_const(std::shared_ptr< const Executor > exec, const batch_dim< 2 > &sizes, const index_type num_elems_per_row, gko::detail::const_array_view< value_type > &&values, gko::detail::const_array_view< index_type > &&col_idxs)
Creates a constant (immutable) batch ell matrix from a constant array.
index_type get_num_stored_elements_per_row() const noexcept
Returns the number of elements per row explicitly stored.
Definition batch_ell.hpp:168
value_type * get_values() noexcept
Returns a pointer to the array of values of the matrix.
Definition batch_ell.hpp:129
Ell * apply(ptr_param< const MultiVector< value_type > > b, ptr_param< MultiVector< value_type > > x)
Apply the matrix to a multi-vector.
const index_type * get_const_col_idxs() const noexcept
Returns a pointer to the array of column indices of the matrix.
Definition batch_ell.hpp:157
size_type get_num_elements_per_item() const noexcept
Returns the number of stored elements in each batch item.
Definition batch_ell.hpp:190
const Ell * apply(ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x) const
const value_type * get_const_values() const noexcept
Returns a pointer to the array of values of the matrix.
Definition batch_ell.hpp:138
std::unique_ptr< const unbatch_type > create_const_view_for_item(size_type item_id) const
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object...
size_type get_num_stored_elements() const noexcept
Returns the number of elements explicitly stored in the batch matrix, cumulative across all the batch...
Definition batch_ell.hpp:180
Ell * apply(ptr_param< const MultiVector< value_type > > alpha, ptr_param< const MultiVector< value_type > > b, ptr_param< const MultiVector< value_type > > beta, ptr_param< MultiVector< value_type > > x)
Apply the matrix to a multi-vector with a linear combination of the given input vector.
std::unique_ptr< unbatch_type > create_view_for_item(size_type item_id)
Creates a mutable view (of matrix::Ell type) of one item of the batch::matrix::Ell<value_type> object...
index_type * get_col_idxs() noexcept
Returns a pointer to the array of column indices of the matrix.
Definition batch_ell.hpp:148
index_type * get_col_idxs_for_item(size_type batch_id) noexcept
Returns a pointer to the array of col_idxs of the matrix.
Definition batch_ell.hpp:203
const value_type * get_const_values_for_item(size_type batch_id) const noexcept
Returns a pointer to the array of values of the matrix for a specific batch item.
Definition batch_ell.hpp:245
value_type * get_values_for_item(size_type batch_id) noexcept
Returns a pointer to the array of values of the matrix for a specific batch item.
Definition batch_ell.hpp:231
ELL is a matrix format where stride with explicit zeros is used such that all rows have the same numb...
Definition ell.hpp:89
This class is used for function parameters in the place of raw pointers.
Definition utils_helper.hpp:71
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition math.hpp:354
typename detail::next_precision_impl< T >::type next_precision
Obtains the next type in the singly-linked precision list.
Definition math.hpp:490
typename detail::to_complex_s< T >::type to_complex
Obtain the type which adds the complex of complex/scalar type or the template parameter of class by a...
Definition math.hpp:373
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:120
A type representing the dimensions of a multidimensional batch object.
Definition batch_dim.hpp:56
dim< dimensionality, dimension_type > get_common_size() const
Get the common size of the batch items.
Definition batch_dim.hpp:72
size_type get_num_batch_items() const
Get the number of batch items stored.
Definition batch_dim.hpp:65