Browse Source

Merge branch 'master' of https://sselab.de/lab9/private/git/MRMC

tempestpy_adaptions
dehnert 12 years ago
parent
commit
de85bfa80e
  1. 4
      src/models/Dtmc.h
  2. 25
      src/storage/SquareSparseMatrix.h

4
src/models/Dtmc.h

@ -155,8 +155,8 @@ private:
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++) {
sum += this->probabilityMatrix->getStoragePointer()[id];
for (auto it = this->probabilityMatrix->beginConstNoDiagIterator(row); it != this->probabilityMatrix->endConstNoDiagIterator(row); it++) {
sum += *it;
}
if (sum == 0) continue;
if (std::abs(sum - 1) > 1e-10) return false;

25
src/storage/SquareSparseMatrix.h

@ -43,6 +43,11 @@ public:
*/
typedef const uint_fast64_t * const constIndexIterator;
/*!
* Iterator type if we want to iterate over elements.
*/
typedef const T* const constIterator;
/*!
* An enum representing the internal state of the Matrix.
* After creating the Matrix using the Constructor, the Object is in state UnInitialized. After calling initialize(), that state changes to Initialized and after all entries have been entered and finalize() has been called, to ReadReady.
@ -930,6 +935,26 @@ public:
return this->columnIndications + this->rowIndications[row + 1];
}
/*!
* Returns an iterator over the elements of the given row. The iterator
* will include neither the diagonal element nor zero entries.
* @param row The row whose elements the iterator will return.
* @return An iterator over the elements of the given row.
*/
constIterator beginConstNoDiagIterator(uint_fast64_t row) const {
return this->valueStorage + this->rowIndications[row];
}
/*!
* Returns an iterator pointing to the first element after the given
* row.
* @param row The row for which the iterator should point to the
* past-the-end element.
* @return An iterator to the element after the given row.
*/
constIterator endConstNoDiagIterator(uint_fast64_t row) const {
return this->valueStorage + this->rowIndications[row + 1];
}
void print() const {
std::cout << "diag: --------------------------------" << std::endl;
for (uint_fast64_t i = 0; i < rowCount; ++i) {

Loading…
Cancel
Save