[SciPy-user] Vectorize vs Map

Travis Oliphant oliphant at ee.byu.edu
Thu Mar 15 12:58:56 EDT 2007


Lorenzo Isella wrote:

>Dear All,
>Probably another newbie question: I like quite a lot the vectorize()
>command which allows me to skip iterations on functions, but the map()
>command on a list performs a similar task if I am not mistaken.
>Is there any reason to favour one above the other or is it just a
>matter of taste?
>  
>
map only works with sequences (i.e. 1-d arrays) and does not do 
broadcasting for multiple-valued functions.

vectorize works with multiple dimensional arrays and also does 
broadcasting.

I have not done any timings but I suspect there are lots of cases where 
map is probably faster because it does less.

-Travis






More information about the SciPy-User mailing list