From 447285d6dd16ed60948ada194f3a591be224d6c8 Mon Sep 17 00:00:00 2001 From: David_Korzeniewski Date: Thu, 22 Jan 2015 20:11:31 +0100 Subject: [PATCH] Fixed merge error Former-commit-id: 18d5d06921e9a266131c1976fae322dbaa25684d --- src/storage/SparseMatrix.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/storage/SparseMatrix.h b/src/storage/SparseMatrix.h index 856261c4f..8a98c1b57 100644 --- a/src/storage/SparseMatrix.h +++ b/src/storage/SparseMatrix.h @@ -772,6 +772,23 @@ namespace storm { * @return An iterator that points past the end of the last row of the matrix. */ iterator end(); + + /*! + * Returns a copy of the matrix with the chosen internal data type + */ + template + SparseMatrix toValueType() const { + std::vector> new_columnsAndValues; + std::vector new_rowIndications(rowIndications); + std::vector new_rowGroupIndices(rowGroupIndices); + + new_columnsAndValues.resize(columnsAndValues.size()); + for (size_t i = 0, size = columnsAndValues.size(); i < size; ++i) { + new_columnsAndValues.at(i) = MatrixEntry(columnsAndValues.at(i).getColumn(), static_cast(columnsAndValues.at(i).getValue())); + } + + return SparseMatrix(columnCount, std::move(new_rowIndications), std::move(new_columnsAndValues), std::move(new_rowGroupIndices)); + } private: /*!