bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / matlib / empty
function
numpy.matlib:empty
source: build-install/usr/lib/python3.14/site-packages/numpy/matlib.py :25
Signature
def empty ( shape , dtype = None , order = C ) Summary
Return a new matrix of given shape and type, without initializing entries.
Parameters
shape: int or tuple of intShape of the empty matrix.
dtype: data-type, optionalDesired output data-type.
order: {'C', 'F'}, optionalWhether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Notes
Unlike other matrix creation functions (e.g. matlib.zeros, matlib.ones), matlib.empty does not initialize the values of the matrix, and may therefore be marginally faster. However, the values stored in the newly allocated matrix are arbitrary. For reproducible behavior, be sure to set each element of the matrix before reading.
Examples
import numpy.matlib
✓np.matlib.empty((2, 2)) # filled with random data np.matlib.empty((2, 2), dtype=int)✗
See also
- matlib.ones
Return a matrix of ones.
- matlib.zeros
Return a matrix of zeros.
- numpy.empty
Equivalent array function.
Aliases
-
numpy.matlib.empty