-
Notifications
You must be signed in to change notification settings - Fork 4
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
map over PaddedAxis fails #56
Comments
Before I claim to have a fix for this, what is the return you want from |
I'm not familiar with AxisIndicies, just found the bug and wrote a quick issue 😊 Maybe this is useful: in OffsetArrays, the result is also an offset array: julia> using OffsetArrays
julia> a = OffsetArray(zeros(3), 20:22)
3-element OffsetArray(::Array{Float64,1}, 20:22) with eltype Float64 with indices 20:22:
0.0
0.0
0.0
julia> i = eachindex(a)
OffsetArrays.IdOffsetRange(20:22)
julia> result = map(identity, i)
3-element OffsetArray(::Array{Int64,1}, 20:22) with eltype Int64 with indices 20:22:
20
21
22
julia> result[1]
ERROR: BoundsError: attempt to access 3-element OffsetArray(::Array{Int64,1}, 20:22) with eltype Int64 with indices 20:22 at index [1]
Stacktrace:
[1] throw_boundserror(::OffsetArray{Int64,1,Array{Int64,1}}, ::Tuple{Int64}) at ./abstractarray.jl:537
[2] checkbounds at ./abstractarray.jl:502 [inlined]
[3] getindex(::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64) at /home/fons/.julia/packages/OffsetArrays/7j7P7/src/OffsetArrays.jl:275
[4] top-level scope at REPL[7]:1
julia> result[20]
20 |
I think the general trend is that the result of |
Thank you. It is greatly appreciated!
I borrowed liberally from concepts there so if you have How's this? julia> a = AxisArray(3:4, one_pad(sym_pad=2));
julia> i = eachindex(a)
one_pad(SimpleAxis(1:2); sym_pad=2)
julia> map(identity, i)
6-element AxisArray(::Array{Int64,1}
• axes:
1 = -1:4
)
1
-1 -1
0 0
1 1
2 2
3 3
4 4 |
perfect! |
Fixed in v0.7.1 |
It seems like
Base.map(::Function, ::PaddedAxis)
is implemented, but it fails for this basic use case:The text was updated successfully, but these errors were encountered: