Minor documentation clarification in numpy.rst (#1356)

This commit is contained in:
Thomas Hrabe 2018-06-24 06:41:27 -07:00 committed by Wenzel Jakob
parent baf6b99004
commit 534b756cb3

View File

@ -261,7 +261,7 @@ simply using ``vectorize``).
namespace py = pybind11; namespace py = pybind11;
py::array_t<double> add_arrays(py::array_t<double> input1, py::array_t<double> input2) { py::array_t<double> add_arrays(py::array_t<double> input1, py::array_t<double> input2) {
auto buf1 = input1.request(), buf2 = input2.request(); py::buffer_info buf1 = input1.request(), buf2 = input2.request();
if (buf1.ndim != 1 || buf2.ndim != 1) if (buf1.ndim != 1 || buf2.ndim != 1)
throw std::runtime_error("Number of dimensions must be one"); throw std::runtime_error("Number of dimensions must be one");
@ -272,7 +272,7 @@ simply using ``vectorize``).
/* No pointer is passed, so NumPy will allocate the buffer */ /* No pointer is passed, so NumPy will allocate the buffer */
auto result = py::array_t<double>(buf1.size); auto result = py::array_t<double>(buf1.size);
auto buf3 = result.request(); py::buffer_info buf3 = result.request();
double *ptr1 = (double *) buf1.ptr, double *ptr1 = (double *) buf1.ptr,
*ptr2 = (double *) buf2.ptr, *ptr2 = (double *) buf2.ptr,