Skip to content

Commit

Permalink
remove range, midrange. closes JuliaLang#57
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Apr 26, 2014
1 parent fca1ba5 commit 9d7c7bc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 28 deletions.
8 changes: 0 additions & 8 deletions docs/source/scalarstats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ Measurements of Variation

Compute the middle between ``a`` and ``b``, *i.e.* ``(a + b) / 2``.

- **midrange** (x)

Compute the middle between ``minimum(x)`` and ``maximum(x)``.

- **range** (x)

Compute the difference between ``maximum(x)`` and ``minimum(x)``.


Quantile and Friends
---------------------
Expand Down
2 changes: 0 additions & 2 deletions src/StatsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module StatsBase
sem, # standard error of the mean, i.e. sqrt(var / n)
mad, # median absolute deviation
middle, # the mean of two real numbers
midrange, # the mean of minimum and maximum
range, # the difference between maximum and minimum
percentile, # quantile using percentage (instead of fraction) as argument
iqr, # interquatile range
nquantile, # quantiles at [0:n]/n
Expand Down
6 changes: 0 additions & 6 deletions src/scalarstats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ mad{T<:Real}(v::Range1{T}) = mad!([v])
middle{T<:FloatingPoint}(a1::T, a2::T) = (a1 + a2) / convert(T, 2)
middle{T<:Integer}(a1::T, a2::T) = (a1 + a2) / 2

# Mid-range
midrange{T<:Real}(a::AbstractArray{T}) = middle(extrema(a)...)

# Range: xmax - xmin
range{T<:Real}(a::AbstractArray{T}) = ((m0, m1) = extrema(a); m1 - m0)


#############################
#
Expand Down
12 changes: 0 additions & 12 deletions test/scalarstats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ wv = weights(ones(5) * 2.0)
@test_approx_eq mad([1:5]) 1.4826
@test_approx_eq mad(1:5) 1.4826

# min/max related

@test_approx_eq midrange([1, 2, 3, 4, 5]) 3.0
@test_approx_eq midrange([1, 2, 2, 2, 5]) 3.0
@test_approx_eq midrange([1, 4, 4, 4, 5]) 3.0
@test_approx_eq midrange([1:5]) 3.0

@test_approx_eq range([1, 2, 3, 4, 5]) 4.0
@test_approx_eq range([1, 2, 2, 2, 5]) 4.0
@test_approx_eq range([1, 4, 4, 4, 5]) 4.0
@test_approx_eq range([1:15]) 14.0

# quantile & friends

@test_approx_eq quantile(1:5) [1:5]
Expand Down

0 comments on commit 9d7c7bc

Please sign in to comment.