|
1 | 1 | maximum(f, x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_maximum(f, x) : stat_maximum(f, x) |
2 | | -maximum(f, x) = Base.maximum(f, x) |
| 2 | +maximum(f, x; threads = false) = Base.maximum(f, x) |
3 | 3 | maximum(x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_maximum(identity, x) : stat_maximum(identity, x) |
4 | | -maximum(x) = Base.maximum(x) |
| 4 | +maximum(x; threads = false) = Base.maximum(x) |
5 | 5 |
|
6 | 6 | minimum(f, x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_minimum(f, x) : stat_minimum(f, x) |
7 | | -minimum(f, x) = Base.minimum(f, x) |
| 7 | +minimum(f, x; threads = false) = Base.minimum(f, x) |
8 | 8 | minimum(x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType}= isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_minimum(identity, x) : stat_minimum(identity, x) |
9 | | -minimum(x) = Base.minimum(x) |
| 9 | +minimum(x; threads = false) = Base.minimum(x) |
10 | 10 | # TODO not optimised for simd - threads option is useless here / it is here because we have it for other types of data |
11 | 11 | maximum(f, x::AbstractVector{Union{Missing, T}}; threads = false) where T <: AbstractString = mapreduce(f, _stat_max_fun, x) |
12 | 12 | minimum(f, x::AbstractVector{Union{Missing, T}}; threads = false) where T <: AbstractString = mapreduce(f, _stat_min_fun, x) |
13 | 13 | maximum(x::AbstractVector{Union{Missing, T}}; threads = false) where T <: AbstractString = maximum(identity, x) |
14 | 14 | minimum(x::AbstractVector{Union{Missing, T}}; threads = false) where T <: AbstractString = minimum(identity, x) |
15 | 15 |
|
16 | 16 | sum(f, x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_sum(f, x) : stat_sum(f, x) |
17 | | -sum(f, x)=Base.sum(f, x) |
| 17 | +sum(f, x; threads = false)=Base.sum(f, x) |
18 | 18 | sum(x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS} =isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? hp_sum(identity, x) : stat_sum(identity, x) |
19 | | -sum(x) = Base.sum(x) |
| 19 | +sum(x; threads = false) = Base.sum(x) |
20 | 20 |
|
21 | 21 | mean(f, x::AbstractArray{Union{T,Missing},1}) where T <: Union{INTEGERS, FLOATS} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_mean(f, x) |
22 | 22 | mean(x::AbstractArray{Union{T,Missing},1}) where T <: Union{INTEGERS, FLOATS} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_mean(x) |
@@ -48,14 +48,14 @@ median!(x) = Statistics.median!(x) |
48 | 48 |
|
49 | 49 |
|
50 | 50 | extrema(f, x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? (hp_minimum(f, x), hp_maximum(f, x)) : (stat_minimum(f, x), stat_maximum(f, x)) |
51 | | -extrema(f, x) = Base.extrema(f, x) |
| 51 | +extrema(f, x; threads = false) = Base.extrema(f, x) |
52 | 52 | extrema(x::AbstractArray{Union{Missing, T},1}; threads = false) where T <: Union{INTEGERS, FLOATS, TimeType}= isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : threads ? (hp_minimum(identity, x), hp_maximum(identity, x)) : (stat_minimum(identity, x), stat_maximum(identity, x)) |
53 | | -extrema(x) = Base.extrema(x) |
| 53 | +extrema(x; threads = false) = Base.extrema(x) |
54 | 54 |
|
55 | 55 | # when by is a function the following functions find argmax/min(by.(x)) |
56 | | -argmax(x::AbstractArray{Union{Missing, T},1}; by = identity) where T <: Union{INTEGERS, FLOATS, TimeType, AbstractString} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_findmax(by, x)[2] |
| 56 | +argmax(x::AbstractArray{<:Union{Missing, T},1}; by = identity) where T <: Union{INTEGERS, FLOATS, TimeType, AbstractString} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_findmax(by, x)[2] |
57 | 57 | argmax(x) = Base.argmax(x) |
58 | | -argmin(x::AbstractArray{Union{Missing, T},1}; by = identity) where T <: Union{INTEGERS, FLOATS, TimeType, AbstractString} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_findmin(by, x)[2] |
| 58 | +argmin(x::AbstractArray{<:Union{Missing, T},1}; by = identity) where T <: Union{INTEGERS, FLOATS, TimeType, AbstractString} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_findmin(by, x)[2] |
59 | 59 | argmin(x) = Base.argmin(x) |
60 | 60 |
|
61 | 61 | findmax(f, x::AbstractArray{Union{Missing, T},1}) where T <: Union{INTEGERS, FLOATS, TimeType, AbstractString} = isempty(x) ? throw(ArgumentError("empty arrays are not allowed")) : stat_findmax(f, x) |
|
0 commit comments