Skip to main content

NDArray::mean

public static function mean(NDArray|array|float|int $a): float|int;

The arithmetic mean of the elements in the array. It computes the sum of all values and then divides it by the total number of elements in the array.

Same as calling nd::sum($a) / $a->size()


Notes

tip

GPU SUPPORTED

This operation is supported by GPU (VRAM) and contains a custom CUDA kernel.