Note that mlx's svd returns "full" SVD, with U and V' both square matrices. This is different from R's implementation.
Examples
x <- mlx_matrix(c(1, 0, 0, 2), 2, 2)
svd(x)
#> $d
#> mlx array [2]
#> dtype: float32
#> device: gpu
#> values:
#> [1] 2 1
#>
#> $u
#> mlx array [2 x 2]
#> dtype: float32
#> device: gpu
#> values:
#> [,1] [,2]
#> [1,] 0 1
#> [2,] 1 0
#>
#> $v
#> mlx array [2 x 2]
#> dtype: float32
#> device: gpu
#> values:
#> [,1] [,2]
#> [1,] 0 1
#> [2,] 1 0
#>