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