On this page
numpy.matlib.zeros
- matlib.zeros(shape, dtype=None, order='C')[source]
-
Return a matrix of given shape and type, filled with zeros.
- Parameters
-
- shapeint or sequence of ints
-
Shape of the matrix
- dtypedata-type, optional
-
The desired data-type for the matrix, default is float.
- order{‘C’, ‘F’}, optional
-
Whether to store the result in C- or Fortran-contiguous order, default is ‘C’.
- Returns
-
- outmatrix
-
Zero matrix of given shape, dtype, and order.
See also
-
numpy.zeros -
Equivalent array function.
-
matlib.ones -
Return a matrix of ones.
Notes
If
shapehas length one i.e.(N,), or is a scalarN,outbecomes a single row matrix of shape(1,N).Examples
>>> import numpy.matlib >>> np.matlib.zeros((2, 3)) matrix([[0., 0., 0.], [0., 0., 0.]])>>> np.matlib.zeros(2) matrix([[0., 0.]])
© 2005–2022 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.23/reference/generated/numpy.matlib.zeros.html