位操作#

逐元素位操作#

bitwise_and(x1, x2, /[, out, where, ...])

逐元素计算两个数组的位与运算。

bitwise_or(x1, x2, /[, out, where, casting, ...])

逐元素计算两个数组的位或运算。

bitwise_xor(x1, x2, /[, out, where, ...])

逐元素计算两个数组的位异或运算。

invert(x, /[, out, where, casting, order, ...])

逐元素计算位反转或位非运算。

bitwise_invert(x, /[, out, where, casting, ...])

逐元素计算位反转或位非运算。

left_shift(x1, x2, /[, out, where, casting, ...])

将整数的位向左移动。

bitwise_left_shift(x1, x2, /[, out, where, ...])

将整数的位向左移动。

right_shift(x1, x2, /[, out, where, ...])

将整数的位向右移动。

bitwise_right_shift(x1, x2, /[, out, where, ...])

将整数的位向右移动。

bitwise_count(x, /[, out, where, casting, ...])

计算 x 绝对值中 1 位的数量。

位打包#

packbits(a, /[, axis, bitorder])

将二进制值数组的元素打包为 uint8 数组中的位。

unpackbits(a, /[, axis, count, bitorder])

将 uint8 数组的元素解包为二进制值输出数组。

输出格式化#

binary_repr(num[, width])

将输入数字的二进制表示形式作为字符串返回。