Skip to content

Commit

Permalink
Merge pull request #2266 from JuliaLang/anj/median
Browse files Browse the repository at this point in the history
Make median behave on arrays as mean and var
  • Loading branch information
JeffBezanson committed Feb 11, 2013
2 parents d3ab027 + 87723f9 commit 26110fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function median!{T<:Real}(v::AbstractVector{T})
isnan(v[end]) && error("median is undefined in presence of NaNs")
isodd(length(v)) ? float(v[div(end+1,2)]) : (v[div(end,2)]+v[div(end,2)+1])/2
end
median{T<:Real}(v::AbstractArray{T}) = median!(copy(v))
median{T<:Real}(v::AbstractArray{T}) = median!(copy(reshape(v, length(v))))

## variance with known mean
function var(v::AbstractVector, m::Number, corrected::Bool)
Expand Down

0 comments on commit 26110fa

Please sign in to comment.