Combinatorics.jl
Combinatorics.jl copied to clipboard
Fix stirlings2 bug
stirlings2 is implemented twice in this package.
stirlings2is correct but recursive and slow.nfixedsetpartitionsis bugged eg. it silently overflows.
stirlings2 is slow :
julia> @btime stirlings2_new(25,7)
17.546 μs (431 allocations: 7.09 KiB)
227832482998716310
julia> @btime stirlings2(25,7)
594.258 μs (0 allocations: 0 bytes)
227832482998716310
nfixedsetpartitions is bugged :
@test_broken nfixedsetpartitions(21, 13) >= 0
@test_broken nfixedsetpartitions(21, 14) >= 0
@test_broken nfixedsetpartitions(21, 15) >= 0
@test_broken nfixedsetpartitions(21, 16) >= 0
@test_broken nfixedsetpartitions(21, 17) >= 0
@test_throws OverflowError nfixedsetpartitions(21,21)
SEE
Codecov Report
Merging #92 into master will decrease coverage by
0.49%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #92 +/- ##
==========================================
- Coverage 95.79% 95.29% -0.50%
==========================================
Files 8 8
Lines 642 638 -4
==========================================
- Hits 615 608 -7
- Misses 27 30 +3
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/numbers.jl | 100.00% <100.00%> (ø) |
|
| src/partitions.jl | 97.10% <100.00%> (-1.00%) |
:arrow_down: |
| src/combinations.jl | 84.03% <0.00%> (-0.72%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 9cd51fb...d4d32d9. Read the comment docs.
There is also #126, let's compare those two.