Understood. Thanks Olivier, Stefan.
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.
-=- Olivier2011/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.1In 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 win32Type "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'>>>Aditya2011/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:In the development version:
> 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 [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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion