From 46ce68743ce3044c03a6c98d1df3fdc4f3e61cc2 Mon Sep 17 00:00:00 2001 From: dehnert Date: Fri, 24 Jun 2016 23:07:43 +0200 Subject: [PATCH] enabled precision/max iterations for eigen solver Former-commit-id: 370a78a02f8ff06e666d0c650279a84d8f15e764 --- src/solver/EigenLinearEquationSolver.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/solver/EigenLinearEquationSolver.cpp b/src/solver/EigenLinearEquationSolver.cpp index 995ea2612..9dbeae8c8 100644 --- a/src/solver/EigenLinearEquationSolver.cpp +++ b/src/solver/EigenLinearEquationSolver.cpp @@ -130,29 +130,41 @@ namespace storm { if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Ilu) { Eigen::BiCGSTAB, Eigen::IncompleteLUT> solver; solver.compute(*this->eigenA); + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.solveWithGuess(eigenB, eigenX); } else if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Diagonal) { Eigen::BiCGSTAB, Eigen::DiagonalPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } else { Eigen::BiCGSTAB, Eigen::IdentityPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } } else if (solutionMethod == EigenLinearEquationSolverSettings::SolutionMethod::DGMRES) { if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Ilu) { Eigen::DGMRES, Eigen::IncompleteLUT> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } else if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Diagonal) { Eigen::DGMRES, Eigen::DiagonalPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } else { Eigen::DGMRES, Eigen::IdentityPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); @@ -160,16 +172,22 @@ namespace storm { } else if (solutionMethod == EigenLinearEquationSolverSettings::SolutionMethod::GMRES) { if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Ilu) { Eigen::GMRES, Eigen::IncompleteLUT> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } else if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Diagonal) { Eigen::GMRES, Eigen::DiagonalPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX); } else { Eigen::GMRES, Eigen::IdentityPreconditioner> solver; + solver.setTolerance(this->getSettings().getPrecision()); + solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); solver.solveWithGuess(eigenB, eigenX);