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
Kirill Smelkov
cython
Commits
55850ac6
Commit
55850ac6
authored
Jul 06, 2018
by
scoder
Committed by
GitHub
Jul 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2430 from gabrieldemarmiesse/test_memoryviews_3
Added tests for "typed memoryviews" part 3
parents
f8c6df10
3befe6f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
docs/examples/userguide/memoryviews/slicing.pyx
docs/examples/userguide/memoryviews/slicing.pyx
+10
-0
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+2
-7
No files found.
docs/examples/userguide/memoryviews/slicing.pyx
0 → 100644
View file @
55850ac6
import
numpy
as
np
exporting_object
=
np
.
arange
(
0
,
15
*
10
*
20
,
dtype
=
np
.
intc
).
reshape
((
15
,
10
,
20
))
cdef
int
[:,
:,
:]
my_view
=
exporting_object
# These are all equivalent
my_view
[
10
]
my_view
[
10
,
:,
:]
my_view
[
10
,
...]
docs/src/userguide/memoryviews.rst
View file @
55850ac6
...
...
@@ -104,14 +104,9 @@ adds 1 to each item:
Indexing and slicing can be done with or without the GIL. It basically works
like NumPy. If indices are specified for every dimension you will get an element
of the base type (e.g. `int`). Otherwise, you will get a new view. An Ellipsis
means you get consecutive slices for every unspecified dimension:
:
means you get consecutive slices for every unspecified dimension:
cdef int[:, :, :] my_view = exporting_object
# These are all equivalent
my_view[10]
my_view[10, :, :]
my_view[10, ...]
.. literalinclude:: ../../examples/userguide/memoryviews/slicing.pyx
Copying
...
...
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