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
Gwenaël Samain
cython
Commits
e65460b3
Commit
e65460b3
authored
Jun 21, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid unnecessary references to NumPy in memoryview docs
parent
85fea391
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+9
-10
No files found.
docs/src/userguide/memoryviews.rst
View file @
e65460b3
...
...
@@ -171,8 +171,8 @@ As for Numpy, new axes can be introduced by indexing an array with ``None`` ::
One may mix new axis indexing with all other forms of indexing and slicing.
See also an example_.
Comparison to the old
Numpy
buffer support
====================================
======
Comparison to the old buffer support
====================================
You will probably prefer memoryviews to the older syntax because:
...
...
@@ -182,10 +182,8 @@ You will probably prefer memoryviews to the older syntax because:
For example, this is the old syntax equivalent of the ``sum3d`` function above::
cimport numpy as cnp
cpdef int old_sum3d(cnp.ndarray[cnp.int_t, ndim=3] arr):
cdef int total = 0
cpdef int old_sum3d(object[int, ndim=3] arr):
cdef int I, J, K, total = 0
I = arr.shape[0]
J = arr.shape[1]
K = arr.shape[2]
...
...
@@ -195,10 +193,11 @@ For example, this is the old syntax equivalent of the ``sum3d`` function above::
total += arr[i, j, k]
return total
Note that we can't use ``nogil`` for the ``ndarray`` version of the function as
we could for the memoryview version of ``sum3d`` above. However, even if we
don't use ``nogil`` with the memoryview, it is significantly faster. This is a
output from an IPython session after importing both versions::
Note that we can't use ``nogil`` for the buffer version of the function as we
could for the memoryview version of ``sum3d`` above, because buffer objects
are Python objects. However, even if we don't use ``nogil`` with the
memoryview, it is significantly faster. This is a output from an IPython
session after importing both versions::
In [2]: import numpy as np
...
...
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