maximum
Compares two arrays element by element and returns a new array where each element is the larger of the two corresponding values. Both arrays must have the same shape.
Signature
fun <T : Number, D : Dimension> MultiArray<T, D>.maximum(
other: MultiArray<T, D>
): NDArray<T, D>
Parameters
Parameter | Type | Description |
|---|---|---|
|
| Array to compare against. Same shape required. |
Returns: NDArray<T, D> — each element is max(this[i], other[i]).
Example
val a = mk.ndarray(mk[3, 1, 4])
val b = mk.ndarray(mk[1, 5, 2])
a.maximum(b) // [3, 5, 4]
Pitfalls
Complex types (
ComplexFloat,ComplexDouble) throwUnsupportedOperationException.
28 February 2026