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,.,.) =
#> -2.2650 0.3377 1.0263
#> -0.0248 -0.7966 -0.6092
#> 0.2150 0.5544 -0.3186
#>
#> (2,.,.) =
#> 1.5374 1.1791 0.0941
#> 0.3408 1.0291 -1.0677
#> -0.3490 0.9983 0.2494
#> [ CPUFloatType{2,3,3} ]
#>
#> [[2]]
#> torch_tensor
#> 3 2 3
#> 3 2 3
#> [ CPUIntType{2,3} ]
#>