Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate cumsum, cumprod, cumsum_kbn, and accumulate when dim isn't specified #24684

Merged
merged 5 commits into from
Nov 24, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust docstrings to match methods
  • Loading branch information
andreasnoack committed Nov 23, 2017
commit 797abadd64d144941ddaeca7735be86cf62a03d8
24 changes: 12 additions & 12 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,9 @@ function _cumsum!(out, v, axis, ::TypeArithmetic)
end

"""
cumsum(A, dim)
cumsum(A, axis::Integer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep dim or use region, which are the two terms that appear to be common in similar functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what the method uses. They used to be out of sync. However, since we have reducedim, it is probably better to use dim here as well. I'll update.


Cumulative sum along a dimension `dim`. See also [`cumsum!`](@ref)
Cumulative sum along the axis `axis`. See also [`cumsum!`](@ref)
to use a preallocated output array, both for performance and to control the precision of the
output (e.g. to avoid overflow).

Expand Down Expand Up @@ -743,9 +743,9 @@ julia> cumsum([fill(1, 2) for i in 1:3])
cumsum(x::AbstractVector) = cumsum(x, 1)

"""
cumsum!(B, A, dim::Integer)
cumsum!(B, A, axis::Integer)

Cumulative sum of `A` along a dimension, storing the result in `B`. See also [`cumsum`](@ref).
Cumulative sum of `A` along the axis `axis`, storing the result in `B`. See also [`cumsum`](@ref).
"""
cumsum!(B, A, axis::Integer) = accumulate!(+, B, A, axis)

Expand All @@ -757,9 +757,9 @@ Cumulative sum of a vector `x`, storing the result in `y`. See also [`cumsum`](@
cumsum!(y::AbstractVector, x::AbstractVector) = cumsum!(y, x, 1)

"""
cumprod(A, dim)
cumprod(A, axis::Integer)

Cumulative product along a dimension `dim`. See also
Cumulative product along the axis `axis`. See also
[`cumprod!`](@ref) to use a preallocated output array, both for performance and
to control the precision of the output (e.g. to avoid overflow).

Expand Down Expand Up @@ -806,9 +806,9 @@ julia> cumprod([fill(1//3, 2, 2) for i in 1:3])
cumprod(x::AbstractVector) = cumprod(x, 1)

"""
cumprod!(B, A, dim::Integer)
cumprod!(B, A, axis::Integer)

Cumulative product of `A` along a dimension, storing the result in `B`.
Cumulative product of `A` along the axis `axis`, storing the result in `B`.
See also [`cumprod`](@ref).
"""
cumprod!(B, A, axis::Integer) = accumulate!(*, B, A, axis)
Expand All @@ -822,9 +822,9 @@ See also [`cumprod`](@ref).
cumprod!(y::AbstractVector, x::AbstractVector) = cumprod!(y, x, 1)

"""
accumulate(op, A, dim)
accumulate(op, A, axis::Integer)

Cumulative operation `op` along a dimension `dim`. See also
Cumulative operation `op` along the axis `axis`. See also
[`accumulate!`](@ref) to use a preallocated output array, both for performance and
to control the precision of the output (e.g. to avoid overflow). For common operations
there are specialized variants of `accumulate`, see:
Expand Down Expand Up @@ -875,9 +875,9 @@ julia> accumulate(*, [1,2,3])
accumulate(op, x::AbstractVector) = accumulate(op, x, 1)

"""
accumulate!(op, B, A, dim)
accumulate!(op, B, A, axis::Integer)

Cumulative operation `op` on `A` along a dimension, storing the result in `B`.
Cumulative operation `op` on `A` along the axis `axis`, storing the result in `B`.
See also [`accumulate`](@ref).
"""
function accumulate!(op, B, A, axis::Integer)
Expand Down