Efficient rectangular grids: RectiGrids.jl, some discussion:
Depending on what you need in the end, you may also use map
on top of the grid:
julia> using RectiGrids
julia> grid(1:3, 2:4)
2-dimensional KeyedArray(...) with keys:
↓ 3-element UnitRange{Int64}
→ 3-element UnitRange{Int64}
And data, 3×3 RectiGrids.RectiGridArr{...}:
(2) (3) (4)
(1) (1, 2) (1, 3) (1, 4)
(2) (2, 2) (2, 3) (2, 4)
(3) (3, 2) (3, 3) (3, 4)
# similar to rectangulardomain() from RootsAndPoles, but better:
# remains a multidimensional array, not a flat vector
julia> map(t -> complex(t...), grid(1:3, 2:4))
2-dimensional KeyedArray(...) with keys:
↓ 3-element UnitRange{Int64}
→ 3-element UnitRange{Int64}
And data, 3×3 Matrix{Complex{Int64}}:
(2) (3) (4)
(1) 1+2im 1+3im 1+4im
(2) 2+2im 2+3im 2+4im
(3) 3+2im 3+3im 3+4im
# mapview() instead of map() avoids materializing the whole array:
julia> using FlexiMaps
julia> mapview(t -> complex(t...), grid(1:3, 2:4))
3×3 FlexiMaps.MappedArray{...}:
1+2im 1+3im 1+4im
2+2im 2+3im 2+4im
3+2im 3+3im 3+4im