Skip to content

Commit

Permalink
Perform a hash_combine in getHash() of FactorizedPolynomial instead o…
Browse files Browse the repository at this point in the history
…f a multiplication
  • Loading branch information
glatteis authored and sjunges committed Apr 30, 2024
1 parent 1272985 commit fb86211
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/carl/core/FactorizedPolynomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "DivisionResult.h"
#include "PolynomialFactorizationPair.h"
#include "VariablesInformation.h"
#include "carl/util/hash.h"

namespace carl
{
Expand Down Expand Up @@ -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<P>()(this->polynomialWithCoefficient());
carl::hash_combine( seed, std::hash<P>()( this->polynomial() ) );
carl::hash_combine( seed, std::hash<CoeffType>()( mCoefficient ) );
return seed;
}
return std::hash<CoeffType>()( mCoefficient );
}
Expand Down

0 comments on commit fb86211

Please sign in to comment.