From 4d4219991cfdb0b364fd12404e85367477b87dcd Mon Sep 17 00:00:00 2001 From: gereon Date: Sat, 22 Dec 2012 18:24:02 +0100 Subject: [PATCH] renaming sanity check, fix brackets --- src/models/Dtmc.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/models/Dtmc.h b/src/models/Dtmc.h index f035ebc8d..626091f4b 100644 --- a/src/models/Dtmc.h +++ b/src/models/Dtmc.h @@ -41,9 +41,8 @@ public: */ Dtmc(std::shared_ptr> probabilityMatrix, std::shared_ptr stateLabeling) : probabilityMatrix(probabilityMatrix), stateLabeling(stateLabeling), backwardTransitions(nullptr) { - if (! this->sanityCheck()) - { - std::cerr << "sanity check failed" << std::endl; + if (! this->checkValidityProbabilityMatrix()) { + std::cerr << "Probability matrix is invalid" << std::endl; } } @@ -57,9 +56,8 @@ public: if (dtmc.backardTransitions != nullptr) { this->backwardTransitions = new mrmc::models::GraphTransitions(*dtmc.backwardTransitions); } - if (! this->sanityCheck()) - { - std::cerr << "sanity check failed" << std::endl; + if (! this->checkValidityProbabilityMatrix()) { + std::cerr << "Probability matrix is invalid" << std::endl; } } @@ -154,12 +152,10 @@ private: * * Checks probability matrix if all rows sum up to one. */ - bool sanityCheck() { - for (uint_fast64_t row = 0; row < this->probabilityMatrix->getRowCount(); row++) - { + bool checkValidityProbabilityMatrix() { + for (uint_fast64_t row = 0; row < this->probabilityMatrix->getRowCount(); row++) { T sum = this->probabilityMatrix->getDiagonalStoragePointer()[row]; - for (uint_fast64_t id = this->probabilityMatrix->getRowIndicationsPointer()[row]; id < this->probabilityMatrix->getRowIndicationsPointer()[row+1]; id++) - { + for (uint_fast64_t id = this->probabilityMatrix->getRowIndicationsPointer()[row]; id < this->probabilityMatrix->getRowIndicationsPointer()[row+1]; id++) { sum += this->probabilityMatrix->getStoragePointer()[id]; } if (sum == 0) continue;