#include "storm/storage/geometry/nativepolytopeconversion/HyperplaneCollector.h" namespace storm { namespace storage { namespace geometry{ template< typename ValueType> bool HyperplaneCollector::insert(EigenVector const& normal, ValueType const& offset, std::vectorconst* indexList) { EigenVector copyNormal(normal); ValueType copyOffset(offset); return this->insert(std::move(copyNormal), std::move(copyOffset), indexList); } template< typename ValueType> bool HyperplaneCollector::insert(EigenVector && normal, ValueType && offset, std::vectorconst* indexList) { //Normalize ValueType infinityNorm = normal.template lpNorm(); if(infinityNorm != (ValueType)0 ){ normal /= infinityNorm; offset /= infinityNorm; } if(indexList == nullptr){ //insert with empty list return map.insert(MapValueType(MapKeyType(normal, offset), std::vector())).second; } else { auto inserted = map.insert(MapValueType(MapKeyType(normal, offset), *indexList)); if(!inserted.second){ //Append vertex list inserted.first->second.insert(inserted.first->second.end(), indexList->begin(), indexList->end()); } return inserted.second; } } template< typename ValueType> std::pair::EigenMatrix, typename HyperplaneCollector::EigenVector> HyperplaneCollector::getCollectedHyperplanesAsMatrixVector() const{ if(map.empty()) { return std::pair(); } EigenMatrix A(map.size(), map.begin()->first.first.rows()); EigenVector b(map.size()); uint_fast64_t row = 0; for(auto const& mapEntry : map){ A.row(row) = mapEntry.first.first; b(row) = mapEntry.first.second; ++row; } return std::pair(std::move(A), std::move(b)); } template< typename ValueType> std::vector> HyperplaneCollector::getIndexLists() const{ std::vector> result(map.size()); auto resultIt = result.begin(); for(auto const& mapEntry : map){ *resultIt = mapEntry.second; ++resultIt; } return result; } template< typename ValueType> uint_fast64_t HyperplaneCollector::numOfCollectedHyperplanes() const { return map.size(); } template class HyperplaneCollector; template class HyperplaneCollector; } } }