diff --git a/src/storm/solver/EigenLinearEquationSolver.cpp b/src/storm/solver/EigenLinearEquationSolver.cpp index e704a3f20..91b0d7bda 100644 --- a/src/storm/solver/EigenLinearEquationSolver.cpp +++ b/src/storm/solver/EigenLinearEquationSolver.cpp @@ -143,6 +143,8 @@ namespace storm { template void EigenLinearEquationSolver::setMatrix(storm::storage::SparseMatrix const& A) { + std::cout << A << std::endl; + eigenA = storm::adapters::EigenAdapter::toEigenSparseMatrix(A); this->clearCache(); } @@ -358,7 +360,14 @@ namespace storm { StormEigen::SparseLU, StormEigen::COLAMDOrdering> solver; solver.compute(*eigenA); solver._solve_impl(eigenB, eigenX); - + + std::cout << "solution" << std::endl; + uint64_t pos = 0; + for (auto const& e : x) { + std::cout << "[" << pos << "] " << e << std::endl; + ++pos; + } + return solver.info() == StormEigen::ComputationInfo::Success; } diff --git a/src/storm/solver/NativeLinearEquationSolver.cpp b/src/storm/solver/NativeLinearEquationSolver.cpp index bd41cf80e..d17a2eb4d 100644 --- a/src/storm/solver/NativeLinearEquationSolver.cpp +++ b/src/storm/solver/NativeLinearEquationSolver.cpp @@ -146,12 +146,15 @@ namespace storm { localA.reset(); this->A = &A; clearCache(); + + std::cout << *this->A << std::endl; } template void NativeLinearEquationSolver::setMatrix(storm::storage::SparseMatrix&& A) { localA = std::make_unique>(std::move(A)); this->A = localA.get(); + std::cout << *this->A << std::endl; clearCache(); } @@ -698,7 +701,25 @@ namespace storm { typename NativeLinearEquationSolver::PowerIterationResult result = impreciseSolver.performPowerIteration(currentX, newX, b, storm::utility::convertNumber(precision), this->getSettings().getRelativeTerminationCriterion(), SolverGuarantee::LessOrEqual, overallIterations); // At this point, the result of the imprecise value iteration is stored in the (imprecise) current x. - + std::cout << "solution" << std::endl; + uint64_t pos = 0; + for (auto const& e : *currentX) { + std::cout << "[" << pos << "] " << e << std::endl; + ++pos; + } + std::cout << "rational b" << std::endl; + pos = 0; + for (auto const& e : rationalB) { + std::cout << "[" << pos << "] " << e << std::endl; + ++pos; + } + std::cout << "b" << std::endl; + pos = 0; + for (auto const& e : b) { + std::cout << "[" << pos << "] " << e << std::endl; + ++pos; + } + ++valueIterationInvocations; STORM_LOG_TRACE("Completed " << valueIterationInvocations << " power iteration invocations, the last one with precision " << precision << " completed in " << result.iterations << " iterations."); diff --git a/src/storm/storage/SparseMatrix.cpp b/src/storm/storage/SparseMatrix.cpp index 9588b415c..643802b56 100644 --- a/src/storm/storage/SparseMatrix.cpp +++ b/src/storm/storage/SparseMatrix.cpp @@ -1403,17 +1403,21 @@ namespace storm { summandIterator = summand->end() - 1; } - for (; resultIterator != resultIteratorEnd; --rowIterator, --resultIterator) { + for (; resultIterator != resultIteratorEnd; --rowIterator, --resultIterator, --summandIterator) { if (summand) { *resultIterator = *summandIterator; - --summandIterator; + std::cout << "row[" << std::distance(rowIndications.begin(), rowIterator) << "]: " << *resultIterator << " because of summand" << std::endl; } else { *resultIterator = storm::utility::zero(); } for (ite = this->begin() + *rowIterator - 1; it != ite; --it) { - *resultIterator += it->getValue() * vector[it->getColumn()]; + std::cout << "row[" << std::distance(rowIndications.begin(), rowIterator) << "]: " << *resultIterator << std::endl; + std::cout << "row[" << std::distance(rowIndications.begin(), rowIterator) << "]: op " << *resultIterator << " + " << (it->getValue() * vector[it->getColumn()]) << " (= " << it->getValue() << " * " << vector[it->getColumn()] << ") = " << (*resultIterator + (it->getValue() * vector[it->getColumn()])) << std::endl; + *resultIterator = *resultIterator + (it->getValue() * vector[it->getColumn()]); +// std::cout << "row[" << std::distance(rowIndications.begin(), rowIterator) << "]: " << *resultIterator << " because of " << it->getValue() << " * " << vector[it->getColumn()] << " = " << (it->getValue() * vector[it->getColumn()]) << std::endl; } + std::cout << "row[" << std::distance(rowIndications.begin(), rowIterator) << "] final value " << *resultIterator << std::endl; } }