[bit.permute] Create notation for the popcount of the first n bits.#9181
Merged
Conversation
This avoids having to put a complex expression into sub- and superscripts in the definitions of "expand" and "compress".
eisenwave
reviewed
Jul 15, 2026
Comment on lines
16734
to
+16741
| \pnum | ||
| In the following descriptions, | ||
| let $N$ denote the value of \tcode{numeric_limits<T>::digits}, and | ||
| let $N$ denote the value of \tcode{numeric_limits<T>::digits}, | ||
| let $\alpha_n$ denote the value of the $n^\text{th}$ least significant bit | ||
| in the base-2 representation of an integer $\alpha$, | ||
| so that $\alpha$ equals $\sum_{n=0}^{N-1} \alpha_n 2^n$. | ||
| so that $\alpha$ equals $\sum_{n=0}^{N-1} \alpha_n 2^n$, | ||
| and let $\sigma(\alpha, n) = \sum_{k=0}^{n-1} \alpha_k$ | ||
| be the count of one-bits among the lowest $n$ bits of $\alpha$. |
Member
There was a problem hiding this comment.
If this is going to be three relatively complex items, maybe it this should be using bullets.
Contributor
Author
There was a problem hiding this comment.
Done as a separate commit. I'm not sure that it makes a big difference. (Generally, what helps make complex expressions more scannable is to put them in a displayed equation, but I don't really see any good opportunities for this here.)
jwakely
approved these changes
Jul 16, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

This avoids having to put a complex expression into sub- and superscripts in the definitions of "expand" and "compress".