Skip to content
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

Fix stirlings2 bug #92

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Fix stirlings2 bug #92

wants to merge 7 commits into from

Conversation

o314
Copy link

@o314 o314 commented Apr 14, 2020

stirlings2 is implemented twice in this package.

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-io
Copy link

codecov-io commented Apr 14, 2020

Codecov Report

Merging #92 into master will decrease coverage by 0.49%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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%) ⬇️
src/combinations.jl 84.03% <0.00%> (-0.72%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cd51fb...d4d32d9. Read the comment docs.

function stirlings2(n::Integer, k::Integer)
n >= 0 || throw(DomainError("n"))

if n == k == 0; one(n)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use standard formatting?

@mschauer
Copy link
Member

There is also #126, let's compare those two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants