[Numpy-discussion] Upgrade to 1.6.x: frompyfunc() ufunc casting issue

Aditya Sethi ady.sethi at gmail.com
Tue Sep 20 09:40:13 EDT 2011


Understood. Thanks Olivier, Stefan.

On Tue, Sep 20, 2011 at 9:18 AM, Olivier Delalleau <shish at keba.be> wrote:

> He is using the development version of Numpy, which is probably the main
> difference (I tried it too with Numpy 1.6.1 on an x86_64 Linux architecture
> and got the same bug).
> If you want to use an official Numpy release you'll probably need to
> downgrade to 1.5.x and wait until the next Numpy release.
>
> -=- Olivier
>
>
> 2011/9/20 Aditya Sethi <ady.sethi at gmail.com>
>
>> Hi,
>>
>> Stefan, which version of Python and NumPy are you using?
>>
>> I am upgrading Python and NumPy, and would like to get it working on the
>> official releases of Python 2.7.2 + NumPy 1.6.1
>>
>> In Python 2.6 + NumPy 1.5.1 on win32, it works.
>> In Python 2.7.2 + NumPy 1.6.1 on win32, np.frompyfunc(add,2,1).accumulate
>> definitely gives an error.
>>
>> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
>> on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import numpy as np
>> >>> def add(a,b):
>> ...     return (a+b)
>> ...
>> >>> uadd = np.frompyfunc(add,2,1)
>> >>> uadd
>> <ufunc 'add (vectorized)'>
>> >>> uadd([1,2,3],[1,2,3])
>> array([2, 4, 6], dtype=object)
>> >>>
>> >>> uadd.accumulate([1,2,3])
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>> ValueError: could not find a matching type for add
>> (vectorized).accumulate, requested type has type code 'l'
>> >>>
>>
>> Aditya
>>
>>
>> 2011/9/19 Stéfan van der Walt <stefan at sun.ac.za>
>>
>>> On Mon, Sep 19, 2011 at 4:18 PM, Aditya Sethi <ady.sethi at gmail.com>
>>> wrote:
>>> > But uadd.accumulate(..) or uadd.reduce(..) fail with error:
>>> >  ValueError: could not find a matching type for add
>>> (vectorized).accumulate
>>> > ( or (vectorized).reduce )
>>> > Apologies, I should have been more clear before.
>>>
>>> In the development version:
>>>
>>> In [4]: uadd.accumulate([1,2,3])
>>> Out[4]: array([1, 3, 6], dtype=object)
>>>
>>> In [5]: uadd.reduce([1,2,3])
>>> Out[5]: 6
>>>
>>> Regards
>>> Stéfan
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110920/dee6e18f/attachment.html>


More information about the NumPy-Discussion mailing list