ptp(a, axis=None, out=None, keepdims=False)¶
Range of values (maximum - minimum) along an axis.
LAX-backend implementation of
Original docstring below.
The name of the function comes from the acronym for ‘peak to peak’.
ptp preserves the data type of the array. This means the return value for an input of signed integers with n bits (e.g. np.int8, np.int16, etc) is also a signed integer with n bits. In that case, peak-to-peak values greater than
2**(n-1)-1will be returned as negative values. An example with a work-around is shown below.
a (array_like) – Input values.
keepdims (bool, optional) –
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
If the default value is passed, then keepdims will not be passed through to the ptp method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.
ptp – A new array holding the result, unless out was specified, in which case a reference to out is returned.
- Return type