[SciPy-user] vectorize bug/feature
Travis Oliphant
oliphant at ee.byu.edu
Sat Nov 12 22:20:27 EST 2005
Yaroslav Bulatov wrote:
>Suppose my function f returns 0, .1, .2 for values 0,1,2.
>When I do ff=vectorize(f); ff([1,2,3]), I get [0,0,0] which is
>counter-intuitive. Apparently it sees that f(0) is a long, so it makes
>the array of longs, and .1,.2 turn into 0.
>
>
If you don't declare the output type (using the otypes keyword to
vectorize), then the code simply uses the first argument to try and
discern the output type. You should pass in a fixed output type and
bypass the guess.
-Travis
More information about the SciPy-User
mailing list