Compute density (mlx_dnorm), cumulative distribution (mlx_pnorm),
and quantile (mlx_qnorm) functions for the normal distribution using MLX.
Usage
mlx_dnorm(x, mean = 0, sd = 1, log = FALSE)
mlx_pnorm(x, mean = 0, sd = 1)
mlx_qnorm(p, mean = 0, sd = 1)Examples
x <- as_mlx(seq(-3, 3, by = 0.5))
mlx_dnorm(x)
#> mlx array [13]
#> dtype: float32
#> values:
#> [1] 0.004431848 0.017528297 0.053990964 0.129517585 0.241970733 0.352065325
#> [7] 0.398942322 0.352065325 0.241970733 0.129517585 0.053990964 0.017528297
#> [13] 0.004431848
mlx_pnorm(x)
#> mlx array [13]
#> dtype: float32
#> values:
#> [1] 0.001349956 0.006209671 0.022750080 0.066807210 0.158655226 0.308537483
#> [7] 0.500000000 0.691462517 0.841344714 0.933192790 0.977249920 0.993790329
#> [13] 0.998650074
p <- as_mlx(c(0.025, 0.5, 0.975))
mlx_qnorm(p)
#> mlx array [3]
#> dtype: float32
#> values:
#> [1] -1.959964 0.000000 1.959964