Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
e1bc4269
Commit
e1bc4269
authored
Jun 27, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved some examples to the examples directory.
parent
084a25f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
docs/examples/userguide/memoryviews/memory_layout.pyx
docs/examples/userguide/memoryviews/memory_layout.pyx
+11
-0
docs/examples/userguide/memoryviews/memory_layout_2.pyx
docs/examples/userguide/memoryviews/memory_layout_2.pyx
+6
-0
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+5
-16
No files found.
docs/examples/userguide/memoryviews/memory_layout.pyx
0 → 100644
View file @
e1bc4269
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
docs/examples/userguide/memoryviews/memory_layout_2.pyx
0 → 100644
View file @
e1bc4269
from
cython
cimport
view
# VALID
cdef
int
[::
view
.
indirect
,
::
1
,
:]
a
cdef
int
[::
view
.
indirect
,
:,
::
1
]
b
cdef
int
[::
view
.
indirect_contiguous
,
::
1
,
:]
c
docs/src/userguide/memoryviews.rst
View file @
e1bc4269
...
...
@@ -436,31 +436,20 @@ The flags are as follows:
* contiguous - contiguous and direct
* 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
# 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
.. literalinclude:: ../../examples/userguide/memoryviews/memory_layout.pyx
Only the first, last or the dimension following an indirect dimension may be
specified contiguous::
from cython cimport view
# INVALID
cdef int[::view.contiguous, ::view.indirect, :] a
cdef int[::1, ::view.indirect, :] b
# VALID
cdef int[::view.indirect, ::1, :] a
cdef int[::view.indirect, :, ::1] b
cdef int[::view.indirect_contiguous, ::1, :]
.. literalinclude:: ../../examples/userguide/memoryviews/memory_layout_2.pyx
The difference between the `contiguous` flag and the `::1` specifier is that the
former specifies contiguity for only one dimension, whereas the latter specifies
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment