33#ifndef GKO_PUBLIC_CORE_MATRIX_ROW_GATHERER_HPP_
34#define GKO_PUBLIC_CORE_MATRIX_ROW_GATHERER_HPP_
43#include <ginkgo/core/base/array.hpp>
44#include <ginkgo/core/base/exception.hpp>
45#include <ginkgo/core/base/exception_helpers.hpp>
46#include <ginkgo/core/base/executor.hpp>
47#include <ginkgo/core/base/lin_op.hpp>
48#include <ginkgo/core/base/types.hpp>
49#include <ginkgo/core/base/utils.hpp>
71template <
typename IndexType =
int32>
78 using index_type = IndexType;
110 std::shared_ptr<const Executor> exec,
const dim<2>& size,
111 gko::detail::const_array_view<IndexType>&& row_idxs)
115 return std::unique_ptr<const RowGatherer>(
new RowGatherer{
116 exec, size, gko::detail::array_const_cast(std::move(row_idxs))});
135 RowGatherer(std::shared_ptr<const Executor> exec,
const dim<2>& size)
136 : EnableLinOp<RowGatherer>(exec, size), row_idxs_(exec, size[0])
153 template <
typename IndicesArray>
154 RowGatherer(std::shared_ptr<const Executor> exec,
const dim<2>& size,
156 : EnableLinOp<RowGatherer>(exec, size),
162 void apply_impl(
const LinOp*
in, LinOp*
out)
const override;
164 void apply_impl(
const LinOp* alpha,
const LinOp*
in,
const LinOp* beta,
165 LinOp*
out)
const override;
This mixin implements a static create() method on ConcreteType that dynamically allocates the memory,...
Definition polymorphic_object.hpp:776
The EnableLinOp mixin can be used to provide sensible default implementations of the majority of the ...
Definition lin_op.hpp:908
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
Definition lin_op.hpp:146
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
RowGatherer is a matrix "format" which stores the gather indices arrays which can be used to gather r...
Definition row_gatherer.hpp:73
static std::unique_ptr< const RowGatherer > create_const(std::shared_ptr< const Executor > exec, const dim< 2 > &size, gko::detail::const_array_view< IndexType > &&row_idxs)
Creates a constant (immutable) RowGatherer matrix from a constant array.
Definition row_gatherer.hpp:109
index_type * get_row_idxs() noexcept
Returns a pointer to the row index array for gathering.
Definition row_gatherer.hpp:85
const index_type * get_const_row_idxs() const noexcept
Returns a pointer to the row index array for gathering.
Definition row_gatherer.hpp:94
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
A type representing the dimensions of a multidimensional object.
Definition dim.hpp:55