sagemath / sage

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

simplicial complexes: add_face doesn't clear enough cached data #14354

Closed jhpalmieri closed 11 years ago

jhpalmieri commented 11 years ago

Running add_face on a simplicial complex doesn't clear various data related to homology calculations:

sage: T = SimplicialComplex([range(1,5)]).n_skeleton(1)
sage: T.homology()
{0: 0, 1: Z x Z x Z}
sage: T.add_face([1,2,3])
sage: T.homology() # should be free of rank 2
{0: 0, 1: Z x Z x Z, 2: 0}
sage: SimplicialComplex(T.facets()).homology()
{0: 0, 1: Z x Z, 2: 0}

See also http://ask.sagemath.org/question/2391/homology-of-simplicial-complexes.

CC: @tscrim

Component: algebraic topology

Author: John Palmieri

Reviewer: Travis Scrimshaw

Merged: sage-5.9.beta2

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

tscrim commented 11 years ago
comment:4

Could you make self.__contractible = {} to self.__contractible = None to be consistent with the initial state (I also think this will result in a speedup for larger complexes since I think it will know to compute a large contractible subcomplex)? Other than that, I think this looks good. Thanks.

jhpalmieri commented 11 years ago
comment:5

Good point, thanks. Fixed now.

jhpalmieri commented 11 years ago

Attachment: trac_14354-simplicial.patch.gz

tscrim commented 11 years ago
comment:6

Thank you.

tscrim commented 11 years ago

Reviewer: Travis Scrimshaw

jdemeyer commented 11 years ago

Merged: sage-5.9.beta2