{ } Raw JSON

bundles / numpy 2.4.4 / numpy / matrixlib / defmatrix / matrix / ptp

function

numpy.matrixlib.defmatrix:matrix.ptp

source: /numpy/matrixlib/defmatrix.py:767

Signature

def ptp(self, axis = None, out = None)

Summary

Peak-to-peak (maximum - minimum) value along the given axis.

Extended Summary

Refer to numpy.ptp for full documentation.

Notes

Same as ndarray.ptp, except, where that would return an ndarray object, this returns a matrix object.

Examples

x = np.matrix(np.arange(12).reshape((3,4))); x
✓
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
x.ptp()
✗
np.int64(11)
x.ptp(0)
x.ptp(1)
✓
matrix([[3],
        [3],
        [3]])

See also

numpy.ptp

Aliases

  • numpy.matrix.ptp