[Numpy-discussion] Can't get ufunc to work for integers

John Salvatier jsalvati at u.washington.edu
Thu Jul 22 11:49:09 EDT 2010


Hello,

I am trying to learn how to create ufuncs, and I got a ufunc to compile
correctly with the signature int -> double, but I can't get it to accept any
arguments. My function is testfunc and I used NPY_INT as the first signature
and NPY_DOUBLE as the second signature. What should I look at to figure this
out?

In [10]: testfunc.types
Out[10]: ['i->d', '?->?']

In [11]: testfunc(x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/johnsalvatier/Documents/workspace/pymc_numexprtest/src/test/<ipython
console> in <module>()

TypeError: function not supported for these types, and can't coerce safely
to supported types

In [12]: x
Out[12]: array([1, 2, 3])

In [13]: x.dtype
Out[13]: dtype('int32')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100722/eb028ca1/attachment.html>


More information about the NumPy-Discussion mailing list