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

[DOC] Fix small typo in subarray docs #23298

Merged
merged 4 commits into from
Aug 23, 2017

Conversation

iglpdc
Copy link
Contributor

@iglpdc iglpdc commented Aug 17, 2017

The types in the example were inconsistent.

@@ -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}`.
Copy link
Contributor

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 Int64s from indices, showing the difference between where index type parameters and element type parameters end up could be worthwhile.

Copy link
Contributor Author

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.

@@ -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}`.
Copy link
Member

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 :)

DocTestSetup = :(srand(1234))
```
```jldoctest subarray
julia> A = rand(6, 6, 6);
Copy link
Member

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
Copy link
Contributor Author

@iglpdc iglpdc Aug 21, 2017

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)

Copy link
Member

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, @fredrikekre

@fredrikekre fredrikekre merged commit fe27001 into JuliaLang:master Aug 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants