JuliaMath / Combinatorics.jl

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

Bug in integer_partitions(0) #143

Open laurentbartholdi opened 10 months ago

laurentbartholdi commented 10 months ago

integer_partitions(0) returns the empty list, while there is a partition of 0, namely Int[].

The error is in src/partitions.c:459, which should return Vector{Int}[[]] or [Int[]].

There is also a problem with partitions(0):

julia> partitions(0)
Combinatorics.IntegerPartitions(0)

julia> collect(ans)
1-element Vector{Vector{Int64}}:
 #undef

julia> integer_partitions(0)
Vector{Int64}[]