Element-wise maximum of array elements.
Compare two arrays and returns a new array containing the element-wise maxima.
Parameters: | x1, x2 : array_like
|
---|---|
Returns: | y : {ndarray, scalar}
|
See also
Notes
Equivalent to np.where(x1 > x2, x1, x2) but faster and does proper broadcasting.
Examples
>>> np.maximum([2, 3, 4], [1, 5, 2])
array([2, 5, 4])
>>> np.maximum(np.eye(2), [0.5, 2])
array([[ 1. , 2. ],
[ 0.5, 2. ]])