Ginkgo Generated from branch based on main. Ginkgo version 1.11.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
nested_dissection.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_REORDER_NESTED_DISSECTION_HPP_
6#define GKO_PUBLIC_CORE_REORDER_NESTED_DISSECTION_HPP_
7
8
9#include <ginkgo/config.hpp>
10
11
12#if GKO_HAVE_METIS
13
14
15#include <memory>
16#include <unordered_map>
17
18#include <ginkgo/core/base/abstract_factory.hpp>
19#include <ginkgo/core/base/array.hpp>
20#include <ginkgo/core/base/dim.hpp>
21#include <ginkgo/core/base/lin_op.hpp>
22#include <ginkgo/core/base/polymorphic_object.hpp>
23#include <ginkgo/core/base/types.hpp>
24#include <ginkgo/core/matrix/csr.hpp>
25#include <ginkgo/core/matrix/permutation.hpp>
26
27
28namespace gko {
29namespace experimental {
35namespace reorder {
36
37
46template <typename ValueType, typename IndexType>
47class NestedDissection
48 : public EnablePolymorphicObject<NestedDissection<ValueType, IndexType>,
49 LinOpFactory>,
50 public EnablePolymorphicAssignment<
51 NestedDissection<ValueType, IndexType>> {
52 GKO_ASSERT_SUPPORTED_VALUE_AND_INDEX_TYPE;
53
54public:
55 struct parameters_type;
56 friend class EnablePolymorphicObject<NestedDissection<ValueType, IndexType>,
57 LinOpFactory>;
58 friend class enable_parameters_type<parameters_type,
59 NestedDissection<ValueType, IndexType>>;
60
61 using value_type = ValueType;
62 using index_type = IndexType;
63 using matrix_type = matrix::Csr<value_type, index_type>;
64 using permutation_type = matrix::Permutation<index_type>;
65
66 struct parameters_type
67 : public enable_parameters_type<
68 parameters_type, NestedDissection<ValueType, IndexType>> {
73 std::unordered_map<int, int> options;
74
79 parameters_type& with_options(std::unordered_map<int, int> options)
80 {
81 this->options = std::move(options);
82 return *this;
83 }
84 };
85
91 const parameters_type& get_parameters() { return parameters_; }
92
100 std::unique_ptr<permutation_type> generate(
101 std::shared_ptr<const LinOp> system_matrix) const;
102
104 static parameters_type build() { return {}; }
105
106protected:
107 explicit NestedDissection(std::shared_ptr<const Executor> exec,
108 const parameters_type& params = {});
109
110 std::unique_ptr<LinOp> generate_impl(
111 std::shared_ptr<const LinOp> system_matrix) const override;
112
113private:
114 parameters_type parameters_;
115};
116
117
118} // namespace reorder
119} // namespace experimental
120} // namespace gko
121
122
123#endif // GKO_HAVE_METIS
124
125
126#endif // GKO_PUBLIC_CORE_REORDER_NESTED_DISSECTION_HPP_
The Reorder namespace.
Definition amd.hpp:25
The Ginkgo namespace.
Definition abstract_factory.hpp:20