並列な処理の命令: Parallel process order
ParallelTable
はTable
と同様の処理を並列に行うとのこと.
例えば,4つの異なる積分を並列に評価させたいなら,以下のように書けば良い:
ParallelTable
returns the same process as Table
, but with parallel.
If we would like to do parallel integration independently, we should write the following order.
(*
4成分配列を定義し,各成分に被積分関数を記述
Define a list having four elements
*)
f = Range[4]
f[[1]] = x;
f[[2]] = Exp[x];
f[[3]] = Cos[x];
f[[4]] = 1;
Result = ParallelTable[
Integrate[ f[[i]],x ],
{i,1,4}] (*i=1~4 の場合をそれぞれ並列に評価*)
この処理の結果は,以下のようになる:
The above process returns the following result:
{x^2/2,Exp[x],Sin[x],x}
この配列の2番目の結果を取り出したい場合は,
If one wants to take the second element of the result, write:
Result[[2]]
と書く.