53 auto method = getMethod(env);
56 STORM_LOG_INFO(
"Solving linear equation system (" << x.size() <<
" rows) with Gmmxx linear equation solver with method '" <<
toString(method)
57 <<
"' and preconditioner '" <<
toString(preconditioner) <<
"'.");
59 if (method == GmmxxLinearEquationSolverMethod::Bicgstab || method == GmmxxLinearEquationSolverMethod::Qmr ||
60 method == GmmxxLinearEquationSolverMethod::Gmres) {
62 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu && !iluPreconditioner) {
63 iluPreconditioner = std::make_unique<gmm::ilu_precond<gmm::csr_matrix<ValueType>>>(*gmmxxA);
64 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
65 diagonalPreconditioner = std::make_unique<gmm::diagonal_precond<gmm::csr_matrix<ValueType>>>(*gmmxxA);
69 gmm::size_type maxIter = std::numeric_limits<gmm::size_type>::max();
74 iter.set_callback([](
const gmm::iteration& iteration) ->
void {
76 "Gmm++ (externally) aborted after " << iteration.get_iteration() <<
" iterations.");
82 if (method == GmmxxLinearEquationSolverMethod::Bicgstab) {
83 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
84 gmm::bicgstab(*gmmxxA, x, b, *iluPreconditioner, iter);
85 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
86 gmm::bicgstab(*gmmxxA, x, b, *diagonalPreconditioner, iter);
87 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
88 gmm::bicgstab(*gmmxxA, x, b, gmm::identity_matrix(), iter);
90 }
else if (method == GmmxxLinearEquationSolverMethod::Qmr) {
91 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
92 gmm::qmr(*gmmxxA, x, b, *iluPreconditioner, iter);
93 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
94 gmm::qmr(*gmmxxA, x, b, *diagonalPreconditioner, iter);
95 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
96 gmm::qmr(*gmmxxA, x, b, gmm::identity_matrix(), iter);
98 }
else if (method == GmmxxLinearEquationSolverMethod::Gmres) {
99 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
101 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
103 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
107 }
catch (storm::exceptions::AbortException
const& e) {
111 if (!this->isCachingEnabled()) {
119 if (iter.converged()) {
120 STORM_LOG_INFO(
"Iterative solver converged after " << iter.get_iteration() <<
" iteration(s).");
123 STORM_LOG_WARN(
"Iterative solver did not converge within " << iter.get_iteration() <<
" iteration(s).");