Difference in pmap and map

96 views
Skip to first unread message

Rajath Shashidhara

unread,
Jul 13, 2015, 6:12:23 AM7/13/15
to juli...@googlegroups.com
Hello,

I'm trying to understand why pmap and map do not follow the same convention. 
[1] map retains the type in the result but pmap does not.
[2] pmap flattens the n-dimensional arrays before applying the function.

For e.g.:
julia> x = rand(2,2)
2x2 Array{Float64,2}:
 0.79318   0.368926 
 0.878642  0.0445509

julia> function f(x):
           2*x
       end
f (generic function with 1 method)

julia> map(f,x)
2x2 Array{Float64,2}:
 1.58636  0.737852 
 1.75728  0.0891018

julia> pmap(f,x)
4-element Array{Any,1}:
 1.58636  
 1.75728  
 0.737852 
 0.0891018

Is there any rationale behind it? It would be nice if both behaved in the exact same way.

Thank you,
Rajath Shashidhara
Reply all
Reply to author
Forward
0 new messages