You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To write generic multidimensional function, it is pretty natural to code a CartesianIndex for loop with stride in this way:
stride =2
R =CartesianIndices(A)
Δ =CartesianIndex(ntuple(_->stride, ndims(A)))
for I infirst(R):Δ:last(R)
...end
Unfortunately, this isn't supported, so I have to work it around with something like this:
R_s =map(axes(R)) do I
first(I):stride:last(I)
endfor I in R[R_s...]
...end
which is quite slow...
I'm wondering if it's okay to get first(R):Δ:last(R) work. Is this already discussed somewhere, or simply not implemented yet? I tried to search the repo but failed to find any related information.
If it's okay to add this, my first try would be to add a new field step to the current CartesianIndices:
struct CartesianIndices{N,R<:NTuple{N,AbstractUnitRange{Int}}, S<:NTuple{N, Int}} <: AbstractArray{CartesianIndex{N},N}
indices::R
step::S
end
and then work on the getindex
The text was updated successfully, but these errors were encountered:
To write generic multidimensional function, it is pretty natural to code a CartesianIndex for loop with stride in this way:
Unfortunately, this isn't supported, so I have to work it around with something like this:
which is quite slow...
I'm wondering if it's okay to get
first(R):Δ:last(R)
work. Is this already discussed somewhere, or simply not implemented yet? I tried to search the repo but failed to find any related information.If it's okay to add this, my first try would be to add a new field
step
to the currentCartesianIndices
:and then work on the
getindex
The text was updated successfully, but these errors were encountered: