[SciPy-user] Vectorize vs Map
Thu Mar 15 12:17:24 CDT 2007
Fernando Perez wrote:
> On 3/15/07, Robert Kern <firstname.lastname@example.org> wrote:
>> 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?
>> vectorize() takes a Python function and turns it into a ufunc. ufuncs do a lot
>> more than map() does. They can take multidimensional arrays. n-ary ufuncs can
>> take multiple inputs and broadcast them against each other. ufuncs have methods
>> like .inner() and .reduce() which are quite powerful.
> Mmh, isn't that what 'frompyfunc' does instead? vectorize doesn't
> seem to produce a true ufunc. Perhaps I'm just misunderstanding
No, just my poor memory. I don't use either.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user