-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[DOC] Fix small typo in subarray docs #23298
Conversation
doc/src/devdocs/subarrays.md
Outdated
@@ -71,7 +71,7 @@ a `Tuple` of the types of the indices for each dimension. The final one, `L`, is | |||
as a convenience for dispatch; it's a boolean that represents whether the index types support | |||
fast linear indexing. More on that later. | |||
|
|||
If in our example above `A` is a `Array{Float64, 3}`, our `S1` case above would be a `SubArray{Int64,2,Array{Int64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}`. | |||
If in our example above `A` is a `Array{Int64, 3}`, our `S1` case above would be a `SubArray{Int64,2,Array{Int64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}`. |
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.
It might be more clarifying to change the SubArray part instead to match Array{Float64, 3}
? Since there are also various Int64
s from indices, showing the difference between where index type parameters and element type parameters end up could be worthwhile.
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.
Yep, you're right. I'll fix that in a minute.
b184fc8
to
39693cd
Compare
doc/src/devdocs/subarrays.md
Outdated
@@ -71,7 +71,7 @@ a `Tuple` of the types of the indices for each dimension. The final one, `L`, is | |||
as a convenience for dispatch; it's a boolean that represents whether the index types support | |||
fast linear indexing. More on that later. | |||
|
|||
If in our example above `A` is a `Array{Float64, 3}`, our `S1` case above would be a `SubArray{Int64,2,Array{Int64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}`. | |||
If in our example above `A` is a `Array{Float64, 3}`, our `S1` case above would be a `SubArray{Float64,2,Array{Float64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}`. |
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.
Seems like Colon
has changed to Base.OneTo{Int64}
also.
julia> A = rand(10,10,10);
julia> S1 = view(A, :, 5, 2:6);
julia> typeof(S1)
SubArray{Float64,2,Array{Float64,3},Tuple{Base.Slice{Base.OneTo{Int64}},Int64,UnitRange{Int64}},false}
And on line 80 below (if you feel like updating it):
julia> S1.indexes
(Base.Slice(Base.OneTo(10)), 5, 2:6)
This is why doctests are important :)
doc/src/devdocs/subarrays.md
Outdated
DocTestSetup = :(srand(1234)) | ||
``` | ||
```jldoctest subarray | ||
julia> A = rand(6, 6, 6); |
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.
Does the matrix really have to be so big?
```@meta | ||
DocTestSetup = :(srand(1234)) | ||
``` | ||
```jldoctest subarray |
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.
In line 175, should jldoctest
-> jldoctest subarray
like here? (I couldn't figure out what this really does from the Documenter.jl docs)
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.
No, because we don't use anything (eg. variables, functions etc) from these blocks in that block below, see https://juliadocs.github.io/Documenter.jl/latest/man/doctests/#Preserving-definitions-between-blocks-1 :)
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.
thanks, @fredrikekre
The types in the example were inconsistent.