[PYTHON MATRIX-SIG] Applying a general function to an array
David Redish
dredish@CS.cmu.edu
Thu, 22 Feb 1996 12:13:40 -0500
Is it possible to apply a general python function (that takes one
input and produces one output to an array? For example, I'd like to
have a python function (implemented in C), "y = f(x)" and then be able
to say Y = f(X) and get Y set to an array where each element in Y is f
applied to the corresponding element in X.
I guess I could get the shape, ravel the array, apply the function
using map, convert the list to an array, and reshape it, but that
seems like it would be very slow.
In a similar vein, is there documentation for
1. the Array C API
2. ofuncs
While, I'm at it, I'd like to complement Paul Dubois and David Ascher
for their documentation efforts. It's been incredibly helpful. (And
of course to Jim and Konrad for all their work putting this together.)
adr
------------------------------------------------------------
David Redish Computer Science Department CMU
graduate student Neural Processes in Cognition Training Program
Center for the Neural Basis of Cognition (CNBC)
http://www.cs.cmu.edu/Web/People/dredish/home.html
------------------------------------------------------------
maintainer, CNBC website:
http://www.cs.cmu.edu/Web/Groups/CNBC
maintainer, Cog-Neuro Sites on the Internet, courtesy CNBC:
http://www.cs.cmu.edu/Web/Groups/CNBC/other
maintainer, NIPS*96 website:
http://www.cs.cmu.edu/Web/Groups/NIPS
------------------------------------------------------------
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================