torch.cholesky_inverse
-
torch.cholesky_inverse(input, upper=False, *, out=None) → Tensor -
Computes the inverse of a symmetric positive-definite matrix using its Cholesky factor : returns matrix
inv. The inverse is computed using LAPACK routinesdpotriandspotri(and the corresponding MAGMA routines).If
upperisFalse, is lower triangular such that the returned tensor isIf
upperisTrueor not provided, is upper triangular such that the returned tensor is- Parameters
- Keyword Arguments
-
out (Tensor, optional) – the output tensor for
inv
Example:
>>> a = torch.randn(3, 3) >>> a = torch.mm(a, a.t()) + 1e-05 * torch.eye(3) # make symmetric positive definite >>> u = torch.cholesky(a) >>> a tensor([[ 0.9935, -0.6353, 1.5806], [ -0.6353, 0.8769, -1.7183], [ 1.5806, -1.7183, 10.6618]]) >>> torch.cholesky_inverse(u) tensor([[ 1.9314, 1.2251, -0.0889], [ 1.2251, 2.4439, 0.2122], [-0.0889, 0.2122, 0.1412]]) >>> a.inverse() tensor([[ 1.9314, 1.2251, -0.0889], [ 1.2251, 2.4439, 0.2122], [-0.0889, 0.2122, 0.1412]])
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.cholesky_inverse.html