-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
There are some differences between tmap
from OhMyThreads
and map
/pmap
from Base
/Distributed
when dealing with arrays having different axes.
I think it would be great if the behaviour would be the same so that tmap
could be used in place of map
without worrying about getting different results.
Same examples:
using Distributed
using OffsetArrays
using OhMyThreads
v = OffsetVector(rand(10), 11:20)
# tmap always returns an Array
map(x -> x + 1, v) isa OffsetVector
pmap(x -> x + 1, v) isa OffsetVector
tmap(x -> x + 1, v) isa Vector
# Different exception type when axes do not match
map(+, v, 1:10) # throws DimensionMismatch
pmap(+, v, 1:10) # throws DimensionMismatch
tmap(+, v, 1:10) # throws ErrorException
# In the case the inputs are vectors and have no offset axes, map/pmap allow them to have different lengths
map(+, 1:5, 1:10) # 5-element Vector{Int64}
pmap(+, 1:5, 1:10) # 5-element Vector{Int64}
tmap(+, 1:5, 1:10) # throws ErrorException
MasonProtter
Metadata
Metadata
Assignees
Labels
No labels