Changed interface of matrix builder slightly to be able to also not force the resulting matrix to certain dimensions, but merely to reserve the desired space.
LOG4CPLUS_INFO(logger,"Attempting to create matrix of size "<<firstPass.choices<<" x "<<(firstPass.highestStateIndex+1)<<" with "<<firstPass.numberOfNonzeroEntries<<" entries.");
// In case we did not expect this value, we throw an exception.
if(forceInitialDimensions){
LOG_THROW(!initialRowCountSet||lastRow<initialRowCount,storm::exceptions::OutOfRangeException,"Cannot insert value at illegal row "<<lastRow<<".");
LOG_THROW(!initialColumnCountSet||lastColumn<initialColumnCount,storm::exceptions::OutOfRangeException,"Cannot insert value at illegal column "<<lastColumn<<".");
LOG_THROW(!initialEntryCountSet||currentEntryCount<=initialEntryCount,storm::exceptions::OutOfRangeException,"Too many entries in matrix, expected only "<<initialEntryCount<<".");
throwstorm::exceptions::InvalidStateException()<<"Illegal call to SparseMatrix::newRowGroup: illegal row group with negative size.";
}
LOG_THROW(hasCustomRowGrouping,storm::exceptions::InvalidStateException,"Matrix was not created to have a custom row grouping.");
LOG_THROW(rowGroupIndices.empty()||startingRow>=rowGroupIndices.back(),storm::exceptions::InvalidStateException,"Illegal row group with negative size.");
LOG_THROW(rowCount<=initialRowCount,storm::exceptions::InvalidStateException,"Expected not more than "<<initialRowCount<<" rows, but got "<<rowCount<<".");
rowCount=std::max(rowCount,initialRowCount);
}
rowCount=std::max(rowCount,overriddenRowCount);
// If the current row count was overridden, we may need to add empty rows.
if(overriddenRowCount>rowCount){
for(index_typei=lastRow+1;i<rowCount;++i){
rowIndications.push_back(currentEntryCount);
}
}
// We put a sentinel element at the last position of the row indices array. This eases iteration work,
// as now the indices of row i are always between rowIndications[i] and rowIndications[i + 1], also for
// the first and last row.
rowIndications.push_back(currentEntryCount);
// Check whether the column count has been overridden.
LOG_THROW(columnCount<=initialColumnCount,storm::exceptions::InvalidStateException,"Expected not more than "<<initialColumnCount<<" columns, but got "<<columnCount<<".");
LOG_THROW(rowGroupCount<=initialRowGroupCount,storm::exceptions::InvalidStateException,"Expected not more than "<<initialRowGroupCount<<" row groups, but got "<<rowGroupCount<<".");