Commit e1bc4269 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved some examples to the examples directory.

parent 084a25f5
from cython cimport view
# direct access in both dimensions, strided in the first dimension, contiguous in the last
cdef int[:, ::view.contiguous] a
# contiguous list of pointers to contiguous lists of ints
cdef int[::view.indirect_contiguous, ::1] b
# direct or indirect in the first dimension, direct in the second dimension
# strided in both dimensions
cdef int[::view.generic, :] c
from cython cimport view
# VALID
cdef int[::view.indirect, ::1, :] a
cdef int[::view.indirect, :, ::1] b
cdef int[::view.indirect_contiguous, ::1, :] c
...@@ -436,31 +436,20 @@ The flags are as follows: ...@@ -436,31 +436,20 @@ The flags are as follows:
* contiguous - contiguous and direct * contiguous - contiguous and direct
* indirect_contiguous - the list of pointers is contiguous * indirect_contiguous - the list of pointers is contiguous
and they can be used like this:: and they can be used like this:
from cython cimport view .. literalinclude:: ../../examples/userguide/memoryviews/memory_layout.pyx
# direct access in both dimensions, strided in the first dimension, contiguous in the last
cdef int[:, ::view.contiguous] a
# contiguous list of pointers to contiguous lists of ints
cdef int[::view.indirect_contiguous, ::1] b
# direct or indirect in the first dimension, direct in the second dimension
# strided in both dimensions
cdef int[::view.generic, :] c
Only the first, last or the dimension following an indirect dimension may be Only the first, last or the dimension following an indirect dimension may be
specified contiguous:: specified contiguous::
from cython cimport view
# INVALID # INVALID
cdef int[::view.contiguous, ::view.indirect, :] a cdef int[::view.contiguous, ::view.indirect, :] a
cdef int[::1, ::view.indirect, :] b cdef int[::1, ::view.indirect, :] b
# VALID .. literalinclude:: ../../examples/userguide/memoryviews/memory_layout_2.pyx
cdef int[::view.indirect, ::1, :] a
cdef int[::view.indirect, :, ::1] b
cdef int[::view.indirect_contiguous, ::1, :]
The difference between the `contiguous` flag and the `::1` specifier is that the The difference between the `contiguous` flag and the `::1` specifier is that the
former specifies contiguity for only one dimension, whereas the latter specifies former specifies contiguity for only one dimension, whereas the latter specifies
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment