src/aggregation

Search:
Group by:

Procs

proc newAggregate(arr: NDArray; axis: int; aggrType: AggrType): NDArray {.
    ...raises: [ValueError], tags: [], forbids: [].}

Aggregates along an axis (returns new array).

Reduces the array along the specified axis using the given aggregation type.

Parameters:

  • axis - Axis to aggregate along (use ALL_AXES for all)
  • aggrType - Type of aggregation (sum, mean, max, min, std)

Returns: New array with aggregated values

Example:

let arr = newArange(@[3, 4], 0.0, 12.0, 1.0)
let rowSums = arr.newAggregate(0, aggrSum)     # Sum along axis 0
let colMeans = arr.newAggregate(1, aggrMean)   # Mean along axis 1
proc scalarAggregate(arr: NDArray; aggrType: AggrType): float {....raises: [],
    tags: [], forbids: [].}

Aggregates all elements to a scalar value.

Parameters:

  • aggrType - Type of aggregation (sum, mean, max, min, std)

Returns: Scalar result of aggregation

Example:

let arr = newArange(@[3, 4], 0.0, 12.0, 1.0)
let total = arr.scalarAggregate(aggrSum)   # Sum of all elements = 66
let average = arr.scalarAggregate(aggrMean) # Mean = 5.5