Cholesky_solve
Source:R/gen-namespace-docs.R, R/gen-namespace-examples.R, R/gen-namespace.R
torch_cholesky_solve.RdCholesky_solve
Arguments
- self
(Tensor) input matrix
of size , where is zero or more batch dimensions- input2
(Tensor) input matrix
of size , where is zero of more batch dimensions composed of upper or lower triangular Cholesky factor- upper
(bool, optional) whether to consider the Cholesky factor as a lower or upper triangular matrix. Default:
FALSE.
cholesky_solve(input, input2, upper=False, out=NULL) -> Tensor
Solves a linear system of equations with a positive semidefinite
matrix to be inverted given its Cholesky factor matrix
If upper is FALSE, c is
returned such that:
upper is TRUE or not provided, c is returned such that:
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 definite
u = torch_cholesky(a)
a
b = torch_randn(c(3, 2))
b
torch_cholesky_solve(b, u)
torch_mm(a$inverse(), b)
}
#> torch_tensor
#> -7.6257e-05 7.2004e-02
#> 2.6285e+01 5.7017e+01
#> -2.4348e+01 -5.3802e+01
#> [ CPUFloatType{3,2} ]