Skip to content

Commit

Permalink
Change from quantile! to quantile
Browse files Browse the repository at this point in the history
Not sure what a meaningful way to work out the quantiles of a matrix inplace would look like, so remove the ! to make it clear it isn't inplace
  • Loading branch information
this-josh committed Mar 30, 2022
1 parent 6998883 commit 9924bc7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,6 @@ function quantile!(v::AbstractVector, p::Union{AbstractArray, Tuple{Vararg{Real}
end
return map(x->_quantile(v, x, alpha=alpha, beta=beta), p)
end
quantile!(arr::AbstractArray, p::Union{AbstractArray,Tuple{Vararg{Real}}};
sorted::Bool=false, alpha::Real=1.0, beta::Real=alpha) =
quantile!(vec(arr), p, sorted=sorted, alpha=alpha, beta=alpha)

quantile!(v::AbstractVector, p::Real; sorted::Bool=false, alpha::Real=1., beta::Real=alpha) =
_quantile(_quantilesort!(v, sorted, p, p), p, alpha=alpha, beta=beta)
Expand Down Expand Up @@ -1076,6 +1073,10 @@ quantile(itr, p; sorted::Bool=false, alpha::Real=1.0, beta::Real=alpha) =
quantile(v::AbstractVector, p; sorted::Bool=false, alpha::Real=1.0, beta::Real=alpha) =
quantile!(sorted ? v : Base.copymutable(v), p; sorted=sorted, alpha=alpha, beta=beta)

quantile(arr::AbstractArray, p::Union{AbstractArray,Tuple{Vararg{Real}}};
sorted::Bool=false, alpha::Real=1.0, beta::Real=alpha) =
quantile!(vec(arr), p, sorted=sorted, alpha=alpha, beta=alpha)


##### SparseArrays optimizations #####

Expand Down

0 comments on commit 9924bc7

Please sign in to comment.