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 v0 in accumulate in favor of init keyword #27859

Merged
merged 2 commits into from
Jul 9, 2018

Conversation

andyferris
Copy link
Member

@andyferris andyferris commented Jun 29, 2018

Implements the same as #27711 for accumulate and accumulate!.

@andyferris andyferris added deprecation This change introduces or involves a deprecation collections Data structures holding multiple items, e.g. sets labels Jun 29, 2018
@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch 2 times, most recently from e680568 to 250e0ca Compare June 29, 2018 12:09
@Keno
Copy link
Member

Keno commented Jun 29, 2018

Looks like we have a couple of test errors on this PR.

@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch 4 times, most recently from 7f3e49f to 3b92e81 Compare July 5, 2018 11:59
@andyferris
Copy link
Member Author

I got some time to look at this again. Funniliy enough, I had to add functionality to make this work cleanly. 😆

With this change, init should work on arrays of arbitrary dimension, not just vectors. Unfortunately, I haven't the time today to wrap this up (and provide tests for the new functionality).

@andyferris
Copy link
Member Author

For some reason this might not be working with offset arrays... I'm actually not sure how I broke that?

@andyferris
Copy link
Member Author

Also @StefanKarpinski not sure if this deserves a similar milestone to the reduce PR? (Just so we don't forget to merge this).

@StefanKarpinski StefanKarpinski added this to the 0.7 milestone Jul 6, 2018
@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch 2 times, most recently from 6f0cb00 to c4bda2e Compare July 7, 2018 23:46
@andyferris
Copy link
Member Author

andyferris commented Jul 7, 2018

So I found some questionable behavior regarding indices of OffsetArrays.

julia> include("test/TestHelpers.jl")
Main.TestHelpers

julia> using Main.TestHelpers.OAs

julia> a = [11,12,13]
3-element Array{Int64,1}:
 11
 12
 13

julia> b = OffsetArray(a, (-3,))
OffsetArray{Int64,1,Array{Int64,1}} with indices -2:0:
 11
 12
 13

julia> i = LinearIndices(b)
LinearIndices{1,Tuple{Base.Slice{UnitRange{Int64}}}} with indices -2:0:
 -2
 -1
  0

julia> i[-2]
-2

julia> i[-2:end]
-5:-3

I suspect this is a bug (cc @timholy @mbauman). Because these are a Slice I feel the scalar getindex behavior is correct and the behavior here is wrongly assuming 1-based indexing. The second commit of the PR attempts (and fails now succeeds...) to work around the inconsistency between scalar and range getindex on these indices by invoking iteration directly.

@andyferris
Copy link
Member Author

xref #27986

@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch from c4bda2e to 0bb1fa2 Compare July 8, 2018 11:21
@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch from 0bb1fa2 to 95af0c2 Compare July 8, 2018 21:43
@andyferris
Copy link
Member Author

Pending further comments, if this passes CI I'll merge (only 4 milestone items left, and this is one of them!)

@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch 2 times, most recently from 726e614 to 6c85116 Compare July 9, 2018 10:29
@andyferris andyferris force-pushed the ajf/accumulate-init-keyword branch from 6c85116 to f34f387 Compare July 9, 2018 12:24
@mbauman
Copy link
Member

mbauman commented Jul 9, 2018

Travis failures were FileWatching for Mac and in dep-gathering for Linux.

@mbauman mbauman merged commit 81ab651 into master Jul 9, 2018
@mbauman mbauman deleted the ajf/accumulate-init-keyword branch July 9, 2018 17:11
@@ -266,7 +286,7 @@ julia> accumulate!(-, B, A, dims=1);

julia> B
2×2 Array{Int64,2}:
1 2
1, 2
Copy link
Member

Choose a reason for hiding this comment

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

Cheeky little comma that breaks CI!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Data structures holding multiple items, e.g. sets deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants