Compute density (mlx_dunif), cumulative distribution (mlx_punif),
and quantile (mlx_qunif) functions for the uniform distribution using MLX.
Usage
mlx_dunif(x, min = 0, max = 1, log = FALSE, device = mlx_default_device())
mlx_punif(x, min = 0, max = 1, device = mlx_default_device())
mlx_qunif(p, min = 0, max = 1, device = mlx_default_device())Arguments
- x
Vector of quantiles (mlx array or coercible to mlx)
- min, max
Lower and upper limits of the distribution (default: 0, 1)
- log
If
TRUE, return log density formlx_dunif(default:FALSE)- device
Execution target: supply
"gpu","cpu", or anmlx_streamcreated viamlx_new_stream(). Defaults to the currentmlx_default_device()unless noted otherwise (helpers that act on an existing array typically reuse that array's device or stream).- p
Vector of probabilities (mlx array or coercible to mlx)
Examples
x <- as_mlx(seq(0, 1, by = 0.1))
mlx_dunif(x)
#> mlx array [11]
#> dtype: float32
#> device: gpu
#> values:
#> [1] 1 1 1 1 1 1 1 1 1 1 1
mlx_punif(x)
#> mlx array [11]
#> dtype: float32
#> device: gpu
#> values:
#> [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
p <- as_mlx(c(0.25, 0.5, 0.75))
mlx_qunif(p)
#> mlx array [3]
#> dtype: float32
#> device: gpu
#> values:
#> [1] 0.25 0.50 0.75