Skip to content

Commit 6069c76

Browse files
committed
get rid of obsolete rcum_promote_type
1 parent 696c916 commit 6069c76

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

base/multidimensional.jl

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -685,16 +685,6 @@ _iterable(v) = Iterators.repeated(v)
685685
end
686686
end
687687

688-
##
689-
690-
# see discussion in #18364 ... we try not to widen type of the resulting array
691-
# from cumsum or cumprod, but in some cases (+, Bool) we may not have a choice.
692-
rcum_promote_type(op, ::Type{T}, ::Type{S}) where {T,S} = promote_op(op, T, S)
693-
rcum_promote_type(op, ::Type{T}) where {T} = rcum_promote_type(op, T,T)
694-
695-
# handle sums of Vector{Bool} and similar. it would be nice to handle
696-
# any AbstractArray here, but it's not clear how that would be possible
697-
rcum_promote_type(op, ::Type{Array{T,N}}) where {T,N} = Array{rcum_promote_type(op,T), N}
698688

699689
# accumulate_pairwise slightly slower then accumulate, but more numerically
700690
# stable in certain situations (e.g. sums).
@@ -729,7 +719,7 @@ function accumulate_pairwise!(op::Op, result::AbstractVector, v::AbstractVector)
729719
end
730720

731721
function accumulate_pairwise(op, v::AbstractVector{T}) where T
732-
out = similar(v, rcum_promote_type(op, T))
722+
out = similar(v, promote_op(op, T))
733723
return accumulate_pairwise!(op, out, v)
734724
end
735725

@@ -774,7 +764,7 @@ julia> cumsum(a,2)
774764
```
775765
"""
776766
function cumsum(A::AbstractArray{T}, dim::Integer) where T
777-
out = similar(A, rcum_promote_type(+, T))
767+
out = similar(A, promote_op(+, T))
778768
cumsum!(out, A, dim)
779769
end
780770

@@ -908,7 +898,7 @@ julia> accumulate(+, fill(1, 3, 3), 2)
908898
```
909899
"""
910900
function accumulate(op, A, dim::Integer)
911-
out = similar(A, rcum_promote_type(op, eltype(A)))
901+
out = similar(A, promote_op(op, eltype(A)))
912902
accumulate!(op, out, A, dim)
913903
end
914904

@@ -1057,7 +1047,7 @@ julia> accumulate(min, 0, [1,2,-1])
10571047
```
10581048
"""
10591049
function accumulate(op, v0, x::AbstractVector)
1060-
T = rcum_promote_type(op, typeof(v0), eltype(x))
1050+
T = promote_op(op, typeof(v0), eltype(x))
10611051
out = similar(x, T)
10621052
accumulate!(op, out, v0, x)
10631053
end

0 commit comments

Comments
 (0)