I am trying to use cython to work on and output (numpy) array. I have read this post which explains how to do it using cpython array. For example:
from cpython.array import array, clone
def int[:] foo1d(int m):
cdef int[:] mv;
cdef array template = array('i', [])
mv = clone(template, m, True)
return mv
However I am wondering how to do this for multidimensional typed memoryview. For example, I can do this with numpy:
import numpy as np
cimport numpy as np
cdef int[:,:] foo2d(int m, int n):
cdef int[:,:] mv;
mv = np.zeros((m, n), dtype=int)
return mv
But I couldn't find how to do this with cpython.array. I appreciate any help and suggestions.