def reduce(self, target, axis=None):
target = narray(target, copy=False, subok=True)<EOL>m = getmask(target)<EOL>if axis is not None:<EOL><INDENT>kargs = { '<STR_LIT>' : axis }<EOL><DEDENT>else:<EOL><INDENT>kargs = {}<EOL>target = target.ravel()<EOL>if not (m is nomask):<EOL><INDENT>m = m.ravel()<EOL><DEDENT><DEDENT>if m is nomask:<EOL><INDENT>t = self.ufunc.reduce(target, **kargs)<EOL><DEDENT>else:<EOL><INDENT>target = target.filled(self.fill_value_func(target)).view(type(target))<EOL>t = self.ufunc.reduce(target, **kargs)<EOL>m = umath.logical_and.reduce(m, **kargs)<EOL>if hasattr(t, '<STR_LIT>'):<EOL><INDENT>t._mask = m<EOL><DEDENT>elif m:<EOL><INDENT>t = masked<EOL><DEDENT><DEDENT>return t<EOL>
Reduce target along the given axis.