Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 398 Bytes

19355.new_feature.rst

File metadata and controls

13 lines (10 loc) · 398 Bytes

bit_count to compute the number of 1-bits in an integer

Computes the number of 1-bits in the absolute value of the input. This works on all the numpy integer types. Analogous to the builtin int.bit_count or popcount in C++.

>>> np.uint32(1023).bit_count()
10
>>> np.int32(-127).bit_count()
7