Skip to content

Commit 9699be5

Browse files
committed
get rid of obsolete rcum_promote_type
1 parent d8ac226 commit 9699be5

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

base/multidimensional.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -731,15 +731,6 @@ julia> findn(A)
731731
end
732732

733733

734-
# see discussion in #18364 ... we try not to widen type of the resulting array
735-
# from cumsum or cumprod, but in some cases (+, Bool) we may not have a choice.
736-
rcum_promote_type(op, ::Type{T}, ::Type{S}) where {T,S} = promote_op(op, T, S)
737-
rcum_promote_type(op, ::Type{T}) where {T} = rcum_promote_type(op, T,T)
738-
739-
# handle sums of Vector{Bool} and similar. it would be nice to handle
740-
# any AbstractArray here, but it's not clear how that would be possible
741-
rcum_promote_type(op, ::Type{Array{T,N}}) where {T,N} = Array{rcum_promote_type(op,T), N}
742-
743734
# accumulate_pairwise slightly slower then accumulate, but more numerically
744735
# stable in certain situations (e.g. sums).
745736
# it does double the number of operations compared to accumulate,
@@ -773,7 +764,7 @@ function accumulate_pairwise!(op::Op, result::AbstractVector, v::AbstractVector)
773764
end
774765

775766
function accumulate_pairwise(op, v::AbstractVector{T}) where T
776-
out = similar(v, rcum_promote_type(op, T))
767+
out = similar(v, promote_op(op, T))
777768
return accumulate_pairwise!(op, out, v)
778769
end
779770

@@ -818,7 +809,7 @@ julia> cumsum(a,2)
818809
```
819810
"""
820811
function cumsum(A::AbstractArray{T}, dim::Integer) where T
821-
out = similar(A, rcum_promote_type(+, T))
812+
out = similar(A, promote_op(+, T))
822813
cumsum!(out, A, dim)
823814
end
824815

@@ -952,7 +943,7 @@ julia> accumulate(+, fill(1, 3, 3), 2)
952943
```
953944
"""
954945
function accumulate(op, A, dim::Integer)
955-
out = similar(A, rcum_promote_type(op, eltype(A)))
946+
out = similar(A, promote_op(op, eltype(A)))
956947
accumulate!(op, out, A, dim)
957948
end
958949

@@ -1101,7 +1092,7 @@ julia> accumulate(min, 0, [1,2,-1])
11011092
```
11021093
"""
11031094
function accumulate(op, v0, x::AbstractVector)
1104-
T = rcum_promote_type(op, typeof(v0), eltype(x))
1095+
T = promote_op(op, typeof(v0), eltype(x))
11051096
out = similar(x, T)
11061097
accumulate!(op, out, v0, x)
11071098
end

0 commit comments

Comments
 (0)