Browse Source

some error output, if Dtmc matrix is invalid

tempestpy_adaptions
gereon 12 years ago
parent
commit
3dc82759af
  1. 11
      src/models/Dtmc.h

11
src/models/Dtmc.h

@ -215,13 +215,20 @@ private:
if (this->probabilityMatrix->getRowCount() != this->probabilityMatrix->getColumnCount()) { if (this->probabilityMatrix->getRowCount() != this->probabilityMatrix->getColumnCount()) {
// not square // not square
LOG4CPLUS_ERROR(logger, "Probability matrix is not square.");
return false; return false;
} }
for (uint_fast64_t row = 0; row < this->probabilityMatrix->getRowCount(); row++) { for (uint_fast64_t row = 0; row < this->probabilityMatrix->getRowCount(); row++) {
T sum = this->probabilityMatrix->getRowSum(row); T sum = this->probabilityMatrix->getRowSum(row);
if (sum == 0) return false;
if (std::abs(sum - 1) > precision) return false;
if (sum == 0) {
LOG4CPLUS_ERROR(logger, "Row " << row << " has sum 0");
return false;
}
if (std::abs(sum - 1) > precision) {
LOG4CPLUS_ERROR(logger, "Row " << row << " has sum " << sum);
return false;
}
} }
return true; return true;
} }

Loading…
Cancel
Save