correct stride in matrix example and test

This also matches the Eigen example for the row-major case.

This also enhances one of the tests to trigger a failure (and fixes it in the PR).  (This isn't really a flaw in pybind itself, but rather fixes wrong code in the test code and docs).
This commit is contained in:
Ansgar Burchardt
2017-09-21 23:07:48 +02:00
committed by Jason Rhinelander
parent d2757d0440
commit a22dd2d1df
3 changed files with 13 additions and 9 deletions

View File

@@ -107,7 +107,7 @@ TEST_SUBMODULE(buffers, m) {
return py::buffer_info(
m.data(), /* Pointer to buffer */
{ m.rows(), m.cols() }, /* Buffer dimensions */
{ sizeof(float) * size_t(m.rows()), /* Strides (in bytes) for each index */
{ sizeof(float) * size_t(m.cols()), /* Strides (in bytes) for each index */
sizeof(float) }
);
})