[sage-devel] Re: Of powersets and subsets

2011-04-10 Thread Nathann Cohen
Hello !!! > I am working with several people on software for doing matroid theory. > All hail Caesar !! Hail !! Hail !! > Now how do I solve this problem? There seem to be several options: > > 1) Sacrifice compatibility with Sage's Set category, meaning less > user-friendliness > Is the "Matro

[sage-devel] Re: Of powersets and subsets

2011-04-10 Thread Rob Beezer
On Apr 10, 1:10 pm, Stefan van Zwam wrote: > %time > t = 0 > for s1 in range(0,2**9): >     for s2 in range(0,2**9): >         if s1 & s2: >             t += 1 > t If you Cython-ize this code, which basically means adding the declaration cdef Py_ssize_t t, s1, s2 at the top, its runtime becomes

[sage-devel] Re: Of powersets and subsets

2011-04-10 Thread Rob Beezer
A more accurate follow-up to my hurried post of a few hours ago. Timings on the same machine for a more truthful speed comparison, now in reality "just" a 150x speed-up due to Cython. Triple-braces delimit compute cells in the notebook. Notice that the "%cython" block automatically produces the C

[sage-devel] Re: Of powersets and subsets

2011-04-11 Thread Jason Grout
On 4/10/11 11:47 PM, Tom Boothby wrote: On Sun, Apr 10, 2011 at 1:10 PM, Stefan van Zwam wrote: 3) ??? Option 3: rejoice, the work has been done for you! http://www.sagemath.org/doc/reference/sage/misc/bitset.html Just FYI, you can see extensive use of bitsets in the graph theory code o

[sage-devel] Re: Of powersets and subsets

2011-04-11 Thread Stefan
Hi! > > I am working with several people on software for doing matroid theory. > > All hail Caesar !! Hail !! Hail !! Oh dear. And here I was, thinking this Sage development was a wonderfully democratic process... > > > Now how do I solve this problem? There seem to be several options: > > > 1)

[sage-devel] Re: Of powersets and subsets

2011-04-11 Thread Jason Grout
On 4/11/11 2:35 PM, Stefan wrote: I did not manage to create a meaningful version of this example using Bitsets, since they don't support an optimized subsets() method. The Bitsets class was created to support the python set api, which doesn't include a subsets() method. Patches are welcome t

Re: [sage-devel] Re: Of powersets and subsets

2011-04-12 Thread Florent Hivert
Hi Stefan, hi there, > I guess the sage-combinat team will appear soon on this thread :-) I hope > so. I was on a long week end and Nicolas is on vacation for the entire week. So expect some delay in the answers. > I'm hoping to make the user use them without noticing ;). We'd like to > g

Re: [sage-devel] Re: Of powersets and subsets

2011-04-13 Thread Stefan van Zwam
Hi Florent, > > I was on a long week end and Nicolas is on vacation for the entire week. So > expect some delay in the answers. > No worries! We're not in a hurry. > First of all the dictionary approach as you call it is very classical in > combinatorics. It think it is a good idea here. We use t