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

Method trace

numpy/ma/core.py:5148–5160  ·  view source on GitHub ↗

(this docstring should be overwritten)

(self, offset=0, axis1=0, axis2=1, dtype=None, out=None)

Source from the content-addressed store, hash-verified

5146 return np.asarray(self.filled(0)).nonzero()
5147
5148 def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):
5149 """
5150 (this docstring should be overwritten)
5151 """
5152 # !!!: implement out + test!
5153 m = self._mask
5154 if m is nomask:
5155 result = super().trace(offset=offset, axis1=axis1, axis2=axis2,
5156 out=out)
5157 return result.astype(dtype)
5158 else:
5159 D = self.diagonal(offset=offset, axis1=axis1, axis2=axis2)
5160 return D.astype(dtype).filled(0).sum(axis=-1, out=out)
5161 trace.__doc__ = ndarray.trace.__doc__
5162
5163 def dot(self, b, out=None, strict=False):

Callers 11

traceFunction · 0.80
check_einsum_sumsMethod · 0.80
test_traceMethod · 0.80
test_trace_subclassMethod · 0.80
test_traceMethod · 0.80
test_traceFunction · 0.80
ndarray_misc.pyFile · 0.80
fromnumeric.pyFile · 0.80
test_traceMethod · 0.80
test_traceMethod · 0.80

Calls 3

astypeMethod · 0.80
sumMethod · 0.45
filledMethod · 0.45

Tested by 8

check_einsum_sumsMethod · 0.64
test_traceMethod · 0.64
test_trace_subclassMethod · 0.64
test_traceMethod · 0.64
test_traceFunction · 0.64
test_traceMethod · 0.64
test_traceMethod · 0.64