Browse Source

Added row grouping members (but not the needed logic)

Former-commit-id: c4f7319e85
main
Mavo 9 years ago
parent
commit
49dc27077c
  1. 13
      src/storage/FlexibleSparseMatrix.cpp
  2. 19
      src/storage/FlexibleSparseMatrix.h
  3. 5
      src/storage/SparseMatrix.cpp
  4. 7
      src/storage/SparseMatrix.h

13
src/storage/FlexibleSparseMatrix.cpp

@ -13,7 +13,13 @@ namespace storm {
}
template<typename ValueType>
FlexibleSparseMatrix<ValueType>::FlexibleSparseMatrix(storm::storage::SparseMatrix<ValueType> const& matrix, bool setAllValuesToOne) : data(matrix.getRowCount()), columnCount(matrix.getColumnCount()), nonzeroEntryCount(matrix.getNonzeroEntryCount()) {
FlexibleSparseMatrix<ValueType>::FlexibleSparseMatrix(storm::storage::SparseMatrix<ValueType> const& matrix, bool setAllValuesToOne) : data(matrix.getRowCount()), columnCount(matrix.getColumnCount()), nonzeroEntryCount(matrix.getNonzeroEntryCount()), nontrivialRowGrouping(matrix.hasNontrivialRowGrouping()) {
if (nontrivialRowGrouping) {
rowGroupIndices = matrix.getRowGroupIndices();
rowIndications = matrix.getRowIndications();
// Not fully implemented yet
assert(false);
}
for (index_type rowIndex = 0; rowIndex < matrix.getRowCount(); ++rowIndex) {
typename storm::storage::SparseMatrix<ValueType>::const_rows row = matrix.getRow(rowIndex);
reserveInRow(rowIndex, row.getNumberOfEntries());
@ -83,6 +89,11 @@ namespace storm {
}
return true;
}
template<typename ValueType>
bool SparseMatrix<ValueType>::hasNontrivialRowGrouping() const {
return nontrivialRowGrouping;
}
template<typename ValueType>
void FlexibleSparseMatrix<ValueType>::createSubmatrix(storm::storage::BitVector const& rowConstraint, storm::storage::BitVector const& columnConstraint) {

19
src/storage/FlexibleSparseMatrix.h

@ -23,6 +23,7 @@ namespace storm {
// TODO: make this class a bit more consistent with the big sparse matrix and improve it:
// * add output iterator and improve the way the matrix is printed
// * add stuff like clearRow, multiplyRowWithScalar
// * implement row grouping
typedef uint_fast64_t index_type;
typedef ValueType value_type;
@ -102,6 +103,13 @@ namespace storm {
* @return True, if the matrix is empty.
*/
bool empty() const;
/*!
* Retrieves whether the matrix has a (possibly) non-trivial row grouping.
*
* @return True iff the matrix has a (possibly) non-trivial row grouping.
*/
bool hasNontrivialRowGrouping() const;
/*!
* Creates a submatrix of the current matrix in place by dropping all rows and columns whose bits are not
@ -137,6 +145,17 @@ namespace storm {
// The number of entries in the matrix.
index_type nonzeroEntryCount;
// A vector containing the indices at which each given row begins. The values of the entries in row i are
// data[rowIndications[i]] to data[rowIndications[i + 1]] where the last entry is not included anymore.
std::vector<index_type> rowIndications;
// A flag that indicates whether the matrix has a non-trivial row-grouping, i.e. (possibly) more than one
// row per row group.
bool nontrivialRowGrouping;
// A vector indicating the row groups of the matrix.
std::vector<index_type> rowGroupIndices;
};
}
}

5
src/storage/SparseMatrix.cpp

@ -451,6 +451,11 @@ namespace storm {
std::vector<typename SparseMatrix<ValueType>::index_type> const& SparseMatrix<ValueType>::getRowGroupIndices() const {
return rowGroupIndices;
}
template<typename ValueType>
std::vector<typename SparseMatrix<ValueType>::index_type> const& SparseMatrix<ValueType>::getRowIndications() const {
return rowIndications;
}
template<typename ValueType>
void SparseMatrix<ValueType>::makeRowsAbsorbing(storm::storage::BitVector const& rows) {

7
src/storage/SparseMatrix.h

@ -549,6 +549,13 @@ namespace storm {
*/
std::vector<index_type> const& getRowGroupIndices() const;
/*!
* Returns the indices where new row groups start.
*
* @return The indices where new row groups start.
*/
std::vector<index_type> const& getRowIndications() const;
/*!
* This function makes the given rows absorbing.
*

Loading…
Cancel
Save