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

Olivier Delalleau shish@keba...
Tue Sep 20 08:18:16 CDT 2011


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@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@sun.ac.za>
>
>> On Mon, Sep 19, 2011 at 4:18 PM, Aditya Sethi <ady.sethi@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@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110920/66438f1e/attachment.html 


More information about the NumPy-Discussion mailing list