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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
21118651
Commit
21118651
authored
Sep 24, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update memoryview documentation
parent
4a9efd8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+7
-15
No files found.
docs/src/userguide/memoryviews.rst
View file @
21118651
...
...
@@ -79,34 +79,26 @@ This gives a new, transposed, view on the data.
Specifying data layout
======================
Data layout can be specified using the previously seen `
::1
` slice syntax, or by using any
of the constants in `
cython.view
`.
Data layout can be specified using the previously seen `
`::1`
` slice syntax, or by using any
of the constants in `
`cython.view`
`.
The concepts are as follows: there is data access and data packing. Data access means either
direct (no pointer) or indirect (pointer).
Generic means you don't know, and want the compiler
Data packing means your data may be strided (e.g. after slicing it,
a[::2]
) or contiguous
direct (no pointer) or indirect (pointer).
Data packing means your data may be strided (e.g. after slicing it,
``a[::2]``
) or contiguous
(consecutive elements are adjacent in memory). If no specifier is given in any dimension,
the data access is assumed to be direct, and the data packing assumed to be strided.
If you don't know whether a dimension will be direct or indirect (because you
got
an object
the
n the
data access is assumed to be direct, and the data packing assumed to be strided.
If you don't know whether a dimension will be direct or indirect (because you
're getting
an object
with a buffer interface from some library perhaps), then you can specify the `generic` flag,
in which case it will be determined at runtime.
The flags are as follows:
cdef generic = Enum("<strided and direct or indirect>")
cdef strided = Enum("<strided and direct>") # default
cdef indirect = Enum("<strided and indirect>")
# Disable generic_contiguous, as it is a troublemaker
#cdef generic_contiguous = Enum("<contiguous and direct or indirect>")
cdef contiguous = Enum("<contiguous and direct>")
cdef indirect_contiguous = Enum("<contiguous and indirect>")
* generic - strided and direct or indirect
* strided - strided and direct (this is the default)
* indirect - strided and indirect
* contiguous - contiguous and direct
* indirect_contiguous - the list of pointers is contiguous
They can be used as follow
s::
and they can be used like thi
s::
from cython cimport view
...
...
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