Tag Info

New answers tagged

2

We can try like this: Parallelize[MapThread[ImageSubtract, {{image1,image2}, {fond1,fond2}}]] or ParallelTry[imageSubtract, {{imag1, fond1}, {imag2, fond2}}, 2] While imageSubtract[{image_,fond_}]:=Module[{},( Image[(ImageData[image1]-ImageData[fond1]+1)/2] )] We can use also ParallelMap[] ParallelMap[imageSubtract, {{imag1, fond1}, {imag2, ...


4

You can use ParallelCombine for this task: plot = Plot[#, {x, -10, 10}, PlotPoints -> 10] &; funcs = {Sin[x], Cos[x], Sinc[x]}; g = ParallelCombine[plot, funcs, Show] Be aware that the expressions in funcs are not held in this example. Consider using Formal Symbols for the plot variables. You can add styling with post-processing, e.g.: ...


3

Plot by itself is not parallelizable using Parallelize. You can plot each curve in a different kernel using ParallelTable and then Show the results together Show[ ParallelTable[ Plot[ Sin[a x] , {x, 0, Pi} , PlotRange -> {-1, 1} ], {a, {1, 2, 3}}]] You may need to use DistributeDefinitions so the sub-kernels know the definitions of your ...


6

I was able to speed up your code by a factor of 47,500 times faster than original. First, note that you can get a fairly good speedup just by eliminating the superfluous nested Table and Sum operators: n = 999; ak = RandomReal[{1, 10}, {1000, n}]; pimatk = RandomReal[{1, 10}, {1000, n}]; fikyj = RandomReal[{1, 10}, {1000, n}]; bk = RandomReal[{1, 10}, ...


2

Update Your code appears to be from yesterday's question: My Baum-Welch algorithm is very slow. Is it due to Mathematica? Answer The nested Table[Table[Tables and nested Sum[Sum[s not only make the code hard to read, but may also have a performance hit. Without a clue as to what ak, pimatk, fikyj, bk are, and how big they are, and what n is, this is ...


1

If your computation in each cycle takes little time there is no reason for paralleling this cycle. Prove: ParallelTable[i, {i, 1, 1000000}]; // AbsoluteTiming (*8 cores*) (*{0.449026, Null}*) Table[i, {i, 1, 1000000}]; // AbsoluteTiming (*{0.011001, Null}*) This is that becouse tranfering data to parallel kernels take more time than computation on it. ...


1

All function you need it's DistributeDefinitions and ParallelTry f1 := RandomInteger[{1, 24}] + RandomInteger[{1, 24}]; func[x_] := While[True, If[f1 === 2, Print["snake eyes"]; Return[True] ,(*else*) Print["nada"] ] ]; ParallelTry[func, Range[$KernelCount]]



Top 50 recent answers are included