I have a function which I run using pmap. I would like the output to be a vector - p - whose entries are the output of each iteration run parallel. For illustration, the code is as below:
@everywhere function addo(mc,mcf)
p = zeros(Int64,mcf) ;
p[mc] = mc ;
return p
end
pmap(mc -> addo(mc,mcf),1:1:mcf) ;
The output I get is
100-element Array{Array{Int64,1},1}:
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 2, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 3, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
⋮
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 98, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 99, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 100]
Instead, I need something like this, p = [1,2,3,4,...,100];
How do I get the output in the desired format?