klyn.math.NDArray.binCount
method
public binCount(minLength as Long = 0l) as NDArray<ULong>
Description

Counts occurrences of each non-negative integer, retaining exact ULong counts. The source must be 1D and have an integer element type. No sorting is needed. Time O(N + max(value)), output memory O(max(value)+1).

Parameters
ParameterDescription
minLengthMinimum number of output bins, zero by default.
Returns

ULong count at each integer index; missing values have count zero.

Throws
  • ValueException for negative/non-integer input or unaddressable bin count.
Example

counts = NDArray<Int>([0, 2, 2]).binCount()