Generate all tuples with C - better way than nested loops?
问题 I have an array double x[] of length 11 and a function f(double x[]) . I want to find the minimum of the function f() by discretization. So for given values val1, val2, ..., valn I need a loop trough all the tuples of x in {val_1, ..., val_n}^11. I could easily use 11 nested loops, but is this really the most efficient I could do? Edit: To clarify things: the function f() is defined on an 11 dimensional set. I want to evaluate the function on the vertices of the an 11 dimensional grid. For a