I'm still convinced that Fortran 90 array declarators could provide a more powerfull syntax for buffers, For this, the dimensions should be specified with a tuple, examples below:
cdef ndarray[int, ()] a # a scalar cdef ndarray[int, (3,)] # a1D array with 3 items cdef ndarray[int, (:,)] # a 1D array of any size cdef ndarray[int (2,3)] # 2D array with 2 rows and 3 columns cdef ndarray[int (:,3)] # 2D array with any number of rows and 3 columns cdef ndarray[int (:,:)] # 2D array with any number of rows and columns cdef ndarray[float, (3,3,:)] # 3D array, a 'sequence' of 3x3 array We could even use Ellipsis '...' in a similar sense numpy uses them cdef ndarray[int, (...)] # any number of dimension cdef ndarray[int, (:, ...)] # at least 1D cdef ndarray[int, (:, : ,...)] # at least 3D cdef ndarray[int, (3, 5, ...)] # at least 2D, but required shape in first two dims. What do you think? -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
