Ginkgo Generated from branch based on master. Ginkgo version 1.7.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
lu.hpp
1/*******************************<GINKGO LICENSE>******************************
2Copyright (c) 2017-2023, the Ginkgo authors
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
8
91. Redistributions of source code must retain the above copyright
10notice, this list of conditions and the following disclaimer.
11
122. Redistributions in binary form must reproduce the above copyright
13notice, this list of conditions and the following disclaimer in the
14documentation and/or other materials provided with the distribution.
15
163. Neither the name of the copyright holder nor the names of its
17contributors may be used to endorse or promote products derived from
18this software without specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31******************************<GINKGO LICENSE>*******************************/
32
33#include <memory>
34
35
36#include <ginkgo/core/base/composition.hpp>
37#include <ginkgo/core/base/lin_op.hpp>
38#include <ginkgo/core/base/polymorphic_object.hpp>
39#include <ginkgo/core/factorization/factorization.hpp>
40#include <ginkgo/core/matrix/csr.hpp>
41#include <ginkgo/core/matrix/sparsity_csr.hpp>
42
43
44namespace gko {
45namespace experimental {
46namespace factorization {
47
48
49enum class symbolic_type {
51 general,
57 near_symmetric,
64 symmetric
65};
66
67
78template <typename ValueType, typename IndexType>
79class Lu
80 : public EnablePolymorphicObject<Lu<ValueType, IndexType>, LinOpFactory>,
81 public EnablePolymorphicAssignment<Lu<ValueType, IndexType>> {
82public:
83 struct parameters_type;
86
87 using value_type = ValueType;
88 using index_type = IndexType;
92
94 : public enable_parameters_type<parameters_type, Lu> {
103 std::shared_ptr<const sparsity_pattern_type>
105
114 symbolic_type::general);
115
127 };
128
134 const parameters_type& get_parameters() { return parameters_; }
135
143 std::unique_ptr<factorization_type> generate(
144 std::shared_ptr<const LinOp> system_matrix) const;
145
147 static parameters_type build() { return {}; }
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
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition polymorphic_object.hpp:752
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:691
A LinOpFactory represents a higher order mapping which transforms one linear operator into another.
Definition lin_op.hpp:414
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition abstract_factory.hpp:239
Represents a generic factorization consisting of two triangular factors (upper and lower) and an opti...
Definition factorization.hpp:104
Computes an LU factorization of a sparse matrix.
Definition lu.hpp:81
std::unique_ptr< factorization_type > generate(std::shared_ptr< const LinOp > system_matrix) const
const parameters_type & get_parameters()
Returns the parameters used to construct the factory.
Definition lu.hpp:134
static parameters_type build()
Creates a new parameter_type to set up the factory.
Definition lu.hpp:147
CSR is a matrix format which stores only the nonzero coefficients by compressing each row of the matr...
Definition csr.hpp:146
SparsityCsr is a matrix format which stores only the sparsity pattern of a sparse matrix by compressi...
Definition sparsity_csr.hpp:87
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition abstract_factory.hpp:473
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
bool skip_sorting
The system_matrix, which will be given to this factory, must be sorted (first by row,...
Definition lu.hpp:126
std::shared_ptr< const sparsity_pattern_type > symbolic_factorization
The combined sparsity pattern L + U of the factors L and U.
Definition lu.hpp:104
symbolic_type symbolic_algorithm
If the symbolic factorization of the matrix is not provided to the factory, this parameter controls w...
Definition lu.hpp:114