7 Aug 17:47
[Cython] about to buffer syntax
From: Lisandro Dalcin <dalcinl@...>
Subject: [Cython] about to buffer syntax
Newsgroups: gmane.comp.python.cython.devel
Date: 2008-08-07 15:49:41 GMT
Subject: [Cython] about to buffer syntax
Newsgroups: gmane.comp.python.cython.devel
Date: 2008-08-07 15:49:41 GMT
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?(Continue reading)
RSS Feed