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
Boxiang Sun
cython
Commits
86d0c959
Commit
86d0c959
authored
Jul 06, 2018
by
scoder
Committed by
GitHub
Jul 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2431 from gabrieldemarmiesse/test_memoryviews_4
Added tests for "typed memoryviews" part 4
parents
6a3fc36c
45a6cb0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
docs/examples/userguide/memoryviews/copy.pyx
docs/examples/userguide/memoryviews/copy.pyx
+12
-0
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+2
-10
No files found.
docs/examples/userguide/memoryviews/copy.pyx
0 → 100644
View file @
86d0c959
import
numpy
as
np
cdef
int
[:,
:,
:]
to_view
,
from_view
to_view
=
np
.
empty
((
20
,
15
,
30
),
dtype
=
np
.
intc
)
from_view
=
np
.
ones
((
20
,
15
,
30
),
dtype
=
np
.
intc
)
# copy the elements in from_view to to_view
to_view
[...]
=
from_view
# or
to_view
[:]
=
from_view
# or
to_view
[:,
:,
:]
=
from_view
docs/src/userguide/memoryviews.rst
View file @
86d0c959
...
@@ -117,17 +117,9 @@ means you get consecutive slices for every unspecified dimension::
...
@@ -117,17 +117,9 @@ means you get consecutive slices for every unspecified dimension::
Copying
Copying
-------
-------
Memory views can be copied in place:
:
Memory views can be copied in place:
cdef int[:, :, :] to_view, from_view
.. literalinclude:: ../../examples/userguide/memoryviews/copy.pyx
...
# copy the elements in from_view to to_view
to_view[...] = from_view
# or
to_view[:] = from_view
# or
to_view[:, :, :] = from_view
They can also be copied with the ``copy()`` and ``copy_fortran()`` methods; see
They can also be copied with the ``copy()`` and ``copy_fortran()`` methods; see
:ref:`view_copy_c_fortran`.
:ref:`view_copy_c_fortran`.
...
...
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