Pierre Complex schrieb am 10.04.2018 um 10:25:
> The "cdef" parts in Cython are close to what you can do in C. The syntax
> cdef int table[][] translates to a C array. C does not support
> multidimensional arrays out of the box.
>
> Cython provides "typed memoryviews". Make sure to include "cimport numpy as
> np" in your code and write instead
>
> cdef int[:,:] table = np.zeros(n,m)
>
> will generate the array using NumPy
Note that a "cimport" of the "numpy" module is not needed for the above
code to work, since you only have a runtime dependency on NumPy here, not a
compile time dependency. A normal "import" is sufficient. Memoryviews are
not a NumPy feature but a general Cython/CPython feature (through the
CPython buffer protocol).
Stefan