Line segments, overlap, and bits

castironpi at gmail.com castironpi at gmail.com
Wed Mar 26 21:13:29 EDT 2008


On Mar 26, 5:10 pm, bearophileH... at lycos.com wrote:
> Sean Davis>Java has a BitSet class that keeps this kind of thing
> pretty clean and high-level, but I haven't seen anything like it for
> python.<
>
> If you look around you can usually find Python code able to do most of
> the things you want, like (you can modify this code to add the boolean
> operations):http://svn.zope.org/*checkout*/Zope3/trunk/src/zope/textindex/ricecod...
> (Later I have improved that code for personal use).
>
> But operations on such bit arrays are very common, and you may need
> them to be very fast, so you may use Cython (Pyrex) to write a small
> class able to do those things in a much faster way.
> Or you can also use Pyd plus an easy 30-lines long D program to write
> a class that does those operations very quickly  (using a dynamic
> array of uint, with the help ofwww.digitalmars.com/d/1.0/phobos/std_intrinsic.html
> ).
> Maybe you can use GMPY numbers as bit arrays too. (I don't know if you
> can use NumPy for this using a compact representation of the bits).

I believe you're talking about collision detection, and my bartender
is entertaining a proof that serial memory can't do it in time.  So
far the idea I see here is primitive memory couplings that change
value based on primitive conditions of other memory.  Peripherals
including a chipset might show promise, esp. a flash chip, s.l.
'autopersistent' memory.  Even if you still poll results, it's still a
factor off O( n ).



More information about the Python-list mailing list