MCPcopy Index your code
hub / github.com/numpy/numpy / zeros

Function zeros

numpy/matlib.py:111–153  ·  view source on GitHub ↗

Return a matrix of given shape and type, filled with zeros. Parameters ---------- shape : int or sequence of ints Shape of the matrix dtype : data-type, optional The desired data-type for the matrix, default is float. order : {'C', 'F'}, optional Whe

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

Source from the content-addressed store, hash-verified

109 return a
110
111def zeros(shape, dtype=None, order='C'):
112 """
113 Return a matrix of given shape and type, filled with zeros.
114
115 Parameters
116 ----------
117 shape : int or sequence of ints
118 Shape of the matrix
119 dtype : data-type, optional
120 The desired data-type for the matrix, default is float.
121 order : {'C', 'F'}, optional
122 Whether to store the result in C- or Fortran-contiguous order,
123 default is 'C'.
124
125 Returns
126 -------
127 out : matrix
128 Zero matrix of given shape, dtype, and order.
129
130 See Also
131 --------
132 numpy.zeros : Equivalent array function.
133 matlib.ones : Return a matrix of ones.
134
135 Notes
136 -----
137 If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``,
138 `out` becomes a single row matrix of shape ``(1,N)``.
139
140 Examples
141 --------
142 >>> import numpy.matlib
143 >>> np.matlib.zeros((2, 3))
144 matrix([[0., 0., 0.],
145 [0., 0., 0.]])
146
147 >>> np.matlib.zeros(2)
148 matrix([[0., 0.]])
149
150 """
151 a = ndarray.__new__(matrix, shape, dtype, order=order)
152 a.fill(0)
153 return a
154
155def identity(n, dtype=None):
156 """

Callers 15

test_vectorMethod · 0.90
test_matrixMethod · 0.90
test_testOddFeaturesMethod · 0.90
test_testAverage2Method · 0.90
testZerosMethod · 0.85
zeros_likeFunction · 0.85
apply_along_axisFunction · 0.85
iscomplexFunction · 0.85
eyeFunction · 0.85
diagFunction · 0.85
diagflatFunction · 0.85
trilFunction · 0.85

Calls 1

__new__Method · 0.45

Tested by 14

test_vectorMethod · 0.72
test_matrixMethod · 0.72
test_testOddFeaturesMethod · 0.72
test_testAverage2Method · 0.72
testZerosMethod · 0.68
test_testAverage2Method · 0.68
test_isinMethod · 0.68
test_smallmaskMethod · 0.68
test_shape_argumentMethod · 0.68
test_zerosMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…