Browse Source

Check for absence of negative probabilities in matrix

tempestpy_adaptions
Sebastian Junges 7 years ago
parent
commit
cd8dafa6ea
  1. 11
      src/storm/storage/SparseMatrix.cpp

11
src/storm/storage/SparseMatrix.cpp

@ -1571,7 +1571,7 @@ namespace storm {
typename SparseMatrix<ValueType>::index_type SparseMatrix<ValueType>::getNonconstantRowGroupCount() const {
index_type nonConstRowGroups = 0;
for (index_type rowGroup=0; rowGroup < this->getRowGroupCount(); ++rowGroup) {
for( auto const& entry : this->getRowGroup(rowGroup)){
for (auto const& entry : this->getRowGroup(rowGroup)){
if(!storm::utility::isConstant(entry.getValue())){
++nonConstRowGroups;
break;
@ -1584,11 +1584,18 @@ namespace storm {
template<typename ValueType>
bool SparseMatrix<ValueType>::isProbabilistic() const {
storm::utility::ConstantsComparator<ValueType> comparator;
for(index_type row = 0; row < this->rowCount; ++row) {
for (index_type row = 0; row < this->rowCount; ++row) {
if(!comparator.isOne(getRowSum(row))) {
return false;
}
}
for (auto const& entry : *this) {
if (comparator.isConstant(entry.getValue())) {
if (comparator.isLess(entry.getValue(), storm::utility::zero<ValueType>())) {
return false;
}
}
}
return true;
}

Loading…
Cancel
Save