From 7b259120b728577a9b9780908567bc67d4780bd7 Mon Sep 17 00:00:00 2001 From: dehnert Date: Wed, 6 Mar 2013 17:20:01 +0100 Subject: [PATCH] Marked submatrix check in DTMC and sparse matrix as faulty. Needs to be fixed. --- src/models/Dtmc.h | 9 +++++---- src/storage/SparseMatrix.h | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/models/Dtmc.h b/src/models/Dtmc.h index eefcc2ab5..7f0a0bb89 100644 --- a/src/models/Dtmc.h +++ b/src/models/Dtmc.h @@ -50,10 +50,11 @@ public: throw storm::exceptions::InvalidArgumentException() << "Probability matrix is invalid."; } if (this->getTransitionRewardMatrix() != nullptr) { - if (!this->getTransitionRewardMatrix()->isSubmatrixOf(*(this->getTransitionMatrix()))) { - LOG4CPLUS_ERROR(logger, "Transition reward matrix is not a submatrix of the transition matrix, i.e. there are rewards for transitions that do not exist."); - throw storm::exceptions::InvalidArgumentException() << "There are transition rewards for nonexistent transitions."; - } + // FIXME: This is temporarily commented out, because the checking routine does not work properly. + //if (!this->getTransitionRewardMatrix()->isSubmatrixOf(*(this->getTransitionMatrix()))) { + // LOG4CPLUS_ERROR(logger, "Transition reward matrix is not a submatrix of the transition matrix, i.e. there are rewards for transitions that do not exist."); + // throw storm::exceptions::InvalidArgumentException() << "There are transition rewards for nonexistent transitions."; + //} } } diff --git a/src/storage/SparseMatrix.h b/src/storage/SparseMatrix.h index 0b7737604..d5e0ea45b 100644 --- a/src/storage/SparseMatrix.h +++ b/src/storage/SparseMatrix.h @@ -354,8 +354,8 @@ public: throw storm::exceptions::InvalidStateException("Trying to finalize an uninitialized matrix."); } else if (currentSize != nonZeroEntryCount) { triggerErrorState(); - LOG4CPLUS_ERROR(logger, "Trying to finalize a matrix that was initialized with more non-zero entries than given."); - throw storm::exceptions::InvalidStateException("Trying to finalize a matrix that was initialized with more non-zero entries than given."); + LOG4CPLUS_ERROR(logger, "Trying to finalize a matrix that was initialized with more non-zero entries than given (expected " << nonZeroEntryCount << " but got " << currentSize << " instead)"); + throw storm::exceptions::InvalidStateException() << "Trying to finalize a matrix that was initialized with more non-zero entries than given (expected " << nonZeroEntryCount << " but got " << currentSize << " instead)."; } else { // Fill in the missing entries in the row_indications array. // (Can happen because of empty rows at the end.) @@ -969,7 +969,7 @@ public: */ std::vector* getPointwiseProductRowSumVector(storm::storage::SparseMatrix const& otherMatrix) { // Prepare result. - std::vector* result = new std::vector(rowCount); + std::vector* result = new std::vector(rowCount, storm::utility::constGetZero()); // Iterate over all elements of the current matrix and either continue with the next element // in case the given matrix does not have a non-zero element at this column position, or @@ -982,7 +982,7 @@ public: // If the precondition of this method (i.e. that the given matrix is a submatrix // of the current one) was fulfilled, we know now that the two elements are in // the same column, so we can multiply and add them to the row sum vector. - (*result)[row] += otherMatrix.valueStorage[element] * valueStorage[nextOtherElement]; + (*result)[row] += otherMatrix.valueStorage[nextOtherElement] * valueStorage[element]; ++nextOtherElement; } } @@ -1084,6 +1084,7 @@ public: * @return True iff this is a submatrix of matrix. */ bool isSubmatrixOf(SparseMatrix const & matrix) const { + // FIXME: THIS DOES NOT IMPLEMENT WHAT IS PROMISED. if (this->getRowCount() != matrix.getRowCount()) return false; if (this->getColumnCount() != matrix.getColumnCount()) return false;