Copy-avoidance optimizations on Combinatorics#981
Open
Ebola-Chan-bot wants to merge 5 commits intomathnet:masterfrom
Open
Copy-avoidance optimizations on Combinatorics#981Ebola-Chan-bot wants to merge 5 commits intomathnet:masterfrom
Ebola-Chan-bot wants to merge 5 commits intomathnet:masterfrom
Conversation
Support [ReadOnly]Span, because unlike arrays, it cannot be cast to IEnumerable without an extra copy. Extend arrays to I[ReadOnly]List. For arrays this interface behaves identically, but it can also support other implementations without an extra copy. Add an InPlace version of SelectVariation to save a copy if the caller allows modifications on the input data.
added 4 commits
January 19, 2023 17:48
…itional compilation symbols.
Simplify some essentially same algorithms.
Simplify some essentially same algorithms.
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.
Support
[ReadOnly]Span, because unlike arrays, it cannot be cast toIEnumerablewithout an extra copy.Memoryhas a Span property that does not copy so no need to add a version for it. Note thatSpanonly support .Net Core 2.1 and later versions on this line. Framework, Standard (except the rarely used Standard 2.1) and UWP don't support Span.Extend arrays to
I[ReadOnly]List. For arrays this interface behaves identically, but it can also support other implementations without an extra copy. For example, SelectPermutationInplace could only perform on the full range of an array - it was not possible to permute only a segment of the array. Now you can create anArraySegment, which implementsIList, and pass it to SelectPermutationInplace. Only the range specified when creating theArraySegmentwill be permuted. You can also passArraySegmentto other similar functions. This is more efficient than Skip-Take in that it does not copy.Add an InPlace version of
SelectVariationto save a copy if the caller allows modifications on the input data.