ginkgo/core/preconditioner/gauss_seidel.hpp Source File

ginkgo/core/preconditioner/gauss_seidel.hpp Source File#

Reference API: ginkgo/core/preconditioner/gauss_seidel.hpp Source File
Reference API
gauss_seidel.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_PRECONDITIONER_GAUSS_SEIDEL_HPP_
6#define GKO_PUBLIC_CORE_PRECONDITIONER_GAUSS_SEIDEL_HPP_
7
8
9#include <vector>
10
11#include <ginkgo/core/base/abstract_factory.hpp>
12#include <ginkgo/core/base/composition.hpp>
13#include <ginkgo/core/base/lin_op.hpp>
14#include <ginkgo/core/base/polymorphic_object.hpp>
15#include <ginkgo/core/config/config.hpp>
16
17
18namespace gko {
19namespace preconditioner {
20
21
32template <typename ValueType = default_precision, typename IndexType = int32>
34 : public EnablePolymorphicObject<GaussSeidel<ValueType, IndexType>,
35 LinOpFactory>,
36 public EnablePolymorphicAssignment<GaussSeidel<ValueType, IndexType>> {
38
39public:
40 struct parameters_type;
42
43 using value_type = ValueType;
44 using index_type = IndexType;
46
48 : public enable_parameters_type<parameters_type, GaussSeidel> {
49 // skip sorting of input matrix
50 bool GKO_FACTORY_PARAMETER_SCALAR(skip_sorting, false);
51
52 // determines if Gauss-Seidel or symmetric Gauss-Seidel should be used
53 bool GKO_FACTORY_PARAMETER_SCALAR(symmetric, false);
54
55 // factory for the lower triangular factor solver, defaults to LowerTrs
56 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
57 l_solver);
58
59 // factory for the upper triangular factor solver, unused if symmetric
60 // is false, defaults to UpperTrs
61 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
62 u_solver);
63 };
64
70 const parameters_type& get_parameters() { return parameters_; }
71
75 const parameters_type& get_parameters() const { return parameters_; }
76
84 std::unique_ptr<composition_type> generate(
85 std::shared_ptr<const LinOp> system_matrix) const;
86
88 static parameters_type build() { return {}; }
89
90 static parameters_type parse(
91 const config::pnode& config, const config::registry& context,
92 const config::type_descriptor& td_for_child =
93 config::make_type_descriptor<ValueType, IndexType>());
94
95protected:
96 explicit GaussSeidel(std::shared_ptr<const Executor> exec,
97 const parameters_type& params = {})
98 : EnablePolymorphicObject<GaussSeidel, LinOpFactory>(exec),
99 parameters_(params)
100 {}
101
102 std::unique_ptr<LinOp> generate_impl(
103 std::shared_ptr<const LinOp> system_matrix) const override;
104
105private:
106 parameters_type parameters_;
107};
108
109
110} // namespace preconditioner
111} // namespace gko
112
113
114#endif // GKO_PUBLIC_CORE_PRECONDITIONER_GAUSS_SEIDEL_HPP_
Definition composition.hpp:41
Definition polymorphic_object.hpp:743
Definition polymorphic_object.hpp:668
Definition lin_op.hpp:385
Definition property_tree.hpp:28
Definition registry.hpp:167
Definition type_descriptor.hpp:39
Definition abstract_factory.hpp:211
Definition gauss_seidel.hpp:36
const parameters_type & get_parameters()
Definition gauss_seidel.hpp:70
static parameters_type build()
Definition gauss_seidel.hpp:88
std::unique_ptr< composition_type > generate(std::shared_ptr< const LinOp > system_matrix) const
const parameters_type & get_parameters() const
Definition gauss_seidel.hpp:75
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Definition abstract_factory.hpp:445
The Ginkgo namespace.
Definition abstract_factory.hpp:20