-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[with patch+review] polynomial/fraction field __hash__ re-write #1181
Comments
comment:1
Some benchmarks: Original:
Patched:
I believe (but haven't verified too much) that the big problem is converting coefficients to the base ring from the singular poly. This should probably be optimized for a whole bunch of reasons other than hashing, which will carry over to hashing. |
the patch |
comment:2
Attachment: hash-patch-2_8_12.hg.gz |
comment:3
I've looked at the code and tried it out and it is a great idea that works well. Despite multivariate hashes slowing down, they are still really quite fast, and the properties listed are much more important. |
comment:4
Merged in 2.8.15.rc0. |
The attached patch has a number of goals.
__hash__
function faster in polynomial ringsGoal !#5 was achieved very nicely for univariate poly rings, but
__hash__
in QQ[x,y] was extremely fast in the original code. Unfortunately, that very fast__hash__
violated all good things of the goals above. It also wasn't asymptotically fast (think huge numerical coefficients).The goals 1-4 above result in a fix for the subs method:
A bad thing about this patch is that the results of hash(x) changing reorders the output of things that come from a dictionary. There is a number of doc-tests output changes which are only a matter of order in the list. I think this is probably bad style in doc-tests and in real life. At least some of those outputs have a very natural order (to the human mind if not mathematically).
The attached patch entirely supersedes #1075 and I'm going to go close it right now.
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/1181
The text was updated successfully, but these errors were encountered: