ginkgo/core/solver/direct.hpp Source File

ginkgo/core/solver/direct.hpp Source File#

Reference API: ginkgo/core/solver/direct.hpp Source File
Reference API
direct.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_SOLVER_DIRECT_HPP_
6#define GKO_PUBLIC_CORE_SOLVER_DIRECT_HPP_
7
8
9#include <ginkgo/core/base/lin_op.hpp>
10#include <ginkgo/core/config/config.hpp>
11#include <ginkgo/core/config/registry.hpp>
12#include <ginkgo/core/factorization/factorization.hpp>
13#include <ginkgo/core/solver/solver_base.hpp>
14#include <ginkgo/core/solver/triangular.hpp>
15
16
17namespace gko {
18namespace experimental {
19namespace solver {
20
21
34template <typename ValueType, typename IndexType>
35class Direct : public EnableLinOp<Direct<ValueType, IndexType>>,
37 Direct<ValueType, IndexType>,
38 factorization::Factorization<ValueType, IndexType>>,
39 public Transposable {
41
42public:
43 using value_type = ValueType;
44 using index_type = IndexType;
45 using factorization_type =
47 using transposed_type = Direct;
48
49 std::unique_ptr<LinOp> transpose() const override;
50
51 std::unique_ptr<LinOp> conj_transpose() const override;
52
53 class Factory;
54
55 struct parameters_type : enable_parameters_type<parameters_type, Factory> {
64
66 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
68 };
71
86 const config::pnode& config, const config::registry& context,
87 const config::type_descriptor& td_for_child =
88 config::make_type_descriptor<ValueType, IndexType>());
89
91 Direct(const Direct&);
92
95
96 Direct& operator=(const Direct&);
97
98 Direct& operator=(Direct&&);
99
100protected:
101 explicit Direct(std::shared_ptr<const Executor> exec);
102
103 Direct(const Factory* factory, std::shared_ptr<const LinOp> system_matrix);
104
105 void apply_impl(const LinOp* b, LinOp* x) const override;
106
107 void apply_impl(const LinOp* alpha, const LinOp* b, const LinOp* beta,
108 LinOp* x) const override;
109
110private:
113
114 std::unique_ptr<lower_type> lower_solver_;
115 std::unique_ptr<upper_type> upper_solver_;
116};
117
118
119} // namespace solver
120} // namespace experimental
121
122
123namespace solver {
124
125
126template <typename ValueType, typename IndexType>
127struct workspace_traits<
128 gko::experimental::solver::Direct<ValueType, IndexType>> {
130 // number of vectors used by this workspace
131 static int num_vectors(const Solver&);
132 // number of arrays used by this workspace
133 static int num_arrays(const Solver&);
134 // array containing the num_vectors names for the workspace vectors
135 static std::vector<std::string> op_names(const Solver&);
136 // array containing the num_arrays names for the workspace vectors
137 static std::vector<std::string> array_names(const Solver&);
138 // array containing all varying scalar vectors (independent of problem size)
139 static std::vector<int> scalars(const Solver&);
140 // array containing all varying vectors (dependent on problem size)
141 static std::vector<int> vectors(const Solver&);
142
143 // intermediate vector
144 constexpr static int intermediate = 0;
145};
146
147
148} // namespace solver
149} // namespace gko
150
151#endif // GKO_PUBLIC_CORE_SOLVER_DIRECT_HPP_
Definition lin_op.hpp:878
Definition polymorphic_object.hpp:668
Definition lin_op.hpp:117
Definition lin_op.hpp:433
Definition property_tree.hpp:28
Definition registry.hpp:167
Definition type_descriptor.hpp:39
Definition abstract_factory.hpp:211
Definition direct.hpp:39
std::unique_ptr< LinOp > conj_transpose() const override
std::unique_ptr< LinOp > transpose() const override
static parameters_type parse(const config::pnode &config, const config::registry &context, const config::type_descriptor &td_for_child=config::make_type_descriptor< ValueType, IndexType >())
Definition solver_base.hpp:539
Definition triangular.hpp:67
Definition triangular.hpp:234
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Definition abstract_factory.hpp:445
#define GKO_ENABLE_BUILD_METHOD(_factory_name)
Definition abstract_factory.hpp:394
#define GKO_ENABLE_LIN_OP_FACTORY(_lin_op, _parameters_name, _factory_name)
Definition lin_op.hpp:1016
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::size_t size_type
Definition types.hpp:89
std::shared_ptr< const LinOpFactory > factorization
Definition direct.hpp:67
gko::size_type num_rhs
Definition direct.hpp:63