JuliaMath / Combinatorics.jl

A combinatorics library for Julia
http://juliamath.github.io/Combinatorics.jl/dev/
Other
214 stars 58 forks source link

added `Base.eltype()` method for `MultiExponents` #136

Open jbshannon opened 1 year ago

jbshannon commented 1 year ago

collect called on MultiExponents is type-unstable because MultiExponents has no defined eltype. This PR adds a method for Base.eltype() so that collect returns a Vector{Vector{Int64}} rather than a Vector{Any}.

Before:

julia> collect(multiexponents(3, 2))
6-element Array{Any,1}:
 [2, 0, 0]
 [1, 1, 0]
 [1, 0, 1]
 [0, 2, 0]
 [0, 1, 1]
 [0, 0, 2]

After:

julia> collect(multiexponents(3, 2))
6-element Vector{Vector{Int64}}:
 [2, 0, 0]
 [1, 1, 0]
 [1, 0, 1]
 [0, 2, 0]
 [0, 1, 1]
 [0, 0, 2]
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ac70c46) 96.97% compared to head (2ddfe36) 96.98%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #136 +/- ## ======================================= Coverage 96.97% 96.98% ======================================= Files 7 7 Lines 728 729 +1 ======================================= + Hits 706 707 +1 Misses 22 22 ``` | [Impacted Files](https://codecov.io/gh/JuliaMath/Combinatorics.jl/pull/136?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath) | Coverage Δ | | |---|---|---| | [src/multinomials.jl](https://codecov.io/gh/JuliaMath/Combinatorics.jl/pull/136?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath#diff-c3JjL211bHRpbm9taWFscy5qbA==) | `92.85% <100.00%> (+0.54%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.