From 8153306cede1375a848cdde00fd72098733a20e1 Mon Sep 17 00:00:00 2001 From: dehnert Date: Sat, 25 Jun 2016 15:33:41 +0200 Subject: [PATCH] fixed wrong call to Eigen's iterative solvers Former-commit-id: 0e2e83672952e375dc0963675b4dfd27943ac2b3 --- src/solver/EigenLinearEquationSolver.cpp | 18 +++++++++--------- .../solver/EigenLinearEquationSolverTest.cpp | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/solver/EigenLinearEquationSolver.cpp b/src/solver/EigenLinearEquationSolver.cpp index 9dbeae8c8..85a88510d 100644 --- a/src/solver/EigenLinearEquationSolver.cpp +++ b/src/solver/EigenLinearEquationSolver.cpp @@ -132,19 +132,19 @@ namespace storm { solver.compute(*this->eigenA); solver.setTolerance(this->getSettings().getPrecision()); solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); - solver.solveWithGuess(eigenB, eigenX); + eigenX = 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); + eigenX = 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); + eigenX = solver.solveWithGuess(eigenB, eigenX); } } else if (solutionMethod == EigenLinearEquationSolverSettings::SolutionMethod::DGMRES) { if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Ilu) { @@ -153,21 +153,21 @@ namespace storm { solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); - solver.solveWithGuess(eigenB, eigenX); + eigenX = 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); + eigenX = 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); + eigenX = solver.solveWithGuess(eigenB, eigenX); } } else if (solutionMethod == EigenLinearEquationSolverSettings::SolutionMethod::GMRES) { if (preconditioner == EigenLinearEquationSolverSettings::Preconditioner::Ilu) { @@ -176,21 +176,21 @@ namespace storm { solver.setMaxIterations(this->getSettings().getMaximalNumberOfIterations()); solver.set_restart(this->getSettings().getNumberOfIterationsUntilRestart()); solver.compute(*this->eigenA); - solver.solveWithGuess(eigenB, eigenX); + eigenX = 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); + eigenX = 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); + eigenX = solver.solveWithGuess(eigenB, eigenX); } } } diff --git a/test/functional/solver/EigenLinearEquationSolverTest.cpp b/test/functional/solver/EigenLinearEquationSolverTest.cpp index 126eeaf3a..0139e627a 100644 --- a/test/functional/solver/EigenLinearEquationSolverTest.cpp +++ b/test/functional/solver/EigenLinearEquationSolverTest.cpp @@ -116,7 +116,7 @@ TEST(EigenLinearEquationSolver, SparseLU_RationalFunction) { ASSERT_TRUE(x[2] == storm::RationalFunction(-1)); } -TEST(DISABLED_EigenLinearEquationSolver, DGMRES) { +TEST(EigenLinearEquationSolver, DGMRES) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -148,7 +148,7 @@ TEST(DISABLED_EigenLinearEquationSolver, DGMRES) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Ilu) { +TEST(EigenLinearEquationSolver, DGMRES_Ilu) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -178,7 +178,7 @@ TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Ilu) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Diagonal) { +TEST(EigenLinearEquationSolver, DGMRES_Diagonal) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -208,7 +208,7 @@ TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Diagonal) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, GMRES) { +TEST(EigenLinearEquationSolver, GMRES) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -240,7 +240,7 @@ TEST(DISABLED_EigenLinearEquationSolver, GMRES) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, GMRES_Ilu) { +TEST(EigenLinearEquationSolver, GMRES_Ilu) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -270,7 +270,7 @@ TEST(DISABLED_EigenLinearEquationSolver, GMRES_Ilu) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, GMRES_Diagonal) { +TEST(EigenLinearEquationSolver, GMRES_Diagonal) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -300,7 +300,7 @@ TEST(DISABLED_EigenLinearEquationSolver, GMRES_Diagonal) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB) { +TEST(EigenLinearEquationSolver, BiCGSTAB) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -331,7 +331,7 @@ TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB_Ilu) { +TEST(EigenLinearEquationSolver, BiCGSTAB_Ilu) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2)); @@ -361,7 +361,7 @@ TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB_Ilu) { ASSERT_LT(std::abs(x[2] - (-1)), storm::settings::getModule().getPrecision()); } -TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB_Diagonal) { +TEST(EigenLinearEquationSolver, BiCGSTAB_Diagonal) { ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder builder); storm::storage::SparseMatrixBuilder builder; ASSERT_NO_THROW(builder.addNextValue(0, 0, 2));