klyn.math.NDArray.median
method
public median(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Description

Exact sample median by axes; O(largest slice) reusable scratch, source unchanged.

Parameters
ParameterDescription
axisAxis selection; negative indices are accepted.
keepDimsKeep reduced dimensions with length one.
resultOptional non-aliased, shape-compatible destination reused without allocation.
ignoreNaNSkip NaNs; otherwise propagate them.
whereOptional flat Boolean mask, one entry per source element.
Returns

Reduced Double tensor.

Throws
  • ValueException for invalid parameters or no selected observations.
  • IndexException for an invalid axis.
Example

middle = data.median(axis=1)