Browse Source

Implemented new utility functions and improved existing ones.

tempestpy_adaptions
dehnert 12 years ago
parent
commit
d38e7eeeb8
  1. 14
      src/utility/Vector.h

14
src/utility/Vector.h

@ -54,12 +54,20 @@ void selectVectorValues(std::vector<T>* vector, const storm::storage::BitVector&
template<class T> template<class T>
void selectVectorValues(std::vector<T>* vector, const storm::storage::BitVector& positions, const std::vector<uint_fast64_t>& rowMapping, std::vector<T> const& values) { void selectVectorValues(std::vector<T>* vector, const storm::storage::BitVector& positions, const std::vector<uint_fast64_t>& rowMapping, std::vector<T> const& values) {
uint_fast64_t oldPosition = 0; uint_fast64_t oldPosition = 0;
uint_fast64_t rowMappingPosition = 0;
for (auto position : positions) { for (auto position : positions) {
for (uint_fast64_t i = rowMapping[rowMappingPosition]; i < rowMapping[rowMappingPosition + 1]; ++i) {
for (uint_fast64_t i = rowMapping[position]; i < rowMapping[position + 1]; ++i) {
(*vector)[oldPosition++] = values[i];
}
}
}
template<class T>
void selectVectorValuesRepeatedly(std::vector<T>* vector, const storm::storage::BitVector& positions, const std::vector<uint_fast64_t>& rowMapping, std::vector<T> const& values) {
uint_fast64_t oldPosition = 0;
for (auto position : positions) {
for (uint_fast64_t i = rowMapping[position]; i < rowMapping[position + 1]; ++i) {
(*vector)[oldPosition++] = values[position]; (*vector)[oldPosition++] = values[position];
} }
++rowMappingPosition;
} }
} }

Loading…
Cancel
Save