Mirrors mlx.core.scatter_add_axis()
while accepting 1-based R indices.
Examples
x <- mlx_matrix(1:12, nrow = 3, ncol = 4)
idx <- matrix(c(1L, 1L,
2L, 3L,
4L, 4L), nrow = 3, byrow = TRUE)
values <- matrix(c(10, 20,
30, 40,
50, 60), nrow = 3, byrow = TRUE)
mlx_scatter_add_axis(x, idx, values, axis = 2L)
#> mlx array [3 x 4]
#> dtype: float32
#> device: cpu
#> values:
#> [,1] [,2] [,3] [,4]
#> [1,] 31 4 7 10
#> [2,] 2 35 48 11
#> [3,] 3 6 9 122