Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
 
Loading...
Searching...
No Matches
cholesky.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 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
34template <typename ValueType, typename IndexType>
35class Cholesky
36 : public EnablePolymorphicObject<Cholesky<ValueType, IndexType>,
37 LinOpFactory>,
38 public EnablePolymorphicAssignment<Cholesky<ValueType, IndexType>> {
39public:
40 struct parameters_type;
41 friend class EnablePolymorphicObject<Cholesky, LinOpFactory>;
42 friend class enable_parameters_type<parameters_type, Cholesky>;
43
44 using value_type = ValueType;
45 using index_type = IndexType;
46 using matrix_type = matrix::Csr<value_type, index_type>;
47 using sparsity_pattern_type = matrix::SparsityCsr<value_type, index_type>;
48 using factorization_type = Factorization<value_type, index_type>;
49
51 : public enable_parameters_type<parameters_type, Cholesky> {
58 std::shared_ptr<const sparsity_pattern_type>
60
72 };
73
79 const parameters_type& get_parameters() { return parameters_; }
80
84 const parameters_type& get_parameters() const { return parameters_; }
85
93 std::unique_ptr<factorization_type> generate(
94 std::shared_ptr<const LinOp> system_matrix) const;
95
97 static parameters_type build() { return {}; }
98
113 const config::pnode& config, const config::registry& context,
114 const config::type_descriptor& td_for_child =
115 config::make_type_descriptor<ValueType, IndexType>());
116
117protected:
118 explicit Cholesky(std::shared_ptr<const Executor> exec,
119 const parameters_type& params = {});
120
121 std::unique_ptr<LinOp> generate_impl(
122 std::shared_ptr<const LinOp> system_matrix) const override;
123
124private:
125 parameters_type parameters_;
126};
127
128
129} // namespace factorization
130} // namespace experimental
131} // namespace gko
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition polymorphic_object.hpp:723
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:662
A LinOpFactory represents a higher order mapping which transforms one linear operator into another.
Definition lin_op.hpp:385
pnode describes a tree of properties.
Definition property_tree.hpp:28
This class stores additional context for creating Ginkgo objects from configuration files.
Definition registry.hpp:167
This class describes the value and index types to be used when building a Ginkgo type from a configur...
Definition type_descriptor.hpp:39
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition abstract_factory.hpp:211
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition cholesky.hpp:97
const parameters_type & get_parameters() const
Returns the parameters used to construct the factory.
Definition cholesky.hpp:84
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition cholesky.hpp:79
std::unique_ptr< factorization_type > generate(std::shared_ptr< const LinOp > system_matrix) const
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.
Represents a generic factorization consisting of two triangular factors (upper and lower) and an opti...
Definition factorization.hpp:76
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition csr.hpp:121
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition sparsity_csr.hpp:56
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition abstract_factory.hpp:445
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::shared_ptr< const sparsity_pattern_type > symbolic_factorization
The combined sparsity pattern L + L^H of the factors L and L^H.
Definition cholesky.hpp:59
bool skip_sorting
The system_matrix, which will be given to this factory, must be sorted (first by row,...
Definition cholesky.hpp:71