klyn.math.NDArray.max
method
public max(axis as Int) as NDArray<T>:
Description

Returns maximum values along one axis.

Parameters
ParameterDescription
axis0 for columns, 1 for rows on 2D arrays.
Returns

A 1D array containing the maximum values.

Throws
  • IndexException if the axis does not exist.
  • ValueException if the array is empty, has unsupported dimensions or its numeric type is not ordered.
Example
import klyn.math

a = NDArray<Int>.fromList([[3, 2], [1, 4]])
print(a.max(axis=1))  # [3, 4]