Ticket #14354: trac_14354-simplicial.patch

File trac_14354-simplicial.patch, 1.7 KB (added by jhpalmieri, 9 years ago)
  • sage/homology/simplicial_complex.py

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1364190716 25200
    # Node ID 26787ee51f981fcdb3c28ef6cdda41c7d3c08b33
    # Parent  9250c199854dc28e4fd4186925cbf0de67106ead
    Simplicial complex: clear more cached data when running add_face, remove_face
    
    diff --git a/sage/homology/simplicial_complex.py b/sage/homology/simplicial_complex.py
    a b  
    19781978
    19791979            sage: Y.add_face([1,3]); Y
    19801980            Simplicial complex with vertex set (0, 1, 2, 3) and facets {(1, 2, 3), (0, 1)}
     1981
     1982        Check that the bug reported at :trac:`14354` has been fixed::
     1983
     1984            sage: T = SimplicialComplex([range(1,5)]).n_skeleton(1)
     1985            sage: T.homology()
     1986            {0: 0, 1: Z x Z x Z}
     1987            sage: T.add_face([1,2,3])
     1988            sage: T.homology()
     1989            {0: 0, 1: Z x Z, 2: 0}
    19811990        """
    19821991        if not self._is_mutable:
    19831992            raise ValueError("This simplicial complex is not mutable")
     
    20162025                for i in range(d):
    20172026                    for j in range(i+1,d):
    20182027                        self._graph.add_edge(new_face[i],new_face[j])
     2028            self._complex = {}
     2029            self.__contractible = None
     2030            self.__enlarged = {}
    20192031
    20202032    def remove_face(self, face):
    20212033        """
     
    21002112                self._graph.add_vertex(face[0])
    21012113            elif len(face) == 2:
    21022114                self._graph.delete_edge(face[0], face[1])
     2115        self._complex = {}
     2116        self.__contractible = None
     2117        self.__enlarged = {}
    21032118
    21042119    def connected_sum(self, other, is_mutable=True):
    21052120        """