torch_lu_solve {torch} | R Documentation |
Lu_solve
torch_lu_solve(self, LU_data, LU_pivots)
self |
(Tensor) the RHS tensor of size |
LU_data |
(Tensor) the pivoted LU factorization of A from |
LU_pivots |
(IntTensor) the pivots of the LU factorization from |
Returns the LU solve of the linear system Ax = b
using the partially pivoted
LU factorization of A from torch_lu
.
if (torch_is_installed()) {
A = torch_randn(c(2, 3, 3))
b = torch_randn(c(2, 3, 1))
out = torch_lu(A)
x = torch_lu_solve(b, out[[1]], out[[2]])
torch_norm(torch_bmm(A, x) - b)
}