Ginkgo  Generated from pipelines/2721898507 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
amd.hpp
1 // SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_REORDER_AMD_HPP_
6 #define GKO_PUBLIC_CORE_REORDER_AMD_HPP_
7 
8 
9 #include <memory>
10 
11 #include <ginkgo/core/base/abstract_factory.hpp>
12 #include <ginkgo/core/base/lin_op.hpp>
13 #include <ginkgo/core/base/polymorphic_object.hpp>
14 #include <ginkgo/core/base/types.hpp>
15 #include <ginkgo/core/matrix/permutation.hpp>
16 
17 
18 namespace gko {
19 namespace experimental {
25 namespace reorder {
26 
27 
35 template <typename IndexType = int32>
36 class Amd : public LinOpFactory {
37 public:
38  struct parameters_type;
39  friend class enable_parameters_type<parameters_type, Amd<IndexType>>;
40 
41  using index_type = IndexType;
43 
45  : public enable_parameters_type<parameters_type, Amd<IndexType>> {
51 
58  };
59 
65  const parameters_type& get_parameters() { return parameters_; }
66 
74  std::unique_ptr<permutation_type> generate(
75  std::shared_ptr<const LinOp> system_matrix) const;
76 
78  static parameters_type build() { return {}; }
79 
80 protected:
81  explicit Amd(std::shared_ptr<const Executor> exec,
82  const parameters_type& params = {});
83 
84  std::unique_ptr<LinOp> generate_impl(
85  std::shared_ptr<const LinOp> system_matrix) const override;
86 
87  parameters_type parameters_;
88 };
89 
90 
91 } // namespace reorder
92 } // namespace experimental
93 } // namespace gko
94 
95 
96 #endif // GKO_PUBLIC_CORE_REORDER_AMD_HPP_
gko::experimental::reorder::Amd
Computes a Approximate Minimum Degree (AMD) reordering of an input matrix.
Definition: amd.hpp:36
gko::matrix::Permutation
Permutation is a matrix format that represents a permutation matrix, i.e.
Definition: csr.hpp:52
GKO_FACTORY_PARAMETER_SCALAR
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition: abstract_factory.hpp:437
gko::experimental::reorder::Amd::build
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition: amd.hpp:78
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
gko::experimental::reorder::Amd::parameters_type::skip_sorting
bool skip_sorting
If set to false, sorts the input matrix before computing the AMD reordering.
Definition: amd.hpp:57
gko::experimental::reorder::Amd::get_parameters
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition: amd.hpp:65
gko::experimental::reorder::Amd::generate
std::unique_ptr< permutation_type > generate(std::shared_ptr< const LinOp > system_matrix) const
gko::experimental::reorder::Amd::parameters_type::skip_symmetrize
bool skip_symmetrize
If set to false, computes the AMD reordering on A + A^T, otherwise assumes that A is symmetric and us...
Definition: amd.hpp:50
gko::experimental::reorder::Amd::parameters_type
Definition: amd.hpp:44
gko::LinOpFactory
A LinOpFactory represents a higher order mapping which transforms one linear operator into another.
Definition: lin_op.hpp:343
gko::enable_parameters_type
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition: abstract_factory.hpp:203