diff --git a/src/storage/SparseMatrix.cpp b/src/storage/SparseMatrix.cpp index df78e4e2d..99e21ee0d 100644 --- a/src/storage/SparseMatrix.cpp +++ b/src/storage/SparseMatrix.cpp @@ -1067,22 +1067,22 @@ namespace storm { template typename SparseMatrix::const_rows SparseMatrix::getRows(index_type startRow, index_type endRow) const { - return const_rows(this->columnsAndValues.begin() + this->rowIndications[startRow], this->rowIndications[endRow + 1] - this->rowIndications[startRow]); + return const_rows(this->columnsAndValues.begin() + this->rowIndications[startRow], this->rowIndications[endRow] - this->rowIndications[startRow]); } template typename SparseMatrix::rows SparseMatrix::getRows(index_type startRow, index_type endRow) { - return rows(this->columnsAndValues.begin() + this->rowIndications[startRow], this->rowIndications[endRow + 1] - this->rowIndications[startRow]); + return rows(this->columnsAndValues.begin() + this->rowIndications[startRow], this->rowIndications[endRow] - this->rowIndications[startRow]); } template typename SparseMatrix::const_rows SparseMatrix::getRow(index_type row) const { - return getRows(row, row); + return getRows(row, row + 1); } template typename SparseMatrix::rows SparseMatrix::getRow(index_type row) { - return getRows(row, row); + return getRows(row, row + 1); } template @@ -1096,7 +1096,6 @@ namespace storm { } } - template typename SparseMatrix::rows SparseMatrix::getRow(index_type rowGroup, index_type offset) { STORM_LOG_ASSERT(rowGroup < this->getRowGroupCount(), "Row group is out-of-bounds."); @@ -1104,6 +1103,7 @@ namespace storm { if (!this->hasTrivialRowGrouping()) { return getRow(this->getRowGroupIndices()[rowGroup] + offset); } else { + STORM_LOG_ASSERT(offset == 0, "Invalid offset."); return getRow(rowGroup + offset); } } @@ -1113,7 +1113,7 @@ namespace storm { typename SparseMatrix::const_rows SparseMatrix::getRowGroup(index_type rowGroup) const { STORM_LOG_ASSERT(rowGroup < this->getRowGroupCount(), "Row group is out-of-bounds."); if (!this->hasTrivialRowGrouping()) { - return getRows(this->getRowGroupIndices()[rowGroup], this->getRowGroupIndices()[rowGroup + 1] - 1); + return getRows(this->getRowGroupIndices()[rowGroup], this->getRowGroupIndices()[rowGroup + 1]); } else { return getRows(rowGroup, rowGroup + 1); } @@ -1123,7 +1123,7 @@ namespace storm { typename SparseMatrix::rows SparseMatrix::getRowGroup(index_type rowGroup) { STORM_LOG_ASSERT(rowGroup < this->getRowGroupCount(), "Row group is out-of-bounds."); if (!this->hasTrivialRowGrouping()) { - return getRows(this->getRowGroupIndices()[rowGroup], this->getRowGroupIndices()[rowGroup + 1] - 1); + return getRows(this->getRowGroupIndices()[rowGroup], this->getRowGroupIndices()[rowGroup + 1]); } else { return getRows(rowGroup, rowGroup + 1); } diff --git a/src/storage/SparseMatrix.h b/src/storage/SparseMatrix.h index 730e018f2..c5c7133c6 100644 --- a/src/storage/SparseMatrix.h +++ b/src/storage/SparseMatrix.h @@ -805,7 +805,7 @@ namespace storm { * Returns an object representing the consecutive rows given by the parameters. * * @param startRow The starting row. - * @param endRow The ending row (which is included in the result). + * @param endRow The ending row (which is *not* included in the result). * @return An object representing the consecutive rows given by the parameters. */ const_rows getRows(index_type startRow, index_type endRow) const; @@ -814,7 +814,7 @@ namespace storm { * Returns an object representing the consecutive rows given by the parameters. * * @param startRow The starting row. - * @param endRow The ending row (which is included in the result). + * @param endRow The ending row (which is *not* included in the result). * @return An object representing the consecutive rows given by the parameters. */ rows getRows(index_type startRow, index_type endRow);