 |
Ginkgo
Generated from pipelines/2662685947 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_SOLVER_IDR_HPP_
6 #define GKO_PUBLIC_CORE_SOLVER_IDR_HPP_
13 #include <ginkgo/core/base/array.hpp>
14 #include <ginkgo/core/base/exception_helpers.hpp>
15 #include <ginkgo/core/base/lin_op.hpp>
16 #include <ginkgo/core/base/math.hpp>
17 #include <ginkgo/core/base/types.hpp>
18 #include <ginkgo/core/config/config.hpp>
19 #include <ginkgo/core/config/registry.hpp>
20 #include <ginkgo/core/log/logger.hpp>
21 #include <ginkgo/core/matrix/dense.hpp>
22 #include <ginkgo/core/matrix/identity.hpp>
23 #include <ginkgo/core/solver/solver_base.hpp>
24 #include <ginkgo/core/stop/combined.hpp>
25 #include <ginkgo/core/stop/criterion.hpp>
55 template <
typename ValueType = default_precision>
60 GKO_ASSERT_SUPPORTED_VALUE_TYPE;
63 using value_type = ValueType;
66 std::unique_ptr<LinOp>
transpose()
const override;
106 parameters_.
kappa = other;
139 GKO_DEPRECATED(
"Use set_complex_subspace instead")
159 parameters_type, Factory> {
213 config::make_type_descriptor<ValueType>());
216 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
219 LinOp* x)
const override;
221 template <
typename VectorType>
222 void iterate(
const VectorType* dense_b, VectorType* dense_x)
const;
224 explicit Idr(std::shared_ptr<const Executor> exec) :
LinOp(std::move(exec))
228 std::shared_ptr<const LinOp> system_matrix)
232 std::move(system_matrix), factory->get_parameters()},
233 parameters_{factory->get_parameters()}
238 template <
typename ValueType>
242 static int num_vectors(
const Solver&);
244 static int num_arrays(
const Solver&);
246 static std::vector<std::string> op_names(
const Solver&);
248 static std::vector<std::string> array_names(
const Solver&);
250 static std::vector<int> scalars(
const Solver&);
252 static std::vector<int> vectors(
const Solver&);
255 constexpr
static int residual = 0;
257 constexpr
static int v = 1;
259 constexpr
static int t = 2;
261 constexpr
static int helper = 3;
263 constexpr
static int m = 4;
265 constexpr
static int g = 5;
267 constexpr
static int u = 6;
269 constexpr
static int subspace = 7;
271 constexpr
static int f = 8;
273 constexpr
static int c = 9;
275 constexpr
static int omega = 10;
277 constexpr
static int residual_norm = 11;
279 constexpr
static int tht = 12;
281 constexpr
static int alpha = 13;
283 constexpr
static int one = 14;
285 constexpr
static int minus_one = 15;
287 constexpr
static int subspace_minus_one = 16;
290 constexpr
static int stop = 0;
292 constexpr
static int tmp = 1;
300 #endif // GKO_PUBLIC_CORE_SOLVER_IDR_HPP_
void set_kappa(const remove_complex< ValueType > other)
Sets the kappa parameter of the solver.
Definition: idr.hpp:104
bool complex_subspace
If set to true, IDR will use a complex subspace S also for real problems, allowing for faster converg...
Definition: idr.hpp:192
bool apply_uses_initial_guess() const override
Return true as iterative solvers use the data in x as an initial guess.
Definition: idr.hpp:75
pnode describes a tree of properties.
Definition: property_tree.hpp:28
Definition: lin_op.hpp:117
void set_complex_subspace(const bool other)
Sets the complex_subspace parameter of the solver.
Definition: idr.hpp:150
void set_subspace_dim(const size_type other)
Sets the subspace dimension of the solver.
Definition: idr.hpp:87
Linear operators which support transposition should implement the Transposable interface.
Definition: lin_op.hpp:392
bool get_deterministic() const
Gets the deterministic parameter of the solver.
Definition: idr.hpp:114
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:90
Definition: solver_base.hpp:855
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition: abstract_factory.hpp:437
bool deterministic
If set to true, the vectors spanning the subspace S are chosen deterministically.
Definition: idr.hpp:183
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::unique_ptr< LinOp > conj_transpose() const override
Returns a LinOp representing the conjugate transpose of the Transposable object.
void set_deterministic(const bool other)
Sets the deterministic parameter of the solver.
Definition: idr.hpp:121
void set_complex_subpsace(const bool other)
Sets the complex_subspace parameter of the solver.
Definition: idr.hpp:140
IDR(s) is an efficient method for solving large nonsymmetric systems of linear equations.
Definition: idr.hpp:56
size_type get_subspace_dim() const
Gets the subspace dimension of the solver.
Definition: idr.hpp:81
#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:900
static parameters_type parse(const config::pnode &config, const config::registry &context, const config::type_descriptor &td_for_child=config::make_type_descriptor< ValueType >())
Create the parameters from the property_tree.
remove_complex< ValueType > kappa
Threshold to determine if Av_n and v_n are too close to being perpendicular.
Definition: idr.hpp:172
bool get_complex_subspace() const
Gets the complex_subspace parameter of the solver.
Definition: idr.hpp:131
std::unique_ptr< LinOp > transpose() const override
Returns a LinOp representing the transpose of the Transposable object.
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:386
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition: polymorphic_object.hpp:62
Traits class providing information on the type and location of workspace vectors inside a solver.
Definition: solver_base.hpp:238
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition: lin_op.hpp:169
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition: math.hpp:264
A LinOp implementing this interface stores a system matrix and stopping criterion factory.
Definition: solver_base.hpp:800
size_type subspace_dim
Dimension of the subspace S.
Definition: idr.hpp:164
constexpr T one()
Returns the multiplicative identity for T.
Definition: math.hpp:654
remove_complex< ValueType > get_kappa() const
Gets the kappa parameter of the solver.
Definition: idr.hpp:97