Ginkgo  Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
lu.hpp
1 // SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #include <memory>
6 
7 
8 #include <ginkgo/core/base/composition.hpp>
9 #include <ginkgo/core/base/lin_op.hpp>
10 #include <ginkgo/core/base/polymorphic_object.hpp>
11 #include <ginkgo/core/config/config.hpp>
12 #include <ginkgo/core/config/registry.hpp>
13 #include <ginkgo/core/factorization/factorization.hpp>
14 #include <ginkgo/core/matrix/csr.hpp>
15 #include <ginkgo/core/matrix/sparsity_csr.hpp>
16 
17 
18 namespace gko {
19 namespace experimental {
20 namespace factorization {
21 
22 
23 enum class symbolic_type {
25  general,
31  near_symmetric,
38  symmetric
39 };
40 
41 
52 template <typename ValueType, typename IndexType>
53 class Lu
54  : public EnablePolymorphicObject<Lu<ValueType, IndexType>, LinOpFactory>,
55  public EnablePolymorphicAssignment<Lu<ValueType, IndexType>> {
56 public:
57  struct parameters_type;
60 
61  using value_type = ValueType;
62  using index_type = IndexType;
66 
68  : public enable_parameters_type<parameters_type, Lu> {
77  std::shared_ptr<const sparsity_pattern_type>
79 
88  symbolic_type::general);
89 
101  };
102 
108  const parameters_type& get_parameters() { return parameters_; }
109 
113  const parameters_type& get_parameters() const { return parameters_; }
114 
122  std::unique_ptr<factorization_type> generate(
123  std::shared_ptr<const LinOp> system_matrix) const;
124 
126  static parameters_type build() { return {}; }
127 
141  static parameters_type parse(
142  const config::pnode& config, const config::registry& context,
143  const config::type_descriptor& td_for_child =
144  config::make_type_descriptor<ValueType, IndexType>());
145 
146 protected:
147  explicit Lu(std::shared_ptr<const Executor> exec,
148  const parameters_type& params = {});
149 
150  std::unique_ptr<LinOp> generate_impl(
151  std::shared_ptr<const LinOp> system_matrix) const override;
152 
153 private:
154  parameters_type parameters_;
155 };
156 
157 
158 } // namespace factorization
159 } // namespace experimental
160 } // namespace gko
gko::experimental::factorization::Factorization
Represents a generic factorization consisting of two triangular factors (upper and lower) and an opti...
Definition: factorization.hpp:76
gko::matrix::Csr
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition: matrix.hpp:27
gko::config::pnode
pnode describes a tree of properties.
Definition: property_tree.hpp:28
gko::matrix::SparsityCsr
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition: csr.hpp:40
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:88
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:100
gko::EnablePolymorphicAssignment
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition: polymorphic_object.hpp:724
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::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:37
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
gko::experimental::factorization::Lu::get_parameters
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition: lu.hpp:108
gko::experimental::factorization::Lu::generate
std::unique_ptr< factorization_type > generate(std::shared_ptr< const LinOp > system_matrix) const
gko::experimental::factorization::Lu::get_parameters
const parameters_type & get_parameters() const
Returns the parameters used to construct the factory.
Definition: lu.hpp:113
gko::experimental::factorization::Lu::build
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition: lu.hpp:126
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::experimental::factorization::Lu
Computes an LU factorization of a sparse matrix.
Definition: lu.hpp:53
gko::config::registry
This class stores additional context for creating Ginkgo objects from configuration files.
Definition: registry.hpp:168
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:78
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::factorization::Lu::parameters_type
Definition: lu.hpp:67
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition: polymorphic_object.hpp:662