In this particular case it is incredibly helpful to have negative indices (and 0 too).
One issue I have run into with OffsetArrays is that I can’t use setindex! or setindex. Unfortunately I must update the elements in the 2 dimension array constantly.
Is there a way to make a 2 dimensional complex array that can have negative indices and is mutable?
Yes this works! I was playing around with a simpler example from a forum and it would not allow me to mutate :S. This however does, so I am happy with that.
I was playing with test = OffsetArray(1:5,-2:2), and I could not update the values after… this is probably due to the use of a range.
julia> typeof(OffsetArray(1:5,-2:2))
OffsetArray{Int64,1,UnitRange{Int64}}
julia> typeof(OffsetArray([1:5...],-2:2)) # this you can mutate
OffsetArray{Int64,1,Array{Int64,1}}