#11625: speed up "remove_faces" for simplicial complexes
----------------------------------+-----------------------------------------
   Reporter:  jhpalmieri          |          Owner:  jhpalmieri            
       Type:  enhancement         |         Status:  new                   
   Priority:  minor               |      Milestone:  sage-4.7.2            
  Component:  algebraic topology  |       Keywords:  simplicial remove_face
Work_issues:                      |       Upstream:  N/A                   
   Reviewer:                      |         Author:  John Palmieri         
     Merged:                      |   Dependencies:                        
----------------------------------+-----------------------------------------
 The attached patch, taken from a [http://ask.sagemath.org/question/521
 /why-remove_face-uses-alexander-duality 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.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11625>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to