Ask Your Question

Revision history [back]

(This is really a comment for EmersonL's answer, but it's too long to fit, plus I wanted to format it nicely.)

I'm not getting any speed-up with your version. I added it to the file simplicial_complex.py, calling it "remove_face2", and I added one line:

FACE = Simplex(FACE)

at the beginning so that you can enter a list of vertices, not necessarily an actual simplex. Then I did this:

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

I tried a few other examples, and the old version was faster for most of them, comparable for all of them. Can you give some examples where your code is faster?