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

Method trace

numpy/ma/core.py:5076–5088  ·  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

5074 return narray(self.filled(0), copy=False).nonzero()
5075
5076 def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):
5077 """
5078 (this docstring should be overwritten)
5079 """
5080 #!!!: implement out + test!
5081 m = self._mask
5082 if m is nomask:
5083 result = super().trace(offset=offset, axis1=axis1, axis2=axis2,
5084 out=out)
5085 return result.astype(dtype)
5086 else:
5087 D = self.diagonal(offset=offset, axis1=axis1, axis2=axis2)
5088 return D.astype(dtype).filled(0).sum(axis=-1, out=out)
5089 trace.__doc__ = ndarray.trace.__doc__
5090
5091 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
ndarray_misc.pyFile · 0.80
fromnumeric.pyFile · 0.80
test_traceMethod · 0.80
test_traceMethod · 0.80
traceFunction · 0.80

Calls 3

astypeMethod · 0.80
sumMethod · 0.45
filledMethod · 0.45

Tested by 7

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