[Numpy-discussion] fromfunction documentation
acapnotic at users.sourceforge.net
Mon May 28 00:28:08 EDT 2001
Quoting from numdoc.pdf, dated March 31, 2001, in section
"Creating an array from a function: fromfunction()"
> The implementation of fromfunction consists of:
> def fromfunction(function, dimensions):
> return apply(function, tuple(indices(dimensions)))
> which means that the function function is called for each element in
> the sequence indices(dimensions) [...]
This is wholly incorrect. apply() does not call a function for each
element in the sequence, apply calls a function exactly *once*, using
the elements of the sequence for arguments.
Also, that same section of the documentation refers to "the first
example below [...] works" and "the second array [...] fails", but there
is only one example, which apparently is the failing one (as it's named
"buggy"). Having a *working* example would be nice. =)
Perhaps this is a formatting glitch in the documentation processor, but
I couldn't find the documentation's source format.
and then... there's always the possibility that I'm barking up the
wrong tree. What I'm trying to achieve is this: I've got a function
which, given a vector describing a point in n-dimensional space, returns
a value for that point. I want a matrix of the shape I specify, filled
these values, with the array indicies as coordinates for the points.
Is that too much to ask? ;)
- Kevin Turner
[using Python version 2.0, PyNum 19.0.0]
Kevin Turner <acapnotic at users.sf.net> | OpenPGP encryption welcome here
More information about the NumPy-Discussion