MCPcopy
hub / github.com/numpy/numpy / max

Method max

numpy/matrixlib/defmatrix.py:617–650  ·  view source on GitHub ↗

Return the maximum value along an axis. Parameters ---------- See `amax` for complete descriptions See Also -------- amax, ndarray.max Notes ----- This is the same as `ndarray.max`, but returns a `matrix` object

(self, axis=None, out=None)

Source from the content-addressed store, hash-verified

615 return N.ndarray.all(self, axis, out, keepdims=True)._collapse(axis)
616
617 def max(self, axis=None, out=None):
618 """
619 Return the maximum value along an axis.
620
621 Parameters
622 ----------
623 See `amax` for complete descriptions
624
625 See Also
626 --------
627 amax, ndarray.max
628
629 Notes
630 -----
631 This is the same as `ndarray.max`, but returns a `matrix` object
632 where `ndarray.max` would return an ndarray.
633
634 Examples
635 --------
636 >>> x = np.matrix(np.arange(12).reshape((3,4))); x
637 matrix([[ 0, 1, 2, 3],
638 [ 4, 5, 6, 7],
639 [ 8, 9, 10, 11]])
640 >>> x.max()
641 11
642 >>> x.max(0)
643 matrix([[ 8, 9, 10, 11]])
644 >>> x.max(1)
645 matrix([[ 3],
646 [ 7],
647 [11]])
648
649 """
650 return N.ndarray.max(self, axis, out, keepdims=True)._collapse(axis)
651
652 def argmax(self, axis=None, out=None):
653 """

Callers 1

test_maxMethod · 0.45

Calls 1

_collapseMethod · 0.80

Tested by 1

test_maxMethod · 0.36