Skip to contents

Column means for mlx arrays

Usage

colMeans(x, ...)

# Default S3 method
colMeans(x, na.rm = FALSE, dims = 1, ...)

# S3 method for class 'mlx'
colMeans(x, na.rm = FALSE, dims = 1, ...)

Arguments

x

An array or mlx array.

...

Additional arguments forwarded to the corresponding base R implementation for signature compatibility.

na.rm

Logical; currently ignored for mlx arrays.

dims

Leading dimensions treated as rows/cols (see base::rowSums()).

Value

An mlx array if x is_mlx, otherwise a numeric vector.

See also

Examples

x <- mlx_matrix(1:6, 3, 2)
colMeans(x)
#> mlx array [2]
#>   dtype: float32
#>   device: gpu
#>   values:
#> [1] 2 5