Using Julia 1.1, I want to create a grid of points based on a vector of ranges
When using this code, it gives me a list of such points
u = [[i j ] for i in -1:0.5:1, j in -1:0.5:1]
[u...]
However, I am unable to develop a more generic approach that would create such a vector of multidimensional points when given an array of ranges
For example, develop a createGrid function that would take a Vector of n ranges as argument and output a list of all the points.
createGrid([1.:0.5:0., 1.:0.5:0., 1.:0.5:0.])
that would output:
27-element Array{Array{Float64,2},1}:
[-1.0 -1.0 -1.0]
[-0.5 -1.0 -1.0]
[0.0 -1.0 -1.0]
[-1.0 -0.5 -1.0]
[-0.5 -0.5 -1.0]
[0.0 -0.5 -1.0]
[-1.0 0.0 -1.0]
[-0.5 0.0 -1.0]
[0.0 0.0 -1.0]
[-1.0 -1.0 -0.5]
[-0.5 -1.0 -0.5]
[0.0 -1.0 -0.5]
[-1.0 -0.5 -0.5]
⋮
Thank you for any suggestion