I would like to write a function in Julia that takes in a N x d numeric matrix where N is number of data points and d is the number of parameters:
- Extract the min and max along each dimension (this I can do)
- User-specified level of discretization (e.g. 1.0 in the below example)
- Returns a matrix
M x dwhich contains all combinations (see description ofMbelow).
As a simple example with d = 5, I have taken the results of part 1 where I obtain the min and max along each dimension.
minX = [ -1.0 -0.5 -1.1 -1.0 -0.9]
maxX = [3.8 2.5 1.8 3.1 2.3]
test=[minX[i]:1.0:maxX[i] for i in 1:5]
(I have purposely taken a coarse step of size 1.0). My question is how can I loop through test in a systematic way (without making 5 for loops) such that I get all combinations that result from the discretization which would yield a matrix of size M x d where
M = prod([length(x) for x in test]) # 1200 in this example.