Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #207 +/- ##
==========================================
+ Coverage 97.17% 97.35% +0.18%
==========================================
Files 8 8
Lines 813 831 +18
==========================================
+ Hits 790 809 +19
+ Misses 23 22 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 update brings
combinations.jlin line with the updates topermuations.jlin PR #205.Broadly, this includes:
Combinationsiterator, similarly to the other iterators, instead of one wrapped in aGenerator.More specifically, the
Combinationsiterator has been made to parallel other implementations in the package, which also eliminates thestatebeing returned during iteration (i.e. it now keeps it private toiterate). Performance remains largely the same, with just three extra allocations and a very slight drop in running time. This does result in a redefinition ofCombinationsto accept aVectorandInt, whereas it used to accept anIntandInt.The performance boosts have come with changes to
MultiSetCombinationsandWithReplacementCombinationsmostly with a reduction in allocations by mutating the iteration state (while keeping it private toiterate).An effort was made to standardize the implementations in both
combinations.jlandpermutations.jl, so all have similar return values and underlying design for easier maintenance.Benchmarks
multiset_combinations(1:12, 6) |> collectBefore
After
multiset_combinations([9, 8, 8, 1, 2, 6, 1, 6, 7, 7, 4, 8], 6) |> collectBefore
After
with_replacement_combinations(1:12, 6) |> collectBefore
After
combinations(1:12, 6) |> collectBefore
After
As in PR #205,
multiset_combinations(m, f::Vector{<:Integer}, t::Integer)has been renamed toMultisetCombinations(m, f::Vector{<:Integer}, t::Integer)since this method is not intended to be exported.