Solves a linear system of equations with a positive semidefinite matrix to be inverted given its Cholesky factor matrix u.
If upper is FALSE, u is and lower triangular and c is returned such that:
c=(uuT)−1b
If upper is TRUE or not provided, u is upper triangular and c is returned such that:
c=(uTu)−1b
torch_cholesky_solve(b, u) can take in 2D inputs b, u or inputs that are batches of 2D matrices. If the inputs are batches, then returns batched outputs c
Examples
if(torch_is_installed()){a = torch_randn(c(3,3))a = torch_mm(a, a$t())# make symmetric positive definiteu = torch_cholesky(a)a
b = torch_randn(c(3,2))b
torch_cholesky_solve(b, u)torch_mm(a$inverse(), b)}