#19016: A more naive sage.structure.element.__hash__
-------------------------+-------------------------------------------------
Reporter: | Owner:
ncohen | Status: needs_work
Type: | Milestone: sage-duplicate/invalid/wontfix
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):
A little digging in Gap's FP compare functions [https://github.com/gap-
system/gap/blob/master/lib/grpfp.gi#L236 source] shows that for finite
finitely presented groups, our hash, given these definitions:
{{{
FamilyObj=libgap.function_factory("FamilyObj")
ElementsFamily=libgap.function_factory("ElementsFamily")
FPFaithHom=libgap.function_factory("FPFaithHom")
Image=libgap.function_factory("Image")
}}}
should probably look something like this:
{{{
sage: G=groups.presentation.Cyclic(4)
sage: f=FPFaithHom(ElementsFamily(FamilyObj(G.gap())))
sage: newhash=lambda a: hash(Image(f,a.gap()))
}}}
A little test:
{{{
sage: import collections
sage: L=[G.0^i for i in [-5..5]]
sage: collections.Counter(hash(a) == hash(b) for a in L for b in L if
a==b)
Counter({False: 20, True: 11})
sage: collections.Counter(newhash(a) == newhash(b) for a in L for b in L
if a==b)
Counter({True: 31})
sage: collections.Counter(newhash(a) == newhash(b) for a in L for b in L
if a!=b)
Counter({False: 90})
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/19016#comment:21>
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.