pub fn zeros<ID>(py: Python, dims: ID, is_fortran: bool) -> &Self
    where
        ID: IntoDimension<Dim = D>,
    {
        let dims = dims.into_dimension();
        unsafe {
            let dtype = T::get_dtype(py);
            let ptr = PY_ARRAY_API.PyArray_Zeros(
                dims.ndim_cint(),
                dims.as_dims_ptr(),
                dtype.into_ptr() as _,
                if is_fortran { -1 } else { 0 },
            );
            Self::from_owned_ptr(py, ptr)
        }
    }
/// Construct a new nd-dimensional array filled with 0.
///
/// If `is_fortran` is true, then
/// a fortran order array is created, otherwise a C-order array is created.
///
/// See also [PyArray_Zeros](https://numpy.org/doc/stable/reference/c-api/array.html#c.PyArray_Zeros)
///
/// # Example
/// ```
/// # #[macro_use] extern crate ndarray;
/// use numpy::PyArray2;
/// pyo3::Python::with_gil(|py| {
///     let pyarray: &PyArray2<usize> = PyArray2::zeros(py, [2, 2], false);
///     assert_eq!(pyarray.readonly().as_array(), array![[0, 0], [0, 0]]);
/// });
/// ```
Construct a new nd-dimensional array filled with 0.
If `is_fortran` is true, then
a fortran order array is created, otherwise a C-order array is created.


Construct a new nd - dimensional array filled with 0 . If ` is_fortran ` is true then a fortran order array is created otherwise a C - order array is created .
pub fn zeros<ID>(py: Python, dims: ID, is_fortran: bool) -> &Self
    where
        ID: IntoDimension<Dim = D>,
    {
        let dims = dims.into_dimension();
        unsafe {
            let dtype = T::get_dtype(py);
            let ptr = PY_ARRAY_API.PyArray_Zeros(
                dims.ndim_cint(),
                dims.as_dims_ptr(),
                dtype.into_ptr() as _,
                if is_fortran { -1 } else { 0 },
            );
            Self::from_owned_ptr(py, ptr)
        }
    }
pub fn zeros < ID > ( py : Python , dims : ID , is_fortran : bool ) -> & Self where ID : IntoDimension < Dim = D > , { let dims = dims . into_dimension ( ) ; unsafe { let dtype = T :: get_dtype ( py ) ; let ptr = PY_ARRAY_API . PyArray_Zeros ( dims . ndim_cint ( ) , dims . as_dims_ptr ( ) , dtype . into_ptr ( ) as _ , if is_fortran { - 1 } else { 0 } , ) ; Self :: from_owned_ptr ( py , ptr ) } }
Construct a new nd-dimensional array filled with 0.
Construct a new nd - dimensional array filled with 0 .
py
Python
dims
ID
is_fortran
bool
example
None
#[macro_use] extern crate ndarray;
None