Skip to contents

Solve triangular systems with mlx arrays

Usage

mlx_solve_triangular(a, b, upper = FALSE)

Arguments

a

An mlx triangular matrix.

b

Right-hand side matrix or vector.

upper

Logical; if TRUE, a is upper triangular, otherwise lower.

Value

An mlx array solution.

Examples

a <- as_mlx(matrix(c(2, 1, 0, 3), 2, 2))
b <- as_mlx(matrix(c(1, 5), 2, 1))
mlx_solve_triangular(a, b, upper = FALSE)
#> mlx array [2 x 1]
#>   dtype: float32
#>   device: gpu
#>   values:
#>      [,1]
#> [1,]  0.5
#> [2,]  1.5