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
86addd65
Commit
86addd65
authored
Aug 07, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'buffer-doc' of
git://github.com/larsmans/cython
into 0.23.x
parents
d13bbd02
be3382de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
docs/src/userguide/buffer.rst
docs/src/userguide/buffer.rst
+3
-3
No files found.
docs/src/userguide/buffer.rst
View file @
86addd65
...
...
@@ -37,7 +37,7 @@ We could implement custom ``__getitem__``, ``__setitem__``, etc. for this,
but instead we'll use the buffer protocol to expose the matrix's data to Python
so we can use NumPy to do useful work.
Implementing the buffer protocol requires adding two me
mber
s,
Implementing the buffer protocol requires adding two me
thod
s,
``__getbuffer__`` and ``__releasebuffer__``,
which Cython handles specially.
...
...
@@ -62,7 +62,7 @@ which Cython handles specially.
def __getbuffer__(self, Py_buffer *buffer, int flags):
cdef Py_ssize_t itemsize = sizeof(self.v[0])
self.shape[0] = self.v.size()
self.shape[0] = self.v.size()
/ self.ncols
self.shape[1] = self.ncols
# Stride 1 is the distance, in bytes, between two items in a row;
...
...
@@ -165,7 +165,7 @@ The ``flags`` argument to ``__getbuffer__`` comes from ``np.asarray``
that describe the kind of array that is requested.
Strictly speaking, if the flags contain ``PyBUF_ND``, ``PyBUF_SIMPLE``,
or ``PyBUF_F_CONTIGUOUS``, ``__getbuffer__`` must raise a ``BufferError``.
These macros can be ``cimport``'d from
the pseudo-package ``c
ython``.
These macros can be ``cimport``'d from
``cp
ython``.
(The matrix-in-vector structure actually conforms to ``PyBUF_ND``,
but that would prohibit ``__getbuffer__`` from filling in the strides.
...
...
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