MCPcopy
hub / github.com/numpy/numpy / reduce

Method reduce

numpy/ma/core.py:1109–1136  ·  view source on GitHub ↗

Reduce `target` along the given `axis`.

(self, target, axis=0, dtype=None)

Source from the content-addressed store, hash-verified

1107 return masked_result
1108
1109 def reduce(self, target, axis=0, dtype=None):
1110 """
1111 Reduce `target` along the given `axis`.
1112
1113 """
1114 tclass = get_masked_subclass(target)
1115 m = getmask(target)
1116 t = filled(target, self.filly)
1117 if t.shape == ():
1118 t = t.reshape(1)
1119 if m is not nomask:
1120 m = make_mask(m, copy=True).reshape((1,))
1121
1122 if m is nomask:
1123 tr = self.f.reduce(t, axis)
1124 mr = nomask
1125 else:
1126 tr = self.f.reduce(t, axis, dtype=dtype)
1127 mr = umath.logical_and.reduce(m, axis)
1128
1129 if not tr.shape:
1130 if mr:
1131 return masked
1132 else:
1133 return tr
1134 masked_tr = tr.view(tclass)
1135 masked_tr._mask = mr
1136 return masked_tr
1137
1138 def outer(self, a, b):
1139 """

Callers

nothing calls this directly

Calls 7

get_masked_subclassFunction · 0.85
getmaskFunction · 0.85
filledFunction · 0.85
make_maskFunction · 0.85
reshapeMethod · 0.80
reduceMethod · 0.45
viewMethod · 0.45

Tested by

no test coverage detected