#19016: Better hash for Element
-------------------------+-------------------------------------------------
Reporter: | Owner:
ncohen | Status: needs_work
Type: | Milestone: sage-6.9
defect | Resolution:
Priority: | Merged in:
blocker | Reviewers:
Component: misc | Work issues:
Keywords: | Commit:
Authors: | 754dc5794a1a7004c8844cf7cfb64220957c36a5
Nathann Cohen | Stopgaps:
Report Upstream: N/A |
Branch: |
u/ncohen/19016 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by nbruin):
Replying to [comment:38 vdelecroix]:
> New bad news: hashing of ideals. The `ResidueField` factory in
`sage.rings.finite_rings.residue_field` uses as keys ideals that do not
implement hashing. And I guess in most non trivial case having a hash
value would be hard. For principal ideal, it is easy to test equality but
much harder to implement a hash.
These are prime ideals of number fields I presume? The HNF of a Z-basis of
the ideal wrt. the chosen integral basis would do the trick, if all those
things are available ...
I guess we've painted ourselves in a corner here by requiring unique
parents, and hence if an ideal is part of the construction parameters we
have to hash with it? Luckily Julian Reuth has been putting a door in that
corner:
Perhaps ideals that cannot properly be hashed should have a `_cache_key`
method instead (see
[http://doc.sagemath.org/html/en/reference/misc/sage/misc/cachefunc.html]).
It's not the end of the world if `residue_field(P1)` and
`residue_field(P2)` give non-identical parents for ideals `P1` and `P2`
that are equal, but not obviously so. So the `_cache_key` can be a much
sloppier hash-like function. Of course `__hash__` must be equal for equal
ideals.
--
Ticket URL: <http://trac.sagemath.org/ticket/19016#comment:40>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.