MCPcopy Create free account
hub / github.com/numpy/numpy / empty

Function empty

numpy/matlib.py:24–60  ·  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

22__all__ += ['rand', 'randn', 'repmat']
23
24def empty(shape, dtype=None, order='C'):
25 """Return a new matrix of given shape and type, without initializing entries.
26
27 Parameters
28 ----------
29 shape : int or tuple of int
30 Shape of the empty matrix.
31 dtype : data-type, optional
32 Desired output data-type.
33 order : {'C', 'F'}, optional
34 Whether to store multi-dimensional data in row-major
35 (C-style) or column-major (Fortran-style) order in
36 memory.
37
38 See Also
39 --------
40 empty_like, zeros
41
42 Notes
43 -----
44 `empty`, unlike `zeros`, does not set the matrix values to zero,
45 and may therefore be marginally faster. On the other hand, it requires
46 the user to manually set all the values in the array, and should be
47 used with caution.
48
49 Examples
50 --------
51 >>> import numpy.matlib
52 >>> np.matlib.empty((2, 2)) # filled with random data
53 matrix([[ 6.76425276e-320, 9.79033856e-307], # random
54 [ 7.39337286e-309, 3.22135945e-309]])
55 >>> np.matlib.empty((2, 2), dtype=int)
56 matrix([[ 6600475, 0], # random
57 [ 6586976, 22740995]])
58
59 """
60 return ndarray.__new__(matrix, shape, dtype, order=order)
61
62def ones(shape, dtype=None, order='C'):
63 """

Callers 1

identityFunction · 0.70

Calls 1

__new__Method · 0.45

Tested by

no test coverage detected