From 64a27bb871b055fa67e99be454db3dd2395c6d84 Mon Sep 17 00:00:00 2001 From: dehnert Date: Wed, 22 May 2013 14:56:26 +0200 Subject: [PATCH] Performance improvement for our matrix multiplication. --- src/storage/SparseMatrix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/SparseMatrix.h b/src/storage/SparseMatrix.h index 850daf382..566629f3c 100644 --- a/src/storage/SparseMatrix.h +++ b/src/storage/SparseMatrix.h @@ -961,12 +961,12 @@ public: // product of the corresponding row with the input vector. // Note that only the end iterator has to be moved by one row, because the other iterator // is automatically moved forward one row by the inner loop. - for (uint_fast64_t i = 0; i < result.size(); ++i, elementIte.moveToNextRow()) { - result[i] = storm::utility::constGetZero(); + for (auto it = result.begin(), ite = result.end(); it != ite; ++it, elementIte.moveToNextRow()) { + *it = storm::utility::constGetZero(); // Perform the scalar product. for (; elementIt != elementIte; ++elementIt) { - result[i] += elementIt.value() * vector[elementIt.column()]; + *it += elementIt.value() * vector[elementIt.column()]; } } }