63 auto method = getMethod(env);
66 STORM_LOG_INFO(
"Solving linear equation system (" << x.size() <<
" rows) with Gmmxx linear equation solver with method '" <<
toString(method)
67 <<
"' and preconditioner '" <<
toString(preconditioner) <<
"'.");
69 if (method == GmmxxLinearEquationSolverMethod::Bicgstab || method == GmmxxLinearEquationSolverMethod::Qmr ||
70 method == GmmxxLinearEquationSolverMethod::Gmres) {
72 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu && !iluPreconditioner) {
73 iluPreconditioner = std::make_unique<gmm::ilu_precond<gmm::csr_matrix<ValueType>>>(*gmmxxA);
74 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
75 diagonalPreconditioner = std::make_unique<gmm::diagonal_precond<gmm::csr_matrix<ValueType>>>(*gmmxxA);
79 gmm::size_type maxIter = std::numeric_limits<gmm::size_type>::max();
84 iter.set_callback([](
const gmm::iteration& iteration) ->
void {
86 "Gmm++ (externally) aborted after " << iteration.get_iteration() <<
" iterations.");
92 if (method == GmmxxLinearEquationSolverMethod::Bicgstab) {
93 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
94 gmm::bicgstab(*gmmxxA, x, b, *iluPreconditioner, iter);
95 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
96 gmm::bicgstab(*gmmxxA, x, b, *diagonalPreconditioner, iter);
97 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
98 gmm::bicgstab(*gmmxxA, x, b, gmm::identity_matrix(), iter);
100 }
else if (method == GmmxxLinearEquationSolverMethod::Qmr) {
101 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
102 gmm::qmr(*gmmxxA, x, b, *iluPreconditioner, iter);
103 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
104 gmm::qmr(*gmmxxA, x, b, *diagonalPreconditioner, iter);
105 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
106 gmm::qmr(*gmmxxA, x, b, gmm::identity_matrix(), iter);
108 }
else if (method == GmmxxLinearEquationSolverMethod::Gmres) {
109 if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Ilu) {
111 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::Diagonal) {
113 }
else if (preconditioner == GmmxxLinearEquationSolverPreconditioner::None) {
117 }
catch (storm::exceptions::AbortException
const& e) {
121 if (!this->isCachingEnabled()) {
129 if (iter.converged()) {
130 STORM_LOG_INFO(
"Iterative solver converged after " << iter.get_iteration() <<
" iteration(s).");
133 STORM_LOG_WARN(
"Iterative solver did not converge within " << iter.get_iteration() <<
" iteration(s).");
141 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for GMM. Yet, a method was called that "
142 "requires this support.";