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

Method max

numpy/matrixlib/defmatrix.py:612–645  ·  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

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

Callers 1

test_maxMethod · 0.45

Calls 1

_collapseMethod · 0.80

Tested by 1

test_maxMethod · 0.36