Binary operations

Elementwise bit operations

methoddescription
bitwise_andopen in new window(x1, x2, /[, out, where, …])Compute the bit-wise AND of two arrays element-wise.
bitwise_oropen in new window(x1, x2, /[, out, where, casting, …])Compute the bit-wise OR of two arrays element-wise.
bitwise_xoropen in new window(x1, x2, /[, out, where, …])Compute the bit-wise XOR of two arrays element-wise.
invertopen in new window(x, /[, out, where, casting, order, …])Compute bit-wise inversion, or bit-wise NOT, element-wise.
left_shiftopen in new window(x1, x2, /[, out, where, casting, …])Shift the bits of an integer to the left.
right_shiftopen in new window(x1, x2, /[, out, where, …])Shift the bits of an integer to the right.

Bit packing

methoddescription
packbitsopen in new window(a[, axis, bitorder])Packs the elements of a binary-valued array into bits in a uint8 array.
unpackbitsopen in new window(a[, axis, count, bitorder])Unpacks elements of a uint8 array into a binary-valued output array.

Output formatting

methoddescription
binary_repropen in new window(num[, width])Return the binary representation of the input number as a string.