ginkgo/core/matrix/row_gatherer.hpp Source File

ginkgo/core/matrix/row_gatherer.hpp Source File#

Reference API: ginkgo/core/matrix/row_gatherer.hpp Source File
Reference API
row_gatherer.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_MATRIX_ROW_GATHERER_HPP_
6#define GKO_PUBLIC_CORE_MATRIX_ROW_GATHERER_HPP_
7
8
9#include <algorithm>
10#include <memory>
11#include <numeric>
12#include <vector>
13
14#include <ginkgo/core/base/array.hpp>
15#include <ginkgo/core/base/exception.hpp>
16#include <ginkgo/core/base/exception_helpers.hpp>
17#include <ginkgo/core/base/executor.hpp>
18#include <ginkgo/core/base/lin_op.hpp>
19#include <ginkgo/core/base/types.hpp>
20#include <ginkgo/core/base/utils.hpp>
21
22
23namespace gko {
24namespace matrix {
25
26
41template <typename IndexType = int32>
42class RowGatherer : public EnableLinOp<RowGatherer<IndexType>> {
44
45public:
46 using index_type = IndexType;
47
53 index_type* get_row_idxs() noexcept { return row_idxs_.get_data(); }
54
62 const index_type* get_const_row_idxs() const noexcept
63 {
64 return row_idxs_.get_const_data();
65 }
66
75 static std::unique_ptr<RowGatherer> create(
76 std::shared_ptr<const Executor> exec, const dim<2>& size = {});
77
92 static std::unique_ptr<RowGatherer> create(
93 std::shared_ptr<const Executor> exec, const dim<2>& size,
94 array<index_type> row_idxs);
95
106 static std::unique_ptr<const RowGatherer> create_const(
107 std::shared_ptr<const Executor> exec, const dim<2>& size,
108 gko::detail::const_array_view<IndexType>&& row_idxs);
109
110protected:
111 RowGatherer(std::shared_ptr<const Executor> exec, const dim<2>& size = {});
112
113 RowGatherer(std::shared_ptr<const Executor> exec, const dim<2>& size,
114 array<index_type> row_idxs);
115
116 void apply_impl(const LinOp* in, LinOp* out) const override;
117
118 void apply_impl(const LinOp* alpha, const LinOp* in, const LinOp* beta,
119 LinOp* out) const override;
120
121private:
122 gko::array<index_type> row_idxs_;
123};
124
125
126} // namespace matrix
127} // namespace gko
128
129
130#endif // GKO_PUBLIC_CORE_MATRIX_ROW_GATHERER_HPP_
Definition lin_op.hpp:878
Definition polymorphic_object.hpp:668
Definition lin_op.hpp:117
Definition array.hpp:166
value_type * get_data() noexcept
Definition array.hpp:673
const value_type * get_const_data() const noexcept
Definition array.hpp:682
Definition row_gatherer.hpp:42
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)
index_type * get_row_idxs() noexcept
Definition row_gatherer.hpp:53
static std::unique_ptr< RowGatherer > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size={})
const index_type * get_const_row_idxs() const noexcept
Definition row_gatherer.hpp:62
static std::unique_ptr< RowGatherer > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size, array< index_type > row_idxs)
The Ginkgo namespace.
Definition abstract_factory.hpp:20
Definition dim.hpp:26