From 323e82994d9c09dda3db75b03fef75ed2500c665 Mon Sep 17 00:00:00 2001 From: Jan Erik Karuc Date: Thu, 20 Feb 2020 17:47:53 +0100 Subject: [PATCH] maixmumElementDiff implementation in vector.h --- src/storm/utility/vector.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/storm/utility/vector.h b/src/storm/utility/vector.h index 2721ee381..0deed45ba 100644 --- a/src/storm/utility/vector.h +++ b/src/storm/utility/vector.h @@ -928,6 +928,19 @@ namespace storm { return true; } + template + T maximumElementDiff(std::vector const& vectorLeft, std::vector const& vectorRight) { + T maxDiff = storm::utility::zero(); + auto leftIt = vectorLeft.begin(); + auto leftIte = vectorLeft.end(); + auto rightIt = vectorRight.begin(); + for (; leftIt != leftIte; ++leftIt, ++rightIt) { + T diff = *leftIt - *rightIt; + T possDiff = storm::utility::abs(diff); + maxDiff = maxDiff < possDiff ? possDiff : maxDiff; + } + return maxDiff; + } template T computeSquaredNorm2Difference(std::vector const& b1, std::vector const& b2) {