Binary operations

Elementwise bit operations

bitwise_and

Computes the bitwise AND of two arrays elementwise.

bitwise_or

Computes the bitwise OR of two arrays elementwise.

bitwise_xor

Computes the bitwise XOR of two arrays elementwise.

invert

Computes the bitwise NOT of an array elementwise.

left_shift

Shifts the bits of each integer element to the left.

right_shift

Shifts the bits of each integer element to the right.

Bit packing

packbits(myarray)

Packs the elements of a binary-valued array into bits in a uint8 array.

unpackbits(myarray[, bitorder])

Unpacks elements of a uint8 array into a binary-valued output array.

Output formatting

binary_repr(num[, width])

Return the binary representation of the input number as a string.