@@ -128,35 +128,6 @@ vvprod(A::AbstractArray) = vvmapreduce(identity, *, one, A, :)
128
128
vvmaximum (A:: AbstractArray ) = vvmapreduce (identity, max, typemin, A, :)
129
129
vvminimum (A:: AbstractArray ) = vvmapreduce (identity, min, typemax, A, :)
130
130
131
- # a custom implementation of extrema is not really worth it, as the time/memory
132
- # cost is approximately the same. Also, it suffers from first dimension reduction error.
133
-
134
- # Convenience to handle zipping of results
135
- _vvextrema_zip (a:: Number , b:: Number ) = a, b
136
- _vvextrema_zip (a, b) = collect (zip (a, b))
137
-
138
- """
139
- vvextrema(f, A::AbstractArray, dims=:)
140
-
141
- Compute the minimum and maximum values by calling `f` on each element of of `A`
142
- over the given `dims`.
143
-
144
- # Warning
145
- `NaN` values are not handled!
146
- """
147
- vvextrema (f:: F , A, dims) where {F} = _vvextrema_zip (vvminimum (f, A, dims), vvmaximum (f, A, dims))
148
- vvextrema (f:: F , A, :: Colon ) where {F} = (vvminimum (f, A, :), vvmaximum (f, A, :))
149
- vvextrema (f:: F , A) where {F<: Function } = vvextrema (f, A, :)
150
- # ::AbstractArray required in order for kwargs interface to work
151
-
152
- """
153
- vvextrema(A::AbstractArray, dims=:)
154
-
155
- Compute the minimum and maximum values of `A` over the given `dims`.
156
- """
157
- vvextrema (A:: AbstractArray , dims) = vvextrema (identity, A, dims)
158
- vvextrema (A:: AbstractArray ) = (vvminimum (A), vvmaximum (A))
159
-
160
131
# Define reduce
161
132
"""
162
133
vvreduce(op, init, A::AbstractArray, dims=:)
@@ -255,27 +226,6 @@ Compute the minimum value of `A` over the given `dims`, with the min initialized
255
226
"""
256
227
vvminimum (A; dims= :, init= typemax) = vvmapreduce (identity, min, init, A, dims)
257
228
258
- """
259
- vvextrema(f, A::AbstractArray; dims=:, init=(typemax, typemin))
260
-
261
- Compute the minimum and maximum values by calling `f` on each element of of `A`
262
- over the given `dims`, with the min and max initialized by the respective arguments
263
- of the 2-tuple `init`, which can be any combination of values `<:Number` or functions
264
- which accept a single type argument.
265
- """
266
- vvextrema (f, A; dims= :, init= (typemax, typemin)) =
267
- _vvextrema_zip (vvmapreduce (f, min, init[1 ], A, dims), vvmapreduce (f, max, init[2 ], A, dims))
268
-
269
- """
270
- vvextrema(A::AbstractArray; dims=:, init=(typemax, typemin))
271
-
272
- Compute the minimum and maximum values of `A` over the given `dims`,
273
- with the min and max initialized by `init`.
274
- """
275
- vvextrema (A; dims= :, init= (typemax, typemin)) =
276
- _vvextrema_zip (vvmapreduce (identity, min, init[1 ], A, dims), vvmapreduce (identity, max, init[2 ], A, dims))
277
-
278
-
279
229
# reduction over all dims
280
230
@generated function vvmapreduce (f:: F , op:: OP , init:: I , A:: AbstractArray{T, N} , :: Colon ) where {F, OP, I, T, N}
281
231
opsym = OP. instance
@@ -702,28 +652,6 @@ vtprod(A::AbstractArray) = vtmapreduce(identity, *, one, A, :)
702
652
vtmaximum (A:: AbstractArray ) = vtmapreduce (identity, max, typemin, A, :)
703
653
vtminimum (A:: AbstractArray ) = vtmapreduce (identity, min, typemax, A, :)
704
654
705
- """
706
- vtextrema(f, A::AbstractArray, dims=:)
707
-
708
- Compute the minimum and maximum values by calling `f` on each element of of `A`
709
- over the given `dims`.
710
-
711
- # Warning
712
- `NaN` values are not handled!
713
- """
714
- vtextrema (f:: F , A, dims) where {F} = _vvextrema_zip (vtminimum (f, A, dims), vtmaximum (f, A, dims))
715
- vtextrema (f:: F , A, :: Colon ) where {F} = (vtminimum (f, A, :), vtmaximum (f, A, :))
716
- vtextrema (f:: F , A) where {F<: Function } = vtextrema (f, A, :)
717
- # ::AbstractArray required in order for kwargs interface to work
718
-
719
- """
720
- vtextrema(A::AbstractArray, dims=:)
721
-
722
- Compute the minimum and maximum values of `A` over the given `dims`.
723
- """
724
- vtextrema (A:: AbstractArray , dims) = vtextrema (identity, A, dims)
725
- vtextrema (A:: AbstractArray ) = (vtminimum (A), vtmaximum (A))
726
-
727
655
"""
728
656
vtreduce(op, init, A::AbstractArray, dims=:)
729
657
@@ -818,26 +746,6 @@ Compute the minimum value of `A` over the given `dims`, with the min initialized
818
746
"""
819
747
vtminimum (A; dims= :, init= typemax) = vtmapreduce (identity, min, init, A, dims)
820
748
821
- """
822
- vtextrema(f, A::AbstractArray; dims=:, init=(typemax, typemin))
823
-
824
- Compute the minimum and maximum values by calling `f` on each element of of `A`
825
- over the given `dims`, with the min and max initialized by the respective arguments
826
- of the 2-tuple `init`, which can be any combination of values `<:Number` or functions
827
- which accept a single type argument.
828
- """
829
- vtextrema (f, A; dims= :, init= (typemax, typemin)) =
830
- _vvextrema_zip (vtmapreduce (f, min, init[1 ], A, dims), vtmapreduce (f, max, init[2 ], A, dims))
831
-
832
- """
833
- vtextrema(A::AbstractArray; dims=:, init=(typemax, typemin))
834
-
835
- Compute the minimum and maximum values of `A` over the given `dims`,
836
- with the min and max initialized by `init`.
837
- """
838
- vtextrema (A; dims= :, init= (typemax, typemin)) =
839
- _vvextrema_zip (vtmapreduce (identity, min, init[1 ], A, dims), vtmapreduce (identity, max, init[2 ], A, dims))
840
-
841
749
# reduction over all dims
842
750
@generated function vtmapreduce (f:: F , op:: OP , init:: I , A:: AbstractArray{T, N} , :: Colon ) where {F, OP, I, T, N}
843
751
opsym = OP. instance
0 commit comments