Ginkgo: ginkgo/core/factorization/lu.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
lu.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#include <memory>
6
7#include <ginkgo/core/base/composition.hpp>
8#include <ginkgo/core/base/lin_op.hpp>
9#include <ginkgo/core/base/polymorphic_object.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/matrix/csr.hpp>
14#include <ginkgo/core/matrix/sparsity_csr.hpp>
15
16
17namespace gko {
18namespace experimental {
19namespace factorization {
20
21
22enum class symbolic_type {
24 general,
30 near_symmetric,
37 symmetric
38};
39
40
53template <typename ValueType, typename IndexType>
54 class Lu
55 : public EnablePolymorphicObject<Lu<ValueType, IndexType>, LinOpFactory>,
56 public EnablePolymorphicAssignment<Lu<ValueType, IndexType>> {
57 GKO_ASSERT_SUPPORTED_VALUE_AND_INDEX_TYPE;
58
59public:
60 struct parameters_type;
61 friend class EnablePolymorphicObject<Lu, LinOpFactory>;
62 friend class enable_parameters_type<parameters_type, Lu>;
63
64 using value_type = ValueType;
65 using index_type = IndexType;
66 using matrix_type = matrix::Csr<value_type, index_type>;
67 using sparsity_pattern_type = matrix::SparsityCsr<value_type, index_type>;
68 using factorization_type = Factorization<value_type, index_type>;
69
70 struct parameters_type
71 : public enable_parameters_type<parameters_type, Lu> {
80 std::shared_ptr<const sparsity_pattern_type>
81 GKO_FACTORY_PARAMETER_SCALAR(symbolic_factorization, nullptr);
82
90 symbolic_type GKO_FACTORY_PARAMETER_SCALAR(symbolic_algorithm,
91 symbolic_type::general);
92
103 bool GKO_FACTORY_PARAMETER_SCALAR(skip_sorting, false);
104 };
105
111 const parameters_type& get_parameters() { return parameters_; }
112
116 const parameters_type& get_parameters() const { return parameters_; }
117
125 std::unique_ptr<factorization_type> generate(
126 std::shared_ptr<const LinOp> system_matrix) const;
127
129 static parameters_type build() { return {}; }
130
144 static parameters_type parse(
145 const config::pnode& config, const config::registry& context,
146 const config::type_descriptor& td_for_child =
147 config::make_type_descriptor<ValueType, IndexType>());
148
149protected:
150 explicit Lu(std::shared_ptr<const Executor> exec,
151 const parameters_type& params = {});
152
153 std::unique_ptr<LinOp> generate_impl(
154 std::shared_ptr<const LinOp> system_matrix) const override;
155
156private:
157 parameters_type parameters_;
158};
159
160
161} // namespace factorization
162} // namespace experimental
163} // namespace gko
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::config::pnode
pnode describes a tree of properties.
Definition property_tree.hpp:28
gko::config::registry
This class stores additional context for creating Ginkgo objects from configuration files.
Definition registry.hpp:167
gko::config::type_descriptor
This class describes the value and index types to be used when building a Ginkgo type from a configur...
Definition type_descriptor.hpp:39
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::factorization::Factorization
Represents a generic factorization consisting of two triangular factors (upper and lower) and an opti...
Definition factorization.hpp:76
gko::experimental::factorization::Lu::generate
std::unique_ptr< factorization_type > generate(std::shared_ptr< const LinOp > system_matrix) const
Creates a new product from the given components.
gko::experimental::factorization::Lu::get_parameters
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition lu.hpp:111
gko::experimental::factorization::Lu::build
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition lu.hpp:129
gko::experimental::factorization::Lu::get_parameters
const parameters_type & get_parameters() const
Returns the parameters used to construct the factory.
Definition lu.hpp:116
gko::experimental::factorization::Lu::parse
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 >())
Create the parameters from the property_tree.
gko::matrix::Csr
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition csr.hpp:126
gko::matrix::SparsityCsr
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition sparsity_csr.hpp:56
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
The Ginkgo namespace.
Definition abstract_factory.hpp:20
gko::experimental::factorization::Lu::parameters_type
Definition lu.hpp:71
gko::experimental::factorization::Lu::parameters_type::skip_sorting
bool skip_sorting
The system_matrix, which will be given to this factory, must be sorted (first by row,...
Definition lu.hpp:103
gko::experimental::factorization::Lu::parameters_type::symbolic_factorization
std::shared_ptr< const sparsity_pattern_type > symbolic_factorization
The combined sparsity pattern L + U of the factors L and U.
Definition lu.hpp:81
gko::experimental::factorization::Lu::parameters_type::symbolic_algorithm
symbolic_type symbolic_algorithm
If the symbolic factorization of the matrix is not provided to the factory, this parameter controls w...
Definition lu.hpp:91