From fb8621175d82a4c5dfe292cd0bb9c74c3e9161b1 Mon Sep 17 00:00:00 2001 From: Linus Heck Date: Tue, 30 Apr 2024 13:50:04 +0200 Subject: [PATCH] Perform a hash_combine in getHash() of FactorizedPolynomial instead of a multiplication --- src/carl/core/FactorizedPolynomial.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/carl/core/FactorizedPolynomial.h b/src/carl/core/FactorizedPolynomial.h index 01fbc93b..cd5d825a 100644 --- a/src/carl/core/FactorizedPolynomial.h +++ b/src/carl/core/FactorizedPolynomial.h @@ -13,6 +13,7 @@ #include "DivisionResult.h" #include "PolynomialFactorizationPair.h" #include "VariablesInformation.h" +#include "carl/util/hash.h" namespace carl { @@ -193,10 +194,13 @@ namespace carl { if( existsFactorization( *this ) ) { + std::size_t seed = 0; // Getting the hash of mCacheRef does not work because rehashing might occur. // To have a consistent hash we need to compute the hash of the expanded polynomial. // Note that building the polynomial can greatly increase the hashing time. - return std::hash

()(this->polynomialWithCoefficient()); + carl::hash_combine( seed, std::hash

()( this->polynomial() ) ); + carl::hash_combine( seed, std::hash()( mCoefficient ) ); + return seed; } return std::hash()( mCoefficient ); }