-
Notifications
You must be signed in to change notification settings - Fork 40
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
Implicitly specify axes using colons in the constructor #139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done! Probably there are some utils in Base that can be reused here, but I think this one is written pretty clearly and self-explained.
The failed test in the nightly build is unrelated so I believe this is good to get merged; the fix for the nightly build can be done in other PR.
This works with offset axes as well, and is not limited to non-offset ones. julia> OffsetArray(zeros(3:4), :)
2-element OffsetArray(::Array{Float64,1}, 3:4) with eltype Float64 with indices 3:4:
0.0
0.0
julia> OffsetArray(zeros(3:4, 5:6), :, 4:5)
2×2 OffsetArray(::Array{Float64,2}, 3:4, 4:5) with eltype Float64 with indices 3:4×4:5:
0.0 0.0
0.0 0.0 I wonder if I should add tests for these? |
yes, we may want to make sure the axes is not changed with |
reopen this PR to retrigger the nightly test based on #140 |
Codecov Report
@@ Coverage Diff @@
## master #139 +/- ##
==========================================
+ Coverage 86.29% 90.45% +4.16%
==========================================
Files 2 2
Lines 197 220 +23
==========================================
+ Hits 170 199 +29
+ Misses 27 21 -6
Continue to review full report at Codecov.
|
I don't have issues with the delay, but I'm just wondering if this should go in a minor release whereas the bugfix for #136 should go in a patch release? Perhaps I'm not clear about the release sequence |
In case certain axes of an array are not offset, they may be implicitly specified using
Colon
s in the constructor. The colons would be replaced by the corresponding axes of the parent array.This is useful in cases where the size along a non-offset dimension is not known a-priori.