public mean(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Computes the arithmetic mean along one axis.
| Parameter | Description |
|---|---|
axis | Axis to reduce on any rank; negative axes count from the end. |
keepDims | Retain reduced dimensions with length one. |
result | Optional non-aliased destination of the exact output shape. |
where | Optional flat Boolean selection mask. |
ignoreNaN | Skip NaNs; otherwise preserve this operation's default NaN contract. |
A NDArray<Double> containing axis means.
import klyn.math a = NDArray<Int>([[1, 2], [3, 4]]) print(a.mean(0)) # [2.0, 3.0] print(a.mean(1)) # [1.5, 3.5]