// Depending on whether the internal data storage was preallocated or not, adding the value is done somewhat
// differently.
if(storagePreallocated){
// Check whether the given row and column positions are valid and throw error otherwise.
if(row>=rowCount||column>=columnCount){
throwstorm::exceptions::OutOfRangeException()<<"Illegal call to SparseMatrixBuilder::addNextValue: adding entry at out-of-bounds position ("<<row<<", "<<column<<") in matrix of size ("<<rowCount<<", "<<columnCount<<").";
}
}else{
if(rowCountSet){
if(row>=rowCount){
throwstorm::exceptions::OutOfRangeException()<<"Illegal call to SparseMatrixBuilder::addNextValue: adding entry at out-of-bounds row "<<row<<" in matrix with "<<rowCount<<" rows.";
}
}
if(columnCountSet){
if(column>=columnCount){
throwstorm::exceptions::OutOfRangeException()<<"Illegal call to SparseMatrixBuilder::addNextValue: adding entry at out-of-bounds column "<<column<<" in matrix with "<<columnCount<<" columns.";
}
}
}
// Check that we did not move backwards wrt. the row.
if(row<lastRow){
throwstorm::exceptions::InvalidArgumentException()<<"Illegal call to SparseMatrixBuilder::addNextValue: adding an element in row "<<row<<", but an element in row "<<lastRow<<" has already been added.";
@ -91,23 +71,14 @@ namespace storm {
// If we switched to another row, we have to adjust the missing entries in the row indices vector.
if(row!=lastRow){
if(storagePreallocated){
// If the storage was preallocated, we can access the elements in the vectors with the subscript
// operator.
for(index_typei=lastRow+1;i<=row;++i){
rowIndications[i]=currentEntryCount;
}
}else{
// Otherwise, we need to push the correct values to the vectors, which might trigger reallocations.
for(index_typei=lastRow+1;i<=row;++i){
rowIndications.push_back(currentEntryCount);
}
// Otherwise, we need to push the correct values to the vectors, which might trigger reallocations.