Easy way to make Numarray Bool use 1 bit?
andrewfelch at gmail.com
andrewfelch at gmail.com
Tue Feb 7 17:11:12 EST 2006
Ahh, I figured it out. The key is to set up the shapes so they
broadcast like an outerproduct, but using bitwise_and as the operation
and the second operand as the bit filter. So we temporarily expand
each bit to a byte for numarray to be able to use it for dot products.
If you use a temporary Boolean variable to store the bitwise_and ufunc
output, the answer is automatically converted to boolean.
Set up the shapes for an innerproduct-like operation to go from byte
format back to bit compact Uint8 format. Go numarray!
More information about the Python-list
mailing list