sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

simplicial complexes lack hash function #12587

Closed 93808305-b40a-4e51-9e5e-87b8badd3758 closed 11 years ago

93808305-b40a-4e51-9e5e-87b8badd3758 commented 12 years ago

Simplicial complexes are lacking a proper hash function. See the example below.

sage: S = SimplicialComplex([[]]); S
Simplicial complex with vertex set () and facets {()}
sage: hash(S)
-3899221226149827755
sage: S.__hash__??
Source:
    def __hash__(self):
        return hash(self.__repr__())

Apply:

Depends on #13226 Depends on #13244 Depends on #13590

CC: @sagetrac-sage-combinat

Component: combinatorics

Author: Travis Scrimshaw

Reviewer: Christian Stump, John Palmieri

Merged: sage-5.6.beta1

Issue created by migration from https://trac.sagemath.org/ticket/12587

stumpc5 commented 11 years ago
comment:45

Replying to @jhpalmieri:

Replying to @stumpc5:

Replying to @jhpalmieri:

I still see the reference, and if I click on the citation, I get taken to the reference in the other file. Also, most people reading the docstring will know what "Hatcher" means – it's not an obscure reference – so won't even need to look it up.

Saying this: might it be even worth adding the reference of the freely available pdf version of the book?

It works for me. Try rebuilding all of the documentation (rm -rf SAGE_ROOT/devel/sage/doc/output/ and then sage --docbuild reference html).

This indeed solved the issue on my machine as well, thanks!

If any one of you wanna go ahead: I am happy with giving it a positive review again!

tscrim commented 11 years ago
comment:46

Here's what happened (in writing this patch):

Rebuilding the entire documentation is the only way to get it to work since references are global and global changes are (currently) only removed/edited when the entire documentation is rebuilt. (This is unbelievably annoying to me when working between patches that add/modify .rst files.) Or something like that...

jhpalmieri commented 11 years ago

Attachment: trac_12587-ref-jhp.patch.gz

jhpalmieri commented 11 years ago
comment:48

I updated my referee patch to deal with one more instance of SimplicialComplex begin called with a vertex set (in interfaces/chomp.py). There is probably one more that needs fixing (in sandpiles/sandpile.py), but I haven't installed the optional package 4ti2 to check it. I have installed CHomP, so I can verify the one I added to the patch.

jhpalmieri commented 11 years ago
comment:49

(See also #13769, which fixes optional doctests for interfaces/chomp.py when CHomP is installed.)

jhpalmieri commented 11 years ago

Dependencies: #13226, #13244, #13590

jdemeyer commented 11 years ago

Merged: sage-5.6.beta1