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
45a6cb0f
Commit
45a6cb0f
authored
Jun 26, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved a copy memoryview example to the examples directory.
parent
084a25f5
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 @
45a6cb0f
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 @
45a6cb0f
...
...
@@ -125,17 +125,9 @@ means you get consecutive slices for every unspecified dimension::
Copying
-------
Memory views can be copied in place:
:
Memory views can be copied in place:
cdef int[:, :, :] to_view, from_view
...
# copy the elements in from_view to to_view
to_view[...] = from_view
# or
to_view[:] = from_view
# or
to_view[:, :, :] = from_view
.. literalinclude:: ../../examples/userguide/memoryviews/copy.pyx
They can also be copied with the ``copy()`` and ``copy_fortran()`` methods; see
: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