Ginkgo Generated from branch based on master. Ginkgo version 1.8.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
19#include <ginkgo/core/base/abstract_factory.hpp>
20#include <ginkgo/core/base/array.hpp>
21#include <ginkgo/core/base/dim.hpp>
22#include <ginkgo/core/base/lin_op.hpp>
23#include <ginkgo/core/base/polymorphic_object.hpp>
24#include <ginkgo/core/base/types.hpp>
25#include <ginkgo/core/matrix/csr.hpp>
26#include <ginkgo/core/matrix/permutation.hpp>
27
28
29namespace gko {
30namespace experimental {
36namespace reorder {
37
38
47template <typename ValueType, typename IndexType>
48class NestedDissection
49 : public EnablePolymorphicObject<NestedDissection<ValueType, IndexType>,
50 LinOpFactory>,
51 public EnablePolymorphicAssignment<
52 NestedDissection<ValueType, IndexType>> {
53public:
54 struct parameters_type;
55 friend class EnablePolymorphicObject<NestedDissection<ValueType, IndexType>,
56 LinOpFactory>;
57 friend class enable_parameters_type<parameters_type,
58 NestedDissection<ValueType, IndexType>>;
59
60 using value_type = ValueType;
61 using index_type = IndexType;
62 using matrix_type = matrix::Csr<value_type, index_type>;
63 using permutation_type = matrix::Permutation<index_type>;
64
65 struct parameters_type
66 : public enable_parameters_type<
67 parameters_type, NestedDissection<ValueType, IndexType>> {
72 std::unordered_map<int, int> options;
73
78 parameters_type& with_options(std::unordered_map<int, int> options)
79 {
80 this->options = std::move(options);
81 return *this;
82 }
83 };
84
90 const parameters_type& get_parameters() { return parameters_; }
91
99 std::unique_ptr<permutation_type> generate(
100 std::shared_ptr<const LinOp> system_matrix) const;
101
103 static parameters_type build() { return {}; }
104
105protected:
106 explicit NestedDissection(std::shared_ptr<const Executor> exec,
107 const parameters_type& params = {});
108
109 std::unique_ptr<LinOp> generate_impl(
110 std::shared_ptr<const LinOp> system_matrix) const override;
111
112private:
113 parameters_type parameters_;
114};
115
116
117} // namespace reorder
118} // namespace experimental
119} // namespace gko
120
121
122#endif // GKO_HAVE_METIS
123
124
125#endif // GKO_PUBLIC_CORE_REORDER_NESTED_DISSECTION_HPP_
The Ginkgo namespace.
Definition abstract_factory.hpp:20