Easy way to make Numarray Bool use 1 bit?

andrewfelch at gmail.com andrewfelch at gmail.com
Tue Feb 7 16:15:17 EST 2006


I need to be able to store thousands of one-million-length bit arrays.
The first operations use the & operator.  But eventually I must perform
an inner product with a one-million-length integer array (summing at
all the indices of the integer operand where the boolean operand has a
"1").

If I use the Boolean type, I end up using 1-byte, per needed bit, which
is not efficient enough (only 1,000 arrays per gigabyte of memory).
I'm limited by 32-bit windows to use only 2 GB total.

Anybody know of a fast way to use only 125 kilobytes of memory per
array and yet be able to inner product with an integer array quickly?
Don't tell me I have to write C/C++ ! (ugh!)

TIA,
AndrewF




More information about the Python-list mailing list