Skip to content

Commit

Permalink
DOC: Added np.bit_count (#19355)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganesh-k13 committed Jul 12, 2021
1 parent 87377d4 commit a5d88e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/release/upcoming_changes/19355.new_feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
`np.bit_count` to compute the number of 1-bits in an integer
------------------------------------------------------------

This new function counts the number of 1-bits in a number.
These work on all the numpy integer types, as well as the
builtin arbitrary-precision `Decimal` and `long` types.

.. code-block:: python
>>> a = np.array([2**i - 1 for i in range(16)])
>>> np.bit_count(a)
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
2 changes: 2 additions & 0 deletions doc/source/reference/routines.math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,5 @@ Miscellaneous
real_if_close

interp

bit_count

0 comments on commit a5d88e1

Please sign in to comment.