[Matrix-SIG] array_map?

Travis Oliphant Oliphant.Travis@mayo.edu
Mon, 19 Apr 1999 10:01:03 -0500 (CDT)


Two comments:

Much of the time you can define your function to operate on general
arrays anyway so that when it takes an array it returns an array.  This
is due to the way the mathematical operators are mapped over arrays
(ufuncs).

At times you may not be able to write your function like that.  It looks
like you want a way to make a regular python function that takes numbers
as arguments into a "ufunc" so that it works nicely over arrays with the
casting and broadcasting rules applied as with all other ufuncs.  I've
thought some about this and think it is possible to make a class that
could be used to "wrap" up functions you want to use in this way.

From the source code it looks like there was going to be an array_map()
function at some point but I don't know what happened to it, or why it was
never developed.

Travis