Return evenly spaced values within a given interval. See [numpy.arange][numpy.arange] for the Python API and [PyArray_Arange][PyArray_Arange] for the C API. # Example ``` use numpy::{PyArray, PyArrayMethods}; use pyo3::Python; Python::attach(|py| { let pyarray = PyArray::arange(py, 2.0, 4.0, 0.5); assert_eq!(pyarray.readonly().as_slice().unwrap(), &[2.0, 2.5, 3.0, 3.5]); let pyarray = PyArray
(py: Python<'py>, start: T, stop: T, step: T)
| 694 | /// [numpy.arange]: https://numpy.org/doc/stable/reference/generated/numpy.arange.html |
| 695 | /// [PyArray_Arange]: https://numpy.org/doc/stable/reference/c-api/array.html#c.PyArray_Arange |
| 696 | pub fn arange<'py>(py: Python<'py>, start: T, stop: T, step: T) -> Bound<'py, Self> { |
| 697 | unsafe { |
| 698 | let ptr = PY_ARRAY_API.PyArray_Arange( |
| 699 | py, |
| 700 | start.as_(), |
| 701 | stop.as_(), |
| 702 | step.as_(), |
| 703 | T::get_dtype(py).num(), |
| 704 | ); |
| 705 | Bound::from_owned_ptr(py, ptr).cast_into_unchecked() |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | unsafe fn clone_elements<T: Element>(py: Python<'_>, elems: &[T], data_ptr: &mut *mut T) { |