Binary operations#

Elementwise bit operations#

bitwise_and(x1, x2, /[, out, casting, dtype])

Computes the bitwise AND of two arrays elementwise.

bitwise_or(x1, x2, /[, out, casting, dtype])

Computes the bitwise OR of two arrays elementwise.

bitwise_xor(x1, x2, /[, out, casting, dtype])

Computes the bitwise XOR of two arrays elementwise.

invert

bitwise_invert(x, /, out=None, *, casting='same_kind', dtype=None)

left_shift

bitwise_left_shift(x1, x2, /, out=None, *, casting='same_kind', dtype=None)

right_shift

bitwise_right_shift(x1, x2, /, out=None, *, casting='same_kind', dtype=None)

Bit packing#

packbits(a[, axis, bitorder])

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

unpackbits(a[, axis, 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.