MCPcopy
hub / github.com/numpy/numpy / empty

Function empty

numpy/matlib.py:25–64  ·  view source on GitHub ↗

Return a new matrix of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int Shape of the empty matrix. dtype : data-type, optional Desired output data-type. order : {'C', 'F'}, optional Whether to store mul

(shape, dtype=None, order='C')

Source from the content-addressed store, hash-verified

23__all__ += np.__all__
24
25def empty(shape, dtype=None, order='C'):
26 """Return a new matrix of given shape and type, without initializing entries.
27
28 Parameters
29 ----------
30 shape : int or tuple of int
31 Shape of the empty matrix.
32 dtype : data-type, optional
33 Desired output data-type.
34 order : {'C', 'F'}, optional
35 Whether to store multi-dimensional data in row-major
36 (C-style) or column-major (Fortran-style) order in
37 memory.
38
39 See Also
40 --------
41 numpy.empty : Equivalent array function.
42 matlib.zeros : Return a matrix of zeros.
43 matlib.ones : Return a matrix of ones.
44
45 Notes
46 -----
47 Unlike other matrix creation functions (e.g. `matlib.zeros`,
48 `matlib.ones`), `matlib.empty` does not initialize the values of the
49 matrix, and may therefore be marginally faster. However, the values
50 stored in the newly allocated matrix are arbitrary. For reproducible
51 behavior, be sure to set each element of the matrix before reading.
52
53 Examples
54 --------
55 >>> import numpy.matlib
56 >>> np.matlib.empty((2, 2)) # filled with random data
57 matrix([[ 6.76425276e-320, 9.79033856e-307], # random
58 [ 7.39337286e-309, 3.22135945e-309]])
59 >>> np.matlib.empty((2, 2), dtype=np.int_)
60 matrix([[ 6600475, 0], # random
61 [ 6586976, 22740995]])
62
63 """
64 return ndarray.__new__(matrix, shape, dtype, order=order)
65
66def ones(shape, dtype=None, order='C'):
67 """

Callers 15

identityFunction · 0.85
onesFunction · 0.85
fullFunction · 0.85
crossFunction · 0.85
indicesFunction · 0.85
deleteFunction · 0.85
insertFunction · 0.85
vanderFunction · 0.85
pinvFunction · 0.85

Calls 1

__new__Method · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…