Add getindex(::VofA, ::Colon, ::Int) - #25
Merged
Merged
Conversation
```julia
julia> using RecursiveArrayTools, StaticArrays
julia> s1 = SVector(1,2);
julia> s2 = SVector(3,4);
julia> a = VectorOfArray([s1,s2])
VectorOfArray{Int64,2}
u:
2-element Array{SVector{2,Int64},1}:
[1, 2]
[3, 4]
# Old behaviour
julia> a[:,2]
2-element Array{Int64,1}:
3
4
# New behaviour
julia> a[:,2]
2-element SVector{2,Int64}:
3
4
```
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
==========================================
+ Coverage 65.07% 65.23% +0.16%
==========================================
Files 3 3
Lines 209 210 +1
==========================================
+ Hits 136 137 +1
Misses 73 73
Continue to review full report at Codecov.
|
ChrisRackauckas
approved these changes
Nov 28, 2017
Member
|
Thanks! Yes, this is a very good idea. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR causes "matrix getindex" with a colon in the first place to return the unmodified underlying AbstractVector. Tests pass, bu I can potentially imagine unexpected behaviour if the internal AbstractArray is multidimensional. If problems like these are sorted out, I think it's nice to be able to get back, e.g., an
SVectorwithout having it converted to a standardArray