JuliaArrays / JuliaArrays/OffsetArrays.jl
`collect(Iterator.product(offset arrays))` is an OffsetArray but `collect (offset_array)` is not
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 212
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
So here is a weird thing:
julia> Iterators.product(OffsetArray(rand(3), -1:1), 1:2) |> collect
3×2 OffsetArray(::Matrix{Tuple{Float64, Int64}}, -1:1, 1:2) with eltype Tuple{Float64, Int64} with indices -1:1×1:2:
(0.892917, 1) (0.892917, 2)
(0.398366, 1) (0.398366, 2)
(0.550785, 1) (0.550785, 2)
julia> collect(ans)
3×2 Matrix{Tuple{Float64, Int64}}:
(0.892917, 1) (0.892917, 2)
(0.398366, 1) (0.398366, 2)
(0.550785, 1) (0.550785, 2)
Since collect promises an Array not an AbstractArray I am thinking that the first return is wrong. But I think this should probably be consistent at least. At least I would assume that collect(collect()) == collect
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the discrepancy using Iterators.product with an OffsetArray, then compare it with collect applied to an already collected OffsetArray. Read the collect behavior involved in these two cases and determine which result should satisfy the stated Array and consistency expectations. Done means the behavior is consistent and covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100