Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
441e7770
Unverified
Commit
441e7770
authored
Jul 23, 2020
by
Boris Staletic
Committed by
GitHub
Jul 23, 2020
Browse files
Use new style __init__ in numpy docs (#2316)
parent
96c67636
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
docs/advanced/pycpp/numpy.rst
docs/advanced/pycpp/numpy.rst
+2
-2
No files found.
docs/advanced/pycpp/numpy.rst
View file @
441e7770
...
...
@@ -81,7 +81,7 @@ buffer objects (e.g. a NumPy matrix).
constexpr bool rowMajor = Matrix::Flags & Eigen::RowMajorBit;
py::class_<Matrix>(m, "Matrix", py::buffer_protocol())
.def("__init__", [](
Matrix &m,
py::buffer b) {
.def("__init__", [](py::buffer b) {
typedef Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic> Strides;
/* Request a buffer descriptor from Python */
...
...
@@ -101,7 +101,7 @@ buffer objects (e.g. a NumPy matrix).
auto map = Eigen::Map<Matrix, 0, Strides>(
static_cast<Scalar *>(info.ptr), info.shape[0], info.shape[1], strides);
new (&m)
Matrix(m
ap
);
return
Matrix(m);
});
For reference, the ``def_buffer()`` call for this Eigen data type should look
...
...
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