| Original Message (ID '277555') By yehuda: |
| First, you have a problem with the Flattening. You fully flatten and then partition. If you call n nested loops (using table) you need to flatten out only n-1 levels and skip the Partition[ ] part.
Second, there are other ways to WRITE more efficiently
I notice that all the parameters range between 0 to 1 in steps of 0.1
For this cans it is easy writing with Array
myParameters[n_Integer] :=
Flatten[Array[{##}*0.1 &, ConstantArray[11, n], ConstantArray[0, n]],
n - 1]
for n=6 (that is a,b,c,d,e,f) it takes only 0.7 sec to generate.
another way is to use Tuples which is ~50 times faster
myParametersTup[n_Integer] := Tuples[Range[0, 1, 0.1], n]
With Outer you get similar results
myParametersOut[n_Integer] :=
Flatten[Outer[List, Sequence @@ Table[Range[0, 1, 0.1], {n}]], n - 1]
hope this works for you |
|