These are chat archives for symengine/symengine

28th
May 2015
Sumith Kulal
@Sumith1896
May 28 2015 12:30
Is it possible to restart travis build of the Polynomial PR? One case fails and complains No space left on device, I don't know what this means. I want to ensure tests pass before sending in next commits.
Shippable passes though.
Sumith Kulal
@Sumith1896
May 28 2015 13:34
Thanks @sushant-hiray for restarting, now it passes.
Sumith Kulal
@Sumith1896
May 28 2015 15:18
Regarding the hashing of Polynomial:
As suggested @bluescarni, we can add the individual hashes of the elements of the map(first and second elements)(correct me if I understood you wrong @bluescarni ).
Some other methods I tried to explore but am unsure of are:
  1. Evaluate polynomial at fixed points, hash the results and add.
  2. Let f(x, y) = (x+y)*(x+y+1)+xthen for each (i, j) in map find f(i, j), in result you'll get N(degree) numbers . Start folding them from left.
Francesco Biscani
@bluescarni
May 28 2015 15:32
@Sumith1896 yes. The basic idea is to use a commutative operation, so the order in which objects are stored in the hash does not matter for the final value (two hash sets can contain the same set of elements but stored differently in each hash set)
you can also use XOR I think, but according to this http://stackoverflow.com/questions/18021643/hashing-a-set-of-integers-in-an-order-independent-way addition seems to be better
the basic requirement is that you need to have a "good" hashing function for the individual set elements
otherwise you risk running into collisions often
Sumith Kulal
@Sumith1896
May 28 2015 15:46
Thanks for the input @bluescarni. I'll try it out.
Ondřej Čertík
@certik
May 28 2015 16:17
@Sumith1896, let me know how it goes. You have to write good tests for this.
The idea is that to calculate the hash, you actually do not need to sort it, and thus it will be very fast. Then, for __eq__ (when comparing), you first check the hash, if it is different, then the two are not equal. If it is the same, then you need to actually compare it, i.e. sort it first, and compare term by term.