Browse Source

removed eigen usages

tempestpy_adaptions
TimQu 8 years ago
parent
commit
362b3bf6c6
  1. 5
      resources/3rdparty/CMakeLists.txt
  2. 8
      src/storm/adapters/EigenAdapter.cpp
  3. 2
      src/storm/adapters/EigenAdapter.h
  4. 4
      src/storm/cli/cli.cpp
  5. 29
      src/storm/solver/EigenLinearEquationSolver.cpp

5
resources/3rdparty/CMakeLists.txt

@ -43,8 +43,8 @@ list(APPEND STORM_DEP_TARGETS gmm)
##
#############################################################
add_imported_library_interface(Eigen33 "${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen-3.3-beta1")
list(APPEND STORM_DEP_TARGETS Eigen33)
# add_imported_library_interface(Eigen33 "${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen-3.3-beta1")
# list(APPEND STORM_DEP_TARGETS Eigen33)
#############################################################
@ -585,3 +585,4 @@ if(ENABLE_CUDA)
endif()
add_custom_target(copy_resources_headers DEPENDS ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h)

8
src/storm/adapters/EigenAdapter.cpp

@ -5,6 +5,8 @@ namespace storm {
template<typename ValueType>
std::unique_ptr<Eigen::SparseMatrix<ValueType>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<ValueType> const& matrix) {
return nullptr;
/*
// Build a list of triplets and let Eigen care about the insertion.
std::vector<Eigen::Triplet<ValueType>> triplets;
triplets.reserve(matrix.getNonzeroEntryCount());
@ -18,13 +20,13 @@ namespace storm {
std::unique_ptr<Eigen::SparseMatrix<ValueType>> result = std::make_unique<Eigen::SparseMatrix<ValueType>>(matrix.getRowCount(), matrix.getColumnCount());
result->setFromTriplets(triplets.begin(), triplets.end());
return result;
}
*/ }
template std::unique_ptr<Eigen::SparseMatrix<double>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<double> const& matrix);
#ifdef STORM_HAVE_CARL
template std::unique_ptr<Eigen::SparseMatrix<storm::RationalNumber>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<storm::RationalNumber> const& matrix);
template std::unique_ptr<Eigen::SparseMatrix<storm::RationalFunction>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<storm::RationalFunction> const& matrix);
// template std::unique_ptr<Eigen::SparseMatrix<storm::RationalNumber>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<storm::RationalNumber> const& matrix);
// template std::unique_ptr<Eigen::SparseMatrix<storm::RationalFunction>> EigenAdapter::toEigenSparseMatrix(storm::storage::SparseMatrix<storm::RationalFunction> const& matrix);
#endif
}
}

2
src/storm/adapters/EigenAdapter.h

@ -1,7 +1,7 @@
#pragma once
#include <memory>
#include <iostream>
#include "storm/utility/eigen.h"
#include "storm/storage/SparseMatrix.h"

4
src/storm/cli/cli.cpp

@ -135,14 +135,14 @@ namespace storm {
getrusage(RUSAGE_SELF, &ru);
std::cout << "Performance statistics:" << std::endl;
std::cout << " * peak memory usage: " << ru.ru_maxrss/1024/1024 << " mb" << std::endl;
std::cout << " * peak memory usage: " << ru.ru_maxrss/1024 << " mb" << std::endl;
std::cout << " * CPU time: " << ru.ru_utime.tv_sec << "." << std::setw(3) << std::setfill('0') << ru.ru_utime.tv_usec/1000 << " seconds" << std::endl;
if (wallclockMilliseconds != 0) {
std::cout << " * wallclock time: " << (wallclockMilliseconds/1000) << "." << std::setw(3) << std::setfill('0') << (wallclockMilliseconds % 1000) << " seconds" << std::endl;
}
std::cout << "STATISTICS_OVERALL_HEADERS;" << "memory;CPU time;wallclock time;" << std::endl;
std::cout << "STATISTICS_OVERALL_DATA;"
<< ru.ru_maxrss/1024/1024 << ";"
<< ru.ru_maxrss/1024 << ";"
<< ru.ru_utime.tv_sec << "." << std::setw(3) << std::setfill('0') << ru.ru_utime.tv_usec/1000 << ";"
<< (wallclockMilliseconds/1000) << "." << std::setw(3) << std::setfill('0') << (wallclockMilliseconds % 1000) << ";" << std::endl;
#else

29
src/storm/solver/EigenLinearEquationSolver.cpp

@ -105,7 +105,8 @@ namespace storm {
#endif
template<typename ValueType>
EigenLinearEquationSolver<ValueType>::EigenLinearEquationSolver(storm::storage::SparseMatrix<ValueType> const& A, EigenLinearEquationSolverSettings<ValueType> const& settings) : eigenA(storm::adapters::EigenAdapter::toEigenSparseMatrix<ValueType>(A)), settings(settings) {
EigenLinearEquationSolver<ValueType>::EigenLinearEquationSolver(storm::storage::SparseMatrix<ValueType> const& A, EigenLinearEquationSolverSettings<ValueType> const& settings) : settings(settings) {
std::cout << "eigen eq solver disabled since it requires a custom version that we disabled in this build." << std::endl;
// Intentionally left empty.
}
@ -116,7 +117,7 @@ namespace storm {
template<typename ValueType>
void EigenLinearEquationSolver<ValueType>::setMatrix(storm::storage::SparseMatrix<ValueType> const& A) {
eigenA = storm::adapters::EigenAdapter::toEigenSparseMatrix<ValueType>(A);
// eigenA = storm::adapters::EigenAdapter::toEigenSparseMatrix<ValueType>(A);
this->clearCache();
}
@ -131,7 +132,8 @@ namespace storm {
template<typename ValueType>
bool EigenLinearEquationSolver<ValueType>::solveEquations(std::vector<ValueType>& x, std::vector<ValueType> const& b) const {
// Map the input vectors to Eigen's format.
auto eigenX = Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(x.data(), x.size());
return false;
/* auto eigenX = Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(x.data(), x.size());
auto eigenB = Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(b.data(), b.size());
typename EigenLinearEquationSolverSettings<ValueType>::SolutionMethod solutionMethod = this->getSettings().getSolutionMethod();
@ -218,12 +220,12 @@ namespace storm {
}
}
}
return false;
return false; */
}
template<typename ValueType>
void EigenLinearEquationSolver<ValueType>::multiply(std::vector<ValueType>& x, std::vector<ValueType> const* b, std::vector<ValueType>& result) const {
// Typedef the map-type so we don't have to spell it out.
/* // Typedef the map-type so we don't have to spell it out.
typedef decltype(Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(b->data(), b->size())) MapType;
auto eigenX = Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(x.data(), x.size());
@ -247,7 +249,8 @@ namespace storm {
eigenResult = *eigenA * eigenX;
}
}
}
*/
}
template<typename ValueType>
EigenLinearEquationSolverSettings<ValueType>& EigenLinearEquationSolver<ValueType>::getSettings() {
@ -261,19 +264,20 @@ namespace storm {
template<typename ValueType>
uint64_t EigenLinearEquationSolver<ValueType>::getMatrixRowCount() const {
return eigenA->rows();
return 0; // eigenA->rows();
}
template<typename ValueType>
uint64_t EigenLinearEquationSolver<ValueType>::getMatrixColumnCount() const {
return eigenA->cols();
return 0; //eigenA->cols();
}
#ifdef STORM_HAVE_CARL
// Specialization for storm::RationalNumber
template<>
bool EigenLinearEquationSolver<storm::RationalNumber>::solveEquations(std::vector<storm::RationalNumber>& x, std::vector<storm::RationalNumber> const& b) const {
// Map the input vectors to Eigen's format.
return false; /*
// Map the input vectors to Eigen's format.
auto eigenX = Eigen::Matrix<storm::RationalNumber, Eigen::Dynamic, 1>::Map(x.data(), x.size());
auto eigenB = Eigen::Matrix<storm::RationalNumber, Eigen::Dynamic, 1>::Map(b.data(), b.size());
@ -281,12 +285,13 @@ namespace storm {
solver.compute(*eigenA);
solver._solve_impl(eigenB, eigenX);
return solver.info() == Eigen::ComputationInfo::Success;
}
*/ }
// Specialization for storm::RationalFunction
template<>
bool EigenLinearEquationSolver<storm::RationalFunction>::solveEquations(std::vector<storm::RationalFunction>& x, std::vector<storm::RationalFunction> const& b) const {
// Map the input vectors to Eigen's format.
return false; /*
// Map the input vectors to Eigen's format.
auto eigenX = Eigen::Matrix<storm::RationalFunction, Eigen::Dynamic, 1>::Map(x.data(), x.size());
auto eigenB = Eigen::Matrix<storm::RationalFunction, Eigen::Dynamic, 1>::Map(b.data(), b.size());
@ -294,7 +299,7 @@ namespace storm {
solver.compute(*eigenA);
solver._solve_impl(eigenB, eigenX);
return solver.info() == Eigen::ComputationInfo::Success;
}
*/}
#endif
template<typename ValueType>

Loading…
Cancel
Save