Opened 22 months ago

Last modified 16 months ago

#26944 new enhancement

Improve hashing of algebraic numbers

Reported by: mmezzarobba Owned by:
Priority: major Milestone:
Component: number fields Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


As suggested by Pascal Molin, the hash of an element α of QQbar/AA could be based on that element perturbed by a transcendental number, to avoid triggering exact computations even in unlucky cases.

(There is a comment in AlgebraicNumber_base.__hash__() noting that the effort to avoid exact computation is probably wasted because we'll do a comparison if the hashes match, but this ignores the common case where we are retrieving an element of a hash table using the same physical object that was stored as a key.)

See also #26898.

Change History (3)

comment:1 Changed 21 months ago by embray

  • Milestone changed from sage-8.6 to sage-8.7

Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.

comment:2 Changed 19 months ago by embray

  • Milestone changed from sage-8.7 to sage-8.8

Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)

comment:3 Changed 16 months ago by embray

  • Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

Note: See TracTickets for help on using tickets.