dpnp.bitwise_count
- dpnp.bitwise_count(x, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Computes the number of 1-bits in the absolute value of x.
For full documentation refer to
numpy.bitwise_count
.- Parameters:
x ({dpnp.ndarray, usm_ndarray}) -- Input array, expected to have integer or boolean data type.
out ({None, dpnp.ndarray, usm_ndarray}, optional) --
Output array to populate. Array must have the correct shape and the expected data type.
Default:
None
.order ({"C", "F", "A", "K"}, optional) --
Memory layout of the newly output array, if parameter out is
None
.Default:
"K"
.
- Returns:
out -- The corresponding number of 1-bits in the input. Returns
uint8
for all integer types.- Return type:
dpnp.ndarray
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedError
exception will be raised.Examples
>>> import dpnp as np >>> a = np.array(1023) >>> np.bitwise_count(a) array(10, dtype=uint8)
>>> a = np.array([2**i - 1 for i in range(16)]) >>> np.bitwise_count(a) array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], dtype=uint8)