Is there a simple way to parallelize sum of list elements ? when I use:
n = 500;
T1[z_] = Table[RandomReal[]/(RandomReal[] + RandomReal[] z), {i, n}];
Timing@Parallelize@Total@T1[1.]
error
Parallelize::nopar1: "T1[1.] cannot be parallelized; proceeding with sequential evaluation."
It is only an examle. I my calculation I have a huge expression with elements p/(q+r z) which are a result of using Apart[]
Thanks for your help , but the problem is something else f[z_]- very big formula (rational function) which should be integrated
Af[z_]:=Apart@f[z]
after that the Af[z] = p1/(q1+r1 z)+p2/(q2+ r2 z) +.....
thus integral is simply defined:
F[z_]:=Af[z]/. p_/(q_ + r_ z) -> p/r Log[q + r z]
The problem is: F[z] has a lot of simple elements, and I should compute F[z] for many complex points as quick as possible
regards, Olaf
Parallelize
here? Evaluating each element of the lists in turn insideTable
is very slow, you should be able to do everything in one step. If you have the listsp
,q
, andr
then simply defineT1[z_]:=p/(q+r z)
. $\endgroup$ – Quantum_Oli Oct 13 '16 at 10:38Table
evaluation withParallelTable
? I.e.,T2[z_] := ParallelTable[RandomReal[]/(RandomReal[] + RandomReal[] z), {i, n}];
$\endgroup$ – Marchi Dec 12 '16 at 16:51