The Julia manual talks about being able to define custom unit ranges https://docs.julialang.org/en/v1/devdocs/offset-arrays/index.html.
There are at least 3 packages that deal with this. 1) https://github.com/JuliaArrays/CustomUnitRanges.jl 2) https://github.com/JuliaArrays/OffsetArrays.jl 3) https://github.com/JuliaArrays/EndpointRanges.jl
I am not having much luck figuring it out. I am trying to duplicate fortran code, this piece specifically
COMPLEX, DIMENSION(n, 0:nk) :: eikx COMPLEX, DIMENSION(n,-nk:nk) :: eiky, eikz
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. 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?