Open efaulhaber opened 7 months ago
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.
Same with dynamic axes sizes:
Same with
view
s:Interestingly, this works:
CC @ranocha