For some reason, I'd like to use ParallelTable with a variable number of iterators.
Table[a[1], {a[1], 0, 10}]works fine:
Output:
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
ParallelTable[a[1], {a[1], 0, 10}]returns an error:
Output: ParallelTable::nopar1: ParallelTable[ci[1],{ci[1],0,10}] cannot be parallelized; proceeding with sequential evaluation. >>
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
I am also interested in workarounds to use ParallelTable and a variable number of indices (typically: ParallelTable[f[Table[a[i],{i,1,n}]],Table[a[j],{j,1,n}]] where f is a function of a list with variable size).
ParallelTable[a[1], {a[1], 0, 10}]not working with variable likea[1], sinceParallelTable[f[i], {i, 0, 10}]does work. `ParallelTable[f[Table[a[i],{i,1,n}]],Table[a[j],{j,1,n}]] does not make sense. – Kattern Jun 06 '15 at 04:54Tablebut not withParallelTable.
– anderstood Jun 06 '15 at 04:56With[{iter = Sequence @@ Table[{a[j],-1, n}, {j, 1, n}]}, Table[f[Table[a[i], {i, 1, n}]], iter]]if you prefer...Tableversion of what you what? – Kattern Jun 06 '15 at 05:01With[{iter = Sequence @@ Table[{gag[j], -1, 1}, {j, 1, 3}]}, Table[f[Table[gag[i], {i, 1, 3}]], iter]]!. How can I make it work withParallelTableinstead ofTable? – anderstood Jun 06 '15 at 05:02ParallelTable[a[1], {a[1], 0, 10}]not work? – anderstood Jun 06 '15 at 05:05ReleaseHold[Hold[ParallelTable[a[1], {a[1], 0, 10}]] /. a[1] -> i]first. Let wait to see whether there is a better solution. – Kattern Jun 06 '15 at 05:11