I have a defined function $F(x,y,z)$ and data of $(x,y)$ and would like to evaluate the sum of F over data and at different z values. Here is a minimal example:
F[x_, y_, z_] := Sin[x y z];
data = Flatten[Table[{x, y}, {x, -2, 2, 0.05}, {y, -2, 2, 0.05}], 1];
ParallelTable[
Sum[F[data[[i, 1]], data[[i, 2]], z], {i, Length@data}], {z, 0, 10,
0.01}]; // AbsoluteTiming
{11.4345, Null}
I tried to compile to speed it up but did not get that much enhancement
Fc = Compile[{{x, _Real}, {y, _Real}, {z, _Real}}, Sin[x y z],
CompilationTarget -> "WVM"];
ParallelTable[
Sum[Fc[data[[i, 1]], data[[i, 2]], z], {i, Length@data}], {z, 0,
10, 0.01}]; // AbsoluteTiming
{9.85097, Null}
Is there still a way to increase the speed?