-
Notifications
You must be signed in to change notification settings - Fork 9
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
Slicing doesn't work with PtrArray
#88
Comments
Seems that indexing with extra arguments is broken: julia> using StrideArraysCore
│ Package StrideArraysCore not found, but a package named StrideArraysCore is available from a registry.
│ Install package?
│ (@lvdev) pkg> add StrideArraysCore
└ (y/n/o) [y]:
Resolving package versions...
Updating `~/.julia/environments/lvdev/Project.toml`
[7792a7ef] + StrideArraysCore v0.5.2
Updating `~/.julia/environments/lvdev/Manifest.toml`
[7792a7ef] + StrideArraysCore v0.5.2
julia> x = [1.0, 2.0, 3.0, 4.0];
julia> y = PtrArray(pointer(x), (StaticInt(2), StaticInt(2)))
2×2 PtrArray{Float64, 2, (1, 2), Tuple{StaticInt{2}, StaticInt{2}}, Tuple{Nothing, Nothing}, Tuple{StaticInt{1}, StaticInt{1}}} with indices static(1):static(2)×static(1):static(2):
1.0 3.0
2.0 4.0
julia> y[1, :]
2-element PtrArray{Float64, 1, (1,), Tuple{StaticInt{2}}, Tuple{StrideArraysCore.StrideReset{StaticInt{2}}}, Tuple{StaticInt{1}}} with indices static(1):static(2):
1.0
2.0
julia> ys = y[1, :];
julia> ys[1]
1.0
julia> ys[2]
3.0
julia> Array(ys)
2-element Vector{Float64}:
1.0
3.0
julia> copy(ys)
2-element StrideArraysCore.StaticStrideArray{Float64, 1, (1,), Tuple{StaticInt{2}}, Tuple{Nothing}, Tuple{StaticInt{1}}, 2} with indices static(1):static(2):
1.0
3.0
julia> print(ys)
[1.0, 3.0]
julia> show(ys)
[1.0, 3.0]
julia> ys[CartesianIndex(2,1)]
3.0
julia> ys[2]
3.0
julia> ys[2, 1]
2.0 |
That's interesting. |
Probably just take the lazy approach and define extra methods, so that extra indices are ignored when indexing into an array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same with dynamic axes sizes:
Same with
view
s:Interestingly, this works:
CC @ranocha
The text was updated successfully, but these errors were encountered: