I'm playing with the matrix example.

cdef extern from "numpy/arrayobject.h":

    ctypedef int intp

    ctypedef extern class numpy.ndarray [object PyArrayObject]:
        cdef char *data
        cdef int nd
        cdef intp *dimensions
        cdef intp *strides
        cdef int flags

def mysum(ndarray a):
    cdef double *p = <double *>a.data
    cdef int dim = a.dimensions[0]

    cdef double s=0
    for i from 0 <= i < dim:
        s += p[i]
    p[0] = 13.
    return s

/usr/lib64/python2.5/site-packages/numpy/core/include/numpy/__multiarray_api.h:948:
warning: 'int _import_array()' defined but not used

This is going to segfault.  In python module init, it must
say 'import_array();'

How do I cause this to get added to the C module init?

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to