On Apr 7, 2008, at 10:36 AM, Jason Grout wrote:
>
> Robert Bradshaw wrote:
>> On Apr 7, 2008, at 10:12 AM, Jason Grout wrote:
>>> I love the new bitset.pxi file in sage/misc/.
>>
>> Thanks :).
>>
>>> Can I access these
>>> functions from a cython file that a user writes (i.e., that is not
>>> part
>>> of the sage source)?
>>
>> Yes. I think one would have to copy and/or include the file (giving
>> its full path) directly. Currently there's an .h file that's hanging
>> around too (although that will go away now the new version of Cython
>> is included in Sage).
>
> How much of a speed penalty do you think there would be in wrapping
> these functions in a bitset cython class?  Or would this slow things
> down to about the performance of the python set class?

This was a very good idea. The only reason I didn't do it myself was  
because the bitset implementation itself took more time than I had  
anticipated putting into it and I had other things I had to do.

It could still be very fast, especially if the methods are cpdef. (It  
would not be as fast as using bitset.pxi's inline functions directly  
of course, but sometimes ease of use trumps absolute performance).  
Testing would be much more natural as well.

Currently bitset.pxi assumes you know the size of the bitset at  
creation time, and doesn't do any bounds checking. I think a class  
could abstract this and act like an infinite bitset, with higher- 
order bits being by default zero.

- Robert

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to