Ginkgo: ginkgo/core/reorder/amd.hpp Source File

| 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
amd.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 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
18namespace gko {
19namespace experimental {
25 namespace reorder {
26
27
35template <typename IndexType = int32>
36 class Amd : public EnablePolymorphicObject<Amd<IndexType>, LinOpFactory>,
37 public EnablePolymorphicAssignment<Amd<IndexType>> {
38public:
39 struct parameters_type;
40 friend class EnablePolymorphicObject<Amd<IndexType>, LinOpFactory>;
41 friend class enable_parameters_type<parameters_type, Amd<IndexType>>;
42
43 using index_type = IndexType;
44 using permutation_type = matrix::Permutation<index_type>;
45
46 struct parameters_type
47 : public enable_parameters_type<parameters_type, Amd<IndexType>> {
52 bool GKO_FACTORY_PARAMETER_SCALAR(skip_symmetrize, false);
53
59 bool GKO_FACTORY_PARAMETER_SCALAR(skip_sorting, false);
60 };
61
67 const parameters_type& get_parameters() { return parameters_; }
68
76 std::unique_ptr<permutation_type> generate(
77 std::shared_ptr<const LinOp> system_matrix) const;
78
80 static parameters_type build() { return {}; }
81
82protected:
83 explicit Amd(std::shared_ptr<const Executor> exec,
84 const parameters_type& params = {});
85
86 std::unique_ptr<LinOp> generate_impl(
87 std::shared_ptr<const LinOp> system_matrix) const override;
88
89 parameters_type parameters_;
90};
91
92
93} // namespace reorder
94} // namespace experimental
95} // namespace gko
96
97
98#endif // GKO_PUBLIC_CORE_REORDER_AMD_HPP_
gko::EnablePolymorphicAssignment
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition polymorphic_object.hpp:743
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
gko::LinOpFactory
A LinOpFactory represents a higher order mapping which transforms one linear operator into another.
Definition lin_op.hpp:385
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:211
gko::experimental::reorder::Amd
Computes a Approximate Minimum Degree (AMD) reordering of an input matrix.
Definition amd.hpp:37
gko::experimental::reorder::Amd::build
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition amd.hpp:80
gko::experimental::reorder::Amd::generate
std::unique_ptr< permutation_type > generate(std::shared_ptr< const LinOp > system_matrix) const
Creates a new product from the given components.
gko::experimental::reorder::Amd::get_parameters
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition amd.hpp:67
gko::matrix::Permutation
Permutation is a matrix format that represents a permutation matrix, i.e.
Definition permutation.hpp:112
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:445
gko::experimental::reorder
The Reorder namespace.
Definition amd.hpp:25
gko
The Ginkgo namespace.
Definition abstract_factory.hpp:20
gko::experimental::reorder::Amd::parameters_type
Definition amd.hpp:47
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:59
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:52