 |
Ginkgo
Generated from pipelines/2457497073 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_PRECONDITIONER_IC_HPP_
6 #define GKO_PUBLIC_CORE_PRECONDITIONER_IC_HPP_
10 #include <type_traits>
12 #include <ginkgo/core/base/abstract_factory.hpp>
13 #include <ginkgo/core/base/composition.hpp>
14 #include <ginkgo/core/base/exception.hpp>
15 #include <ginkgo/core/base/exception_helpers.hpp>
16 #include <ginkgo/core/base/lin_op.hpp>
17 #include <ginkgo/core/base/precision_dispatch.hpp>
18 #include <ginkgo/core/base/type_traits.hpp>
19 #include <ginkgo/core/config/config.hpp>
20 #include <ginkgo/core/config/registry.hpp>
21 #include <ginkgo/core/factorization/par_ic.hpp>
22 #include <ginkgo/core/matrix/dense.hpp>
23 #include <ginkgo/core/solver/solver_traits.hpp>
24 #include <ginkgo/core/solver/triangular.hpp>
25 #include <ginkgo/core/stop/combined.hpp>
26 #include <ginkgo/core/stop/iteration.hpp>
27 #include <ginkgo/core/stop/residual_norm.hpp>
31 namespace preconditioner {
78 template <
typename ValueType = default_precision,
typename IndexType =
int32>
84 using value_type = ValueType;
85 using index_type = IndexType;
110 this->l_solver_generator = std::move(solver);
111 this->deferred_factories[
"l_solver"] = [](
const auto& exec,
113 if (!params.l_solver_generator.is_empty()) {
114 params.l_solver_factory =
115 params.l_solver_generator.on(exec);
124 this->factorization_generator = std::move(factorization);
125 this->deferred_factories[
"factorization"] = [](
const auto& exec,
127 if (!params.factorization_generator.is_empty()) {
128 params.factorization_factory =
129 params.factorization_generator.on(exec);
136 deferred_factory_parameter<const LinOpFactory> l_solver_generator;
138 deferred_factory_parameter<const LinOpFactory> factorization_generator;
162 static parameters_type
parse(
165 config::make_type_descriptor<value_type, index_type>());
172 std::shared_ptr<const LinOp>
get_l_solver()
const {
return l_solver_; }
181 std::unique_ptr<LinOp>
transpose()
const override;
214 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
217 LinOp* x)
const override;
219 explicit Ic(std::shared_ptr<const Executor> exec);
221 explicit Ic(
const Factory* factory, std::shared_ptr<const LinOp> lin_op);
230 void set_cache_to(
const LinOp* b)
const;
233 std::shared_ptr<const LinOp> l_solver_{};
234 std::shared_ptr<const LinOp> lh_solver_{};
245 mutable struct cache_struct {
246 cache_struct() =
default;
247 ~cache_struct() =
default;
248 cache_struct(
const cache_struct&) {}
249 cache_struct(cache_struct&&) {}
250 cache_struct&
operator=(
const cache_struct&) {
return *
this; }
251 cache_struct&
operator=(cache_struct&&) {
return *
this; }
252 std::unique_ptr<LinOp> intermediate{};
261 #endif // GKO_PUBLIC_CORE_PRECONDITIONER_IC_HPP_
std::unique_ptr< LinOp > conj_transpose() const override
Returns a LinOp representing the conjugate transpose of the Transposable object.
pnode describes a tree of properties.
Definition: property_tree.hpp:28
Definition: lin_op.hpp:117
std::shared_ptr< const LinOpFactory > factorization_factory
Factory for the factorization.
Definition: ic.hpp:100
Linear operators which support transposition should implement the Transposable interface.
Definition: lin_op.hpp:392
The Incomplete Cholesky (IC) preconditioner solves the equation for a given lower triangular matrix ...
Definition: ic.hpp:79
static parameters_type parse(const config::pnode &config, const config::registry &context, const config::type_descriptor &td_for_child=config::make_type_descriptor< value_type, index_type >())
Create the parameters from the property_tree.
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 Ginkgo namespace.
Definition: abstract_factory.hpp:20
std::shared_ptr< const LinOp > get_lh_solver() const
Returns the solver which is used for the L^H matrix.
Definition: ic.hpp:179
#define GKO_ENABLE_LIN_OP_FACTORY(_lin_op, _parameters_name, _factory_name)
This macro will generate a default implementation of a LinOpFactory for the LinOp subclass it is defi...
Definition: lin_op.hpp:948
parameters_type & with_l_solver(deferred_factory_parameter< const LinOpFactory > solver)
When LSolverTypeOrValueType is a concrete solver type, this only accepts the factory from the same co...
Definition: ic.hpp:107
std::shared_ptr< const LinOp > get_l_solver() const
Returns the solver which is used for the provided L matrix.
Definition: ic.hpp:172
Ic & operator=(const Ic &other)
Copy-assigns an IC preconditioner.
std::shared_ptr< const LinOpFactory > l_solver_factory
Factory for the L solver.
Definition: ic.hpp:95
std::unique_ptr< LinOp > transpose() const override
Returns a LinOp representing the transpose of the Transposable object.
Ic(const Ic &other)
Copy-constructs an IC preconditioner.
This class stores additional context for creating Ginkgo objects from configuration files.
Definition: registry.hpp:167
#define GKO_ENABLE_BUILD_METHOD(_factory_name)
Defines a build method for the factory, simplifying its construction by removing the repetitive typin...
Definition: abstract_factory.hpp:394
The enable_parameters_type mixin is used to create a base implementation of the factory parameters st...
Definition: abstract_factory.hpp:211
Represents a factory parameter of factory type that can either initialized by a pre-existing factory ...
Definition: abstract_factory.hpp:309
The EnableLinOp mixin can be used to provide sensible default implementations of the majority of the ...
Definition: lin_op.hpp:836
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition: polymorphic_object.hpp:667