mirror of
https://github.com/boostorg/python.git
synced 2026-01-23 17:52:17 +00:00
boost.python.numpy - added ndarray::reshape
This commit is contained in:
@@ -185,6 +185,14 @@ ndarray ndarray::squeeze() const {
|
||||
);
|
||||
}
|
||||
|
||||
ndarray ndarray::reshape(tuple const & shape) const {
|
||||
return ndarray(
|
||||
python::detail::new_reference(
|
||||
PyArray_Reshape(reinterpret_cast<PyArrayObject*>(this->ptr()), shape.ptr())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
object ndarray::scalarize() const {
|
||||
Py_INCREF(ptr());
|
||||
return object(python::detail::new_reference(PyArray_Return(reinterpret_cast<PyArrayObject*>(ptr()))));
|
||||
|
||||
Reference in New Issue
Block a user