Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'param sets' topicStudent Support Forum > General > Archives > "param sets"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda
01/24/13 12:31pm

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

URL: ,

Subject (listing for 'param sets')
Author Date Posted
param sets Patrick 01/23/13 6:39pm
Re: param sets yehuda 01/24/13 12:31pm
Re: Re: param sets Patrick 01/24/13 5:35pm
Re: param sets Bill Simpson 01/24/13 4:24pm
Re: Re: param sets Patrick 01/25/13 11:50am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic