13
13
#include < ginkgo/core/base/lin_op.hpp>
14
14
#include < ginkgo/core/base/math.hpp>
15
15
#include < ginkgo/core/base/types.hpp>
16
+ #include < ginkgo/core/config/property_tree.hpp>
17
+ #include < ginkgo/core/config/registry.hpp>
18
+ #include < ginkgo/core/config/type_descriptor.hpp>
16
19
#include < ginkgo/core/log/logger.hpp>
17
20
#include < ginkgo/core/matrix/dense.hpp>
18
21
#include < ginkgo/core/matrix/identity.hpp>
@@ -27,7 +30,7 @@ namespace solver {
27
30
28
31
/* *
29
32
* Minres is an iterative type Krylov subspace method, which is suitable for
30
- * indefinite and full-rank symmetric/hermitian operators. It is an
33
+ * indefinite and full-rank symmetric/hermitian operators. It is a
31
34
* specialization of the Gmres method for symmetric/hermitian operators, and can
32
35
* be computed using short recurrences, similar to the CG method.
33
36
*
@@ -63,10 +66,8 @@ class Minres
63
66
64
67
/* *
65
68
* Return true as iterative solvers use the data in x as an initial guess.
66
- *
67
- * @return true as iterative solvers use the data in x as an initial guess.
68
69
*/
69
- bool apply_uses_initial_guess () const override { return true ; }
70
+ bool apply_uses_initial_guess () const override ;
70
71
71
72
class Factory ;
72
73
@@ -77,6 +78,24 @@ class Minres
77
78
GKO_ENABLE_LIN_OP_FACTORY (Minres, parameters, Factory);
78
79
GKO_ENABLE_BUILD_METHOD (Factory);
79
80
81
+ /* *
82
+ * Create the parameters from the property_tree.
83
+ * Because this is directly tied to the specific type, the value/index type
84
+ * settings within config are ignored and type_descriptor is only used
85
+ * for children configs.
86
+ *
87
+ * @param config the property tree for setting
88
+ * @param context the registry
89
+ * @param td_for_child the type descriptor for children configs. The
90
+ * default uses the value type of this class.
91
+ *
92
+ * @return parameters
93
+ */
94
+ static parameters_type parse (const config::pnode& config,
95
+ const config::registry& context,
96
+ const config::type_descriptor& td_for_child =
97
+ config::make_type_descriptor<ValueType>());
98
+
80
99
protected:
81
100
void apply_impl (const LinOp* b, LinOp* x) const override ;
82
101
@@ -86,18 +105,10 @@ class Minres
86
105
void apply_impl (const LinOp* alpha, const LinOp* b, const LinOp* beta,
87
106
LinOp* x) const override ;
88
107
89
- explicit Minres (std::shared_ptr<const Executor> exec)
90
- : EnableLinOp<Minres>(std::move(exec))
91
- {}
108
+ explicit Minres (std::shared_ptr<const Executor> exec);
92
109
93
110
explicit Minres (const Factory* factory,
94
- std::shared_ptr<const LinOp> system_matrix)
95
- : EnableLinOp<Minres>(factory->get_executor (),
96
- gko::transpose(system_matrix->get_size ())),
97
- EnablePreconditionedIterativeSolver<ValueType, Minres>{
98
- std::move (system_matrix), factory->get_parameters ()},
99
- parameters_{factory->get_parameters ()}
100
- {}
111
+ std::shared_ptr<const LinOp> system_matrix);
101
112
};
102
113
103
114
0 commit comments