| 1636 | } |
| 1637 | |
| 1638 | fn permute<ID: IntoDimension>(&self, axes: Option<ID>) -> PyResult<Bound<'py, PyArray<T, D>>> { |
| 1639 | let mut axes = axes.map(|axes| axes.into_dimension()); |
| 1640 | let mut axes = axes.as_mut().map(|axes| axes.to_npy_dims()); |
| 1641 | let axes = axes |
| 1642 | .as_mut() |
| 1643 | .map_or_else(ptr::null_mut, |axes| axes as *mut npyffi::PyArray_Dims); |
| 1644 | |
| 1645 | let py = self.py(); |
| 1646 | let ptr = unsafe { PY_ARRAY_API.PyArray_Transpose(py, self.as_array_ptr(), axes) }; |
| 1647 | unsafe { Bound::from_owned_ptr_or_err(py, ptr).map(|ob| ob.cast_into_unchecked()) } |
| 1648 | } |
| 1649 | |
| 1650 | fn reshape_with_order<ID: IntoDimension>( |
| 1651 | &self, |