Computes the LU factorization of a matrix or batches of matrices A. Returns a tuple containing the LU factorization and pivots of A. Pivoting is done if pivot is set to True.
Arguments
- A
(Tensor) the tensor to factor of size (, m, n)(,m,n)
- pivot
(bool, optional) – controls whether pivoting is done. Default: TRUE
- get_infos
(bool, optional) – if set to True, returns an info IntTensor. Default: FALSE
- out
(tuple, optional) – optional output tuple. If get_infos is True, then the elements in the tuple are Tensor, IntTensor, and IntTensor. If get_infos is False, then the elements in the tuple are Tensor, IntTensor. Default: NULL
Examples
if (torch_is_installed()) {
A <- torch_randn(c(2, 3, 3))
torch_lu(A)
}
#> [[1]]
#> torch_tensor
#> (1,.,.) =
#> -1.4146 -0.5132 0.1140
#> -0.1377 1.8340 -0.4910
#> 0.4182 -0.2674 -0.5814
#>
#> (2,.,.) =
#> -1.8634 0.2446 -1.5018
#> -0.5823 1.2190 0.1530
#> 0.3754 0.4946 -0.1626
#> [ CPUFloatType{2,3,3} ]
#>
#> [[2]]
#> torch_tensor
#> 2 2 3
#> 2 3 3
#> [ CPUIntType{2,3} ]
#>