#12290: Fix the hash of matrix spaces and improve its performance
------------------------------+---------------------------------------------
Reporter: SimonKing | Owner: jason, was
Type: defect | Status: needs_work
Priority: critical | Milestone: sage-5.0
Component: linear algebra | Keywords: hash matrix space
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies:
------------------------------+---------------------------------------------
Comment(by SimonKing):
Interesting indeed.
Without the patch, one has
{{{
sage: M1 = MatrixSpace(ZZ, 5,6, sparse=True)
sage: M2 = MatrixSpace(ZZ, 5,6, sparse=False)
sage: M1==M2
True
sage: D = {M1:1,M2:2}
sage: len(D)
2
}}}
Obvious reason: M1 and M2 are equal (so then the length of D should be
one, not two!), but they have different hash and are thus in different
buckets of the dictionary.
With my patch, they have the same hash, and by consequence they yield the
same dictionary item - and that is bad for coercion! Hence, non-unique
parents strike again...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12290#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.