Browse Source

fixed wrong call to Eigen's iterative solvers

Former-commit-id: 0e2e836729
tempestpy_adaptions
dehnert 9 years ago
parent
commit
8153306ced
  1. 18
      src/solver/EigenLinearEquationSolver.cpp
  2. 18
      test/functional/solver/EigenLinearEquationSolverTest.cpp

18
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<ValueType>::Preconditioner::Diagonal) {
Eigen::BiCGSTAB<Eigen::SparseMatrix<ValueType>, Eigen::DiagonalPreconditioner<ValueType>> 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::SparseMatrix<ValueType>, 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<ValueType>::SolutionMethod::DGMRES) {
if (preconditioner == EigenLinearEquationSolverSettings<ValueType>::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<ValueType>::Preconditioner::Diagonal) {
Eigen::DGMRES<Eigen::SparseMatrix<ValueType>, Eigen::DiagonalPreconditioner<ValueType>> 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::SparseMatrix<ValueType>, 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<ValueType>::SolutionMethod::GMRES) {
if (preconditioner == EigenLinearEquationSolverSettings<ValueType>::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<ValueType>::Preconditioner::Diagonal) {
Eigen::GMRES<Eigen::SparseMatrix<ValueType>, Eigen::DiagonalPreconditioner<ValueType>> 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::SparseMatrix<ValueType>, 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);
}
}
}

18
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<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Ilu) {
TEST(EigenLinearEquationSolver, DGMRES_Ilu) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, DGMRES_Diagonal) {
TEST(EigenLinearEquationSolver, DGMRES_Diagonal) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, GMRES) {
TEST(EigenLinearEquationSolver, GMRES) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, GMRES_Ilu) {
TEST(EigenLinearEquationSolver, GMRES_Ilu) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, GMRES_Diagonal) {
TEST(EigenLinearEquationSolver, GMRES_Diagonal) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB) {
TEST(EigenLinearEquationSolver, BiCGSTAB) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB_Ilu) {
TEST(EigenLinearEquationSolver, BiCGSTAB_Ilu) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> 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<storm::settings::modules::EigenEquationSolverSettings>().getPrecision());
}
TEST(DISABLED_EigenLinearEquationSolver, BiCGSTAB_Diagonal) {
TEST(EigenLinearEquationSolver, BiCGSTAB_Diagonal) {
ASSERT_NO_THROW(storm::storage::SparseMatrixBuilder<double> builder);
storm::storage::SparseMatrixBuilder<double> builder;
ASSERT_NO_THROW(builder.addNextValue(0, 0, 2));

Loading…
Cancel
Save