MCPcopy Index your code
hub / github.com/numpy/numpy / ptp

Method ptp

numpy/matrixlib/defmatrix.py:765–796  ·  view source on GitHub ↗

Peak-to-peak (maximum - minimum) value along the given axis. Refer to `numpy.ptp` for full documentation. See Also -------- numpy.ptp Notes ----- Same as `ndarray.ptp`, except, where that would return an `ndarray` object, th

(self, axis=None, out=None)

Source from the content-addressed store, hash-verified

763 return N.ndarray.argmin(self, axis, out)._align(axis)
764
765 def ptp(self, axis=None, out=None):
766 """
767 Peak-to-peak (maximum - minimum) value along the given axis.
768
769 Refer to `numpy.ptp` for full documentation.
770
771 See Also
772 --------
773 numpy.ptp
774
775 Notes
776 -----
777 Same as `ndarray.ptp`, except, where that would return an `ndarray` object,
778 this returns a `matrix` object.
779
780 Examples
781 --------
782 >>> x = np.matrix(np.arange(12).reshape((3,4))); x
783 matrix([[ 0, 1, 2, 3],
784 [ 4, 5, 6, 7],
785 [ 8, 9, 10, 11]])
786 >>> x.ptp()
787 11
788 >>> x.ptp(0)
789 matrix([[8, 8, 8, 8]])
790 >>> x.ptp(1)
791 matrix([[3],
792 [3],
793 [3]])
794
795 """
796 return N.ptp(self, axis, out)._align(axis)
797
798 @property
799 def I(self): # noqa: E743

Callers 1

test_ptpMethod · 0.45

Calls 1

_alignMethod · 0.80

Tested by 1

test_ptpMethod · 0.36