Skip to contents

Row means for mlx arrays

Usage

rowMeans(x, ...)

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

# S3 method for class 'mlx'
rowMeans(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)
rowMeans(x)
#> mlx array [3]
#>   dtype: float32
#>   device: cpu
#>   values:
#> [1] 2.5 3.5 4.5