Vineet Jain | 1 Oct 20:18 2010
Picon

[Cython] cython types for numpy array types

I'm trying to get my head around how to let cython know the type of
the numpy array. I've seen a few examples with:

from cimport numpy as np
p.ndarray[np.float_t, mdim=1]

while numpy's documentation has float64 float32, from the following
link. Is there a mapping between numpy types and cython numpy types?

    http://docs.scipy.org/doc/numpy/user/basics.types.html

Thanks,

Vineet
Matěj Laitl | 1 Oct 20:47 2010
Picon

Re: [Cython] cython types for numpy array types

On 1. 10. 2010 Vineet Jain wrote:
> I'm trying to get my head around how to let cython know the type of
> the numpy array. I've seen a few examples with:
> 
> from cimport numpy as np
> p.ndarray[np.float_t, mdim=1]
> 
> while numpy's documentation has float64 float32, from the following
> link. Is there a mapping between numpy types and cython numpy types?

Yes, look at numpy.pxd and ctypedefs there (distributed with cython, for me 
for example in /usr/lib/python2.6/site-packages/Cython/Includes/numpy.pxd)

	Matěj
_______________________________________________
Cython-dev mailing list
Cython-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Gmane