Skip to contents

Fill an mlx array with a constant value

Usage

mlx_full(dim, value, dtype = NULL, device = mlx_default_device())

Arguments

dim

Integer vector specifying the array shape/dimensions.

value

Scalar value used to fill the array. Numeric, logical, or complex.

dtype

MLX dtype ("float32", "float64", "bool", or "complex64"). If omitted, defaults to "complex64" for complex scalars, "bool" for logical scalars, and "float32" otherwise.

device

Execution target: provide "gpu", "cpu", or an mlx_stream created via mlx_new_stream(). Defaults to the current mlx_default_device().

Value

An mlx array filled with the supplied value.

See also

Examples

filled <- mlx_full(c(2, 2), 3.14)
complex_full <- mlx_full(c(2, 2), 1+2i, dtype = "complex64")