diff --git a/src/storm/utility/vector.h b/src/storm/utility/vector.h index b70453aaa..28c267223 100644 --- a/src/storm/utility/vector.h +++ b/src/storm/utility/vector.h @@ -84,6 +84,16 @@ namespace storm { } } + template + void setNonzeroIndices(std::vector const& vec, storm::storage::BitVector& bv) { + STORM_LOG_ASSERT(bv.size() == vec.size(), "Bitvector size should match vector size"); + for (uint64_t i = 0; i < vec.size(); ++i) { + if(!storm::utility::isZero(vec[i])) { + bv.set(i, true); + } + } + } + /*! * Iota function as a helper for efficient creating a range in a vector. * See also http://stackoverflow.com/questions/11965732/set-stdvectorint-to-a-range