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
1ad72710
Commit
1ad72710
authored
May 06, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some documentation for newaxis indexing
parent
75c761cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+17
-0
No files found.
docs/src/userguide/memoryviews.rst
View file @
1ad72710
...
...
@@ -76,6 +76,22 @@ the slice can be transposed in the same way that numpy slices can be transposed:
This gives a new, transposed, view on the data.
Newaxis
-------
New axes can be introduced by indexing an array with ``None`` ::
cdef double[:] myslice = np.linspace(0, 10, num=50)
# 2D array with shape (1, 50)
myslice[None] # or
myslice[None, :]
# 2D array with shape (50, 1)
myslice[:, None]
One may mix new axis indexing with all other forms of indexing and slicing.
See also an example_.
Specifying data layout
======================
...
...
@@ -230,3 +246,4 @@ Unlike object attributes of extension classes, memoryview slices are not initial
to None.
.. _NumPy: http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#memory-layout
.. _example: http://www.scipy.org/Numpy_Example_List#newaxis
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