Binary operations

Elementwise bit operations

bitwise_and (x1, x2[, out]) Compute bit-wise AND of two arrays, element-wise.
bitwise_or (x1, x2[, out]) Compute bit-wise OR of two arrays, element-wise.
bitwise_xor (x1, x2[, out]) Compute bit-wise XOR of two arrays, element-wise.
invert (x[, out]) Compute bit-wise inversion, or bit-wise NOT, element-wise.
left_shift (x1, x2[, out]) Shift the bits of an integer to the left.
right_shift (x1, x2[, out]) Shift the bits of an integer to the right.

Bit packing

packbits (myarray[, axis]) myarray : an integer type array whose elements should be packed to bits
unpackbits (myarray[, axis]) myarray - array of uint8 type where each element represents a bit-field that should be unpacked into a boolean output array

Output formatting

binary_repr (num[, width]) Return the binary representation of the input number as a string.