Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speed up "remove_faces" for simplicial complexes #11625

Closed
jhpalmieri opened this issue Jul 25, 2011 · 3 comments
Closed

speed up "remove_faces" for simplicial complexes #11625

jhpalmieri opened this issue Jul 25, 2011 · 3 comments

Comments

@jhpalmieri
Copy link
Member

The attached patch, taken from a discussion on ask.sagemath.org, speeds up remove_face for large simplicial complexes. For smaller ones, it is comparable, perhaps a little slower, but the speed-up for large ones is significant.

Before the patch:

sage: S = range(1,8)
sage: timeit('Z = SimplicialComplex(S, [S]); Z.remove_face([1,2,3])')
625 loops, best of 3: 767 µs per loop

sage: timeit('SimplicialComplex(10,[[0,1,2,3,4,5,6],[1,2,3,4,5,6,7],[0,1,2,4,5,6,7],[0,1,2,3,5,6,7],[0,1,2,3,4,5,7]]).remove_face(Simplex([1,2,5]))')
5 loops, best of 3: 42.2 ms per loop

After the patch:

sage: S = range(1,8)
sage: timeit('Z = SimplicialComplex(S, [S]); Z.remove_face([1,2,3])')
625 loops, best of 3: 835 µs per loop

sage: timeit('SimplicialComplex(10,[[0,1,2,3,4,5,6],[1,2,3,4,5,6,7],[0,1,2,4,5,6,7],[0,1,2,3,5,6,7],[0,1,2,3,4,5,7]]).remove_face2(Simplex([1,2,5]))')
125 loops, best of 3: 1.79 ms per loop

The original idea (from ask.sagemath.org) is by "EmersonL", and John Palmieri modified it and wrote the actual patch.

Component: algebraic topology

Keywords: simplicial remove_face

Author: John Palmieri

Reviewer: Mike Hansen

Merged: sage-5.0.beta14

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

@mwhansen
Copy link
Contributor

Reviewer: Mike Hansen

@mwhansen
Copy link
Contributor

comment:2

Attachment: trac_11625-remove-face.patch.gz

Looks good to me.

@jdemeyer
Copy link

Merged: sage-5.0.beta14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants