Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

torch_cholesky_solve

Cholesky_solve


Description

Cholesky_solve

Usage

torch_cholesky_solve(self, input2, upper = FALSE)

Arguments

self

(Tensor) input matrix b of size (*, m, k), where * is zero or more batch dimensions

input2

(Tensor) input matrix u of size (*, m, m), 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 u.

If upper is FALSE, u is and lower triangular and c is returned such that:

c = (u u^T)^{{-1}} b

If upper is TRUE or not provided, u is upper triangular and c is returned such that:

c = (u^T u)^{{-1}} b

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

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.