Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
nested_dissection.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 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>> {
52public:
53 struct parameters_type;
54 friend class EnablePolymorphicObject<NestedDissection<ValueType, IndexType>,
55 LinOpFactory>;
56 friend class enable_parameters_type<parameters_type,
57 NestedDissection<ValueType, IndexType>>;
58
59 using value_type = ValueType;
60 using index_type = IndexType;
61 using matrix_type = matrix::Csr<value_type, index_type>;
62 using permutation_type = matrix::Permutation<index_type>;
63
64 struct parameters_type
65 : public enable_parameters_type<
66 parameters_type, NestedDissection<ValueType, IndexType>> {
71 std::unordered_map<int, int> options;
72
77 parameters_type& with_options(std::unordered_map<int, int> options)
78 {
79 this->options = std::move(options);
80 return *this;
81 }
82 };
83
89 const parameters_type& get_parameters() { return parameters_; }
90
98 std::unique_ptr<permutation_type> generate(
99 std::shared_ptr<const LinOp> system_matrix) const;
100
102 static parameters_type build() { return {}; }
103
104protected:
105 explicit NestedDissection(std::shared_ptr<const Executor> exec,
106 const parameters_type& params = {});
107
108 std::unique_ptr<LinOp> generate_impl(
109 std::shared_ptr<const LinOp> system_matrix) const override;
110
111private:
112 parameters_type parameters_;
113};
114
115
116} // namespace reorder
117} // namespace experimental
118} // namespace gko
119
120
121#endif // GKO_HAVE_METIS
122
123
124#endif // GKO_PUBLIC_CORE_REORDER_NESTED_DISSECTION_HPP_
The Ginkgo namespace.
Definition abstract_factory.hpp:20