-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: Adding bit_count
(popcount)
#19355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1070cf1
ENH: Implementation of bit_count (popcount)
ganesh-k13 33f17a2
ENH: Add bit_count to integer scalar type
ganesh-k13 3ad4683
ENH: Annotations for bit_count
ganesh-k13 cf6e777
ENH, WIP: Documentation for bit_count
ganesh-k13 ad081a3
DOC: Added `bit_count` (#19355)
ganesh-k13 f97ab49
BUG: Fixed windows 32 bit issue with no `__popcnt64`
ganesh-k13 5514a56
DOC: Refined docstring for bit_count
ganesh-k13 b2ba783
TST: Tests for bit_count
ganesh-k13 7045263
ENH, MAINT: Changed return type to uint_8 | Removed extra braces and …
ganesh-k13 b10c63b
BUG: Fixed syntax of bit_count
ganesh-k13 f20739c
DOC, BUG: Fixed bit_count example
ganesh-k13 46de25e
DOC, BUG: (#19355) Removed bit_count from routines.math.rst | Improve…
ganesh-k13 2c6efec
BUG: Added type suffix to magic constants
ganesh-k13 30b08c8
ENH: Handle 32 bit windows popcount | Refactored popcount implementat…
ganesh-k13 9bb3440
MAINT: Refactor type_methods, separate integer definitions
ganesh-k13 e0e5a51
DOC: Added double-ticks
ganesh-k13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
`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++. | ||
ganesh-k13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. code-block:: python | ||
|
||
>>> np.uint32(1023).bit_count() | ||
10 | ||
>>> np.int32(-127).bit_count() | ||
7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.