Error in Distributions.quantile when broadcasting in Julia 1.0

I found this broadcast error when using Distributions.quantile. And I found that it was called on the type of Noraml, which is the first parameter. So I check the help ?quantile, and found that there are three usages of quantine:

quantile(itr, p; sorted=false)
eg: quantile(0:20, [0.1, 0.5, 0.9])

quantile(v, w::AbstractWeights, p)

quantile(d::UnivariateDistribution, q::Real)

The error is shown below, it can be seen that the first version was invoked. As the package has been updated, the version quantile(d::UnivariateDistribution, X::AbstractArray) is deprecated. Is this a bug of Julia or the package Distribuations?

julia> using Distributions

julia> d=Normal(0.0,1.0)
Normal{Float64}(μ=0.0, σ=1.0)

julia> quantile(d,0.7)

julia> quantile.(d,[0.1,0.7])
ERROR: MethodError: no method matching iterate(::Normal{Float64})
Closest candidates are:
  iterate(::Core.SimpleVector) at essentials.jl:578
  iterate(::Core.SimpleVector, ::Any) at essentials.jl:578
  iterate(::ExponentialBackOff) at error.jl:171
 [1] copyto!(::Array{Float64,1}, ::Normal{Float64}) at .\abstractarray.jl:646
 [2] _collect(::UnitRange{Int64}, ::Normal{Float64}, ::Base.HasEltype, ::Base.HasLength) at .\array.jl:563
 [3] collect(::Normal{Float64}) at .\array.jl:557
 [4] broadcastable(::Normal{Float64}) at .\broadcast.jl:609
 [5] broadcasted(::Function, ::Normal{Float64}, ::Array{Float64,1}) at .\broadcast.jl:1139
 [6] top-level scope at none:0
quantile.(Ref(d), [0.1,0.7])

You should check the documentation of broadcast in particular the part about Ref which has good examples.

1 Like

Thanks for your help :grinning:
I just follow the deprecated warning and quantile(d::UnivariateDistribution, X::AbstractArray) is deprecated, use quantile.(d, X) instead.