18 Apr
2013
18 Apr
'13
2:07 p.m.
On Tue, Apr 16, 2013 at 5:45 AM, Juan Nunez-Iglesias <jni.soma@gmail.com> wrote:
cnp.ndarray[dtype=float, ndim=2] -> double[:, ::1]
Can you explain this syntax to me? I'd understand double[:, :], but not sure I get double[:, ::1]. Are you indicating that the array should be interpreted in C order? Would double[::1, :] indicate a Fortran-order array? And is double[:, ::1, :] invalid? Finally, can you take any array as input and reinterpret as a one-dimensional array?
Yes, the ::1 indicates the contiguous dimension, and can only be used in the first and last places. I'm not sure I understand your last question correctly, but you can do: def foo(x): cdef double[:] y = x.ravel() return y[0] Stéfan
4264
Age (days ago)
4264
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stéfan van der Walt