pub fn zeros<'py, ID>(py: Python<'py>, dims: ID, is_fortran: bool) -> &'py Self
    where
        ID: IntoDimension<Dim = D>,
    {
        let dims = dims.into_dimension();
        unsafe {
            let descr = PY_ARRAY_API.PyArray_DescrFromType(T::typenum_default());
            let ptr = PY_ARRAY_API.PyArray_Zeros(
                dims.ndim_cint(),
                dims.as_dims_ptr(),
                descr,
                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://docs.scipy.org/doc/numpy/reference/c-api.array.html#c.PyArray_Zeros)
///
/// # Example
/// ```
/// # extern crate pyo3; extern crate numpy; #[macro_use] extern crate ndarray; fn main() {
/// use numpy::PyArray2;
/// let gil = pyo3::Python::acquire_gil();
/// let pyarray = PyArray2::zeros(gil.python(), [2, 2], false);
/// assert_eq!(pyarray.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<'py, ID>(py: Python<'py>, dims: ID, is_fortran: bool) -> &'py Self
    where
        ID: IntoDimension<Dim = D>,
    {
        let dims = dims.into_dimension();
        unsafe {
            let descr = PY_ARRAY_API.PyArray_DescrFromType(T::typenum_default());
            let ptr = PY_ARRAY_API.PyArray_Zeros(
                dims.ndim_cint(),
                dims.as_dims_ptr(),
                descr,
                if is_fortran { -1 } else { 0 },
            );
            Self::from_owned_ptr(py, ptr)
        }
    }
pub fn zeros < ' py , ID > ( py : Python < ' py > , dims : ID , is_fortran : bool ) -> & ' py Self where ID : IntoDimension < Dim = D > , { let dims = dims . into_dimension ( ) ; unsafe { let descr = PY_ARRAY_API . PyArray_DescrFromType ( T :: typenum_default ( ) ) ; let ptr = PY_ARRAY_API . PyArray_Zeros ( dims . ndim_cint ( ) , dims . as_dims_ptr ( ) , descr , 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<'py>
dims
ID
is_fortran
bool
py
Python<'py>
dims
ID
is_fortran
bool
example
None
extern crate pyo3; extern crate numpy; #[macro_use] extern crate ndarray; fn main() {
use numpy::PyArray2;
let gil = pyo3::Python::acquire_gil();
let pyarray = PyArray2::zeros(gil.python(), [2, 2], false);
assert_eq!(pyarray.as_array(), array![[0, 0], [0, 0]]).
use numpy :: PyArray2 ; let gil = pyo3 :: Python :: acquire_gil () ; let pyarray = PyArray2 :: zeros ( gil . python () [ 2 2 ] false ) ; assert_eq! ( pyarray . as_array () array! [[ 0 0 ] [ 0 0 ]] ) .
}
None