From 3dc82759af95aca17a62588eaee3e9bed67d0e7d Mon Sep 17 00:00:00 2001 From: gereon Date: Tue, 15 Jan 2013 00:34:39 +0100 Subject: [PATCH] some error output, if Dtmc matrix is invalid --- src/models/Dtmc.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/models/Dtmc.h b/src/models/Dtmc.h index c766da8cb..9a185468e 100644 --- a/src/models/Dtmc.h +++ b/src/models/Dtmc.h @@ -215,13 +215,20 @@ private: if (this->probabilityMatrix->getRowCount() != this->probabilityMatrix->getColumnCount()) { // not square + LOG4CPLUS_ERROR(logger, "Probability matrix is not square."); return false; } for (uint_fast64_t row = 0; row < this->probabilityMatrix->getRowCount(); 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; }