[SciPy-user] vectorize(function)/arraymap did not return arrays?

Travis Oliphant oliphant at ee.byu.edu
Thu Jan 20 19:16:51 EST 2005


Yichun Wei wrote:

> Hello Travis,
>
> Sorry I'm posting this for more detailed description.
>
> I have problem with vectorize class and/or arraymap method. I supposed 
> vectorized callable objects constructed by scipy.vectorize class could 
> return arrays, (I was evaluating a function over a 2-d array, and each 
> function call should return an 1-d array at every point in this 2-d 
> array as a result. I would like to construct a 3-d array with these 
> results.) However I could not get the results as expected:

Unfortunately, this is not true.  Vectorize expects the helper function 
to accept scalars and return scalars.  It then converts the ordinary 
scalar function into a ufunc-like function (accepting arrays and 
returning arrays of the same size). 

It sounds like you need something different which will require looping.

-Travis




More information about the SciPy-User mailing list