-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Fast hash for matrices over finite fields #3956
Comments
comment:1
Attachment: matrix_modn_dense_hash.patch.gz The attached patch speeds up hashing a bit. However, GF(2) speed is not achievable for e.g. GF(3) since the matrices are not packed. I didn't improve |
comment:2
Old
New
|
comment:3
Simon, can you review this so it makes it into 3.1.2? Cheers, Michael |
Changed keywords from none to hash, matrix, finite field |
comment:4
The patch applies, it is faster than before, it seems to produce a reasonable hash value, and it raises an exception for mutable matrices. So, mainly i am giving a positive review. But i have a couple of questions of more general nature concerning the doc tests:
One remark: AFAIK, often hash values are cached. This is not done here (nor for matrices over GF(2)). Does anybody think that implementing a cache for the hash would be a good idea? (I don't) |
comment:5
What matters is the
We have a randstate framework which takes care of pseudo-random doctests such that the same output is guaranteed for each run. The tag
Yes. I think this is Python default.
I should be fast enough for most applications. But if there is demand, we can go ahead and cache it. I have no strong feelings about it. |
comment:6
Thank you for your explanations, Martin. All my questions are answered, so, there is a positive review. |
comment:7
Matrix hashes are specifically designed to be compatible with each other:
This patch seems to break that. At a minimum, it seems sparse and dense should hash to the same thing. If we want to change this policy, we should at least ask on sage-devel. |
comment:8
Replying to @robertwb:
I didn't know about that. The updated patch plays nice. |
comment:9
Attachment: matrix_modn_dense_hash.2.patch.gz That is consistant, but I believe it may fail if rows get swapped (the old version too). Disclaimer: I wrote code to do that at http://hg.sagemath.org/sage-main/rev/b39c832e2eca , though it could potentially be sped up by caching This has sparked an interesting discussion on sage-devel :) |
Attachment: matrix_modn_dense_hash.3.patch.gz |
comment:10
Replying to @robertwb:
Good catch, I posted a new patch to address this. |
comment:11
Looks good to me. Apply only the last patch. |
comment:12
Merged matrix_modn_dense_hash.3.patch in Sage 3.1.2.alpha3 |
In ticket #3724,
malb
suggested a very fast hash method for matrices overGF(2)
, and he wrote that it should be doable overGF(p)
in general.Currently, we have:
This, i think, is very slow and ought to be improved as well.
... and this is quite slow, while (with the patch from #3724) the hash is immediate for matrices over GF(2).
Component: linear algebra
Keywords: hash, matrix, finite field
Issue created by migration from https://trac.sagemath.org/ticket/3956
The text was updated successfully, but these errors were encountered: