maximum

maximum(x1: array, x2: array, /) array

Computes the maximum value for each element x1_i of the input array x1 relative to the respective element x2_i of the input array x2.

Parameters:
  • x1 (array) – first input array. Should have a real-valued data type.

  • x2 (array) – second input array. Must be compatible with x1 (see Broadcasting). Should have a real-valued data type.

Returns:

out (array) – an array containing the element-wise maximum values. The returned array must have a data type determined by Type Promotion Rules.

Notes

The order of signed zeros is unspecified and thus implementation-defined. When choosing between -0 or +0 as a maximum value, specification-compliant libraries may choose to return either value.

For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-defined (see Complex Number Ordering).

Special Cases

For floating-point operands,

  • If either x1_i or x2_i is NaN, the result is NaN.

New in version 2023.12.