[PYTHON MATRIX-SIG] Odd behavior of "Numeric.fromfunction"
David Ascher
da@maigret.cog.brown.edu
Thu, 14 Nov 1996 10:06:52 -0500 (EST)
> Feature, though not a well-known one. fromfunction() works correctly
> only if the function
> 1) uses all its arguments
> 2) consists only of scalar operations defined on arrays (i.e. elementary
> arithmetic operations and functions from umath).
This is in the tutorial:
---
Currently, the function which is called by fromfunction can only use
numerical operations and ufuncs on its arguments. It cannot, for
example, use if ... else: ... constructs. This is due to the fact that
fromfunction does operations "en masse" to speed up evaluation. If you
need to fill an array with the result of a function which does not meet
these criteria, you can always use a function like:
---
I will also add in the next release of the tutorial code from Konrad
which removes these limitations (at the expense of speed, alas).
--david
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================