Browse Source

SparseMatrix: Create a pretty string of the matrix dimensions.

tempestpy_adaptions
Tim Quatmann 6 years ago
parent
commit
cf25f2f941
  1. 11
      src/storm/storage/SparseMatrix.cpp
  2. 5
      src/storm/storage/SparseMatrix.h

11
src/storm/storage/SparseMatrix.cpp

@ -2150,6 +2150,17 @@ namespace storm {
return true;
}
template<typename ValueType>
std::string SparseMatrix<ValueType>::getDimensionsAsString() const {
std::string result = std::to_string(getRowCount()) + "x" + std::to_string(getColumnCount()) + " matrix (" + std::to_string(getNonzeroEntryCount()) + " non-zeroes";
if (!hasTrivialRowGrouping()) {
result += ", " + std::to_string(getRowGroupCount()) + " groups";
}
result += ")";
return result;
}
template<typename ValueType>
std::ostream& operator<<(std::ostream& out, SparseMatrix<ValueType> const& matrix) {
// Print column numbers in header.

5
src/storm/storage/SparseMatrix.h

@ -963,6 +963,11 @@ namespace storm {
template<typename TPrime>
friend std::ostream& operator<<(std::ostream& out, SparseMatrix<TPrime> const& matrix);
/*!
* Returns a string describing the dimensions of the matrix.
*/
std::string getDimensionsAsString() const;
/*!
* Prints the matrix in a dense format, as also used by e.g. Matlab.
* Notice that the format does not support multiple rows in a rowgroup.

Loading…
Cancel
Save