7template<
typename ValueType>
10 std::vector<Eigen::Triplet<ValueType>> triplets;
13 for (uint64_t row = 0; row < matrix.
getRowCount(); ++row) {
14 for (
auto const& element : matrix.
getRow(row)) {
15 triplets.emplace_back(row, element.getColumn(), element.getValue());
19 std::unique_ptr<Eigen::SparseMatrix<ValueType>> result = std::make_unique<Eigen::SparseMatrix<ValueType>>(matrix.
getRowCount(), matrix.
getColumnCount());
20 result->setFromTriplets(triplets.begin(), triplets.end());
24template<
typename ValueType>
26 return std::vector<ValueType>(v.data(), v.data() + v.rows());
29template<
typename ValueType>
31 return Eigen::Matrix<ValueType, Eigen::Dynamic, 1>::Map(v.data(), v.size());
41template std::vector<storm::RationalNumber>
EigenAdapter::toStdVector(Eigen::Matrix<storm::RationalNumber, Eigen::Dynamic, 1>
const& v);
42template Eigen::Matrix<storm::RationalNumber, Eigen::Dynamic, 1>
EigenAdapter::toEigenVector(std::vector<storm::RationalNumber>
const& v);
46template std::vector<storm::RationalFunction>
EigenAdapter::toStdVector(Eigen::Matrix<storm::RationalFunction, Eigen::Dynamic, 1>
const& v);
47template Eigen::Matrix<storm::RationalFunction, Eigen::Dynamic, 1>
EigenAdapter::toEigenVector(std::vector<storm::RationalFunction>
const& v);
static Eigen::Matrix< ValueType, Eigen::Dynamic, 1 > toEigenVector(std::vector< ValueType > const &v)
static std::unique_ptr< Eigen::SparseMatrix< ValueType > > toEigenSparseMatrix(storm::storage::SparseMatrix< ValueType > const &matrix)
Converts a sparse matrix into a sparse matrix in the gmm++ format.
static std::vector< ValueType > toStdVector(Eigen::Matrix< ValueType, Eigen::Dynamic, 1 > const &v)
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRow(index_type row) const
Returns an object representing the given row.
index_type getColumnCount() const
Returns the number of columns of the matrix.
index_type getRowCount() const
Returns the number of rows of the matrix.
index_type getNonzeroEntryCount() const
Returns the cached number of nonzero entries in the matrix.