Browse Source

Use carl hashing functions

tempestpy_adaptions
Matthias Volk 5 years ago
parent
commit
30565e4d0c
  1. 2
      resources/3rdparty/sylvan/src/storm_wrapper.cpp
  2. 9
      src/storm/adapters/RationalFunctionAdapter.h

2
resources/3rdparty/sylvan/src/storm_wrapper.cpp

@ -481,7 +481,7 @@ uint64_t storm_rational_function_hash(storm_rational_function_ptr const a, uint6
storm::RationalFunction const& srf_a = *(storm::RationalFunction const*)a;
// Taken from boost::hash_combine that we do not call here for the lack of boost headers.
return seed ^ (carl::hash_value(srf_a) + 0x9e3779b9 + (seed<<6) + (seed>>2));
return seed ^ (std::hash<storm::RationalFunction>()(srf_a) + 0x9e3779b9 + (seed<<6) + (seed>>2));
}
double storm_rational_function_get_value_double(storm_rational_function_ptr a) {

9
src/storm/adapters/RationalFunctionAdapter.h

@ -11,6 +11,7 @@
namespace carl {
// Define hash values for all polynomials and rational function.
// Needed for boost::hash_combine() and other functions
template<typename C, typename O, typename P>
inline size_t hash_value(carl::MultivariatePolynomial<C,O,P> const& p) {
std::hash<carl::MultivariatePolynomial<C,O,P>> h;
@ -19,19 +20,19 @@ namespace carl {
template<typename Pol>
inline size_t hash_value(carl::FactorizedPolynomial<Pol> const& p) {
std::hash<FactorizedPolynomial<Pol>> h;
std::hash<carl::FactorizedPolynomial<Pol>> h;
return h(p);
}
template<typename Pol, bool AutoSimplify>
inline size_t hash_value(carl::RationalFunction<Pol, AutoSimplify> const& f) {
std::hash<Pol> h;
return h(f.nominator()) ^ h(f.denominator());
std::hash<carl::RationalFunction<Pol, AutoSimplify>> h;
return h(f);
}
template<typename Number>
inline size_t hash_value(carl::Interval<Number> const& i) {
std::hash<Interval<Number>> h;
std::hash<carl::Interval<Number>> h;
return h(i);
}

Loading…
Cancel
Save