For example, say that Dimension = 3, and N = 4, I'm trying to generate the following array:
[ [0,0,0], [0,0,1], [0,0,2], [0,0,3], [0,1,0], [0,1,1], [0,1,2], [0,1,3], [1,0,0], ... ... ..., [3,3,3] ].
(basically counting on base N)
Another example, if Dimension = 2 and N = 5, the output would be:
[ [0,0], [0,1], [0,2], [0,3], [0,4], [1,0], [1,1], [1,2], [1,3], [1,4], [2,0], [2,1], ... ... ..., [4,4] ].
I'm currently doing this successfully with the following code:
ParameterSpace = [ [int(i/N**j)%N for j in range(Dimension)][::-1] for i in range(N**Dimension) ]
The problem, however, is that it consumes lot of time and memory when I try for 'big' N and Dimension (in particular I can't get an answer when N = 16 and Dimension = 7 because it blows my memory of 16Gb)
So I was wondering if there is a more efficient way of doing it.
Thanks in advance.