[SciPy-user] vectorize bug/feature
oliphant at ee.byu.edu
Sat Nov 12 21:20:27 CST 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.
More information about the SciPy-user