# tensorplay.functional.cholesky_inverse Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.cholesky_inverse.html ```python tensorplay.functional.cholesky_inverse(L, upper=False, *, out=None) → Tensor ``` Computes the inverse of a complex Hermitian or real symmetric positive-definite matrix given its Cholesky decomposition. Let $A$ be a complex Hermitian or real symmetric positive-definite matrix, and $L$ its Cholesky decomposition such that: $$A = LL^{\text{H}}$$ where $L^{\text{H}}$ is the conjugate transpose when $L$ is complex, and the transpose when $L$ is real-valued. Computes the inverse matrix $A^{-1}$. Supports input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if $A$ is a batch of matrices then the output has the same batch dimensions. Parameters: - L ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – tensor of shape (*, n, n) where * is zero or more batch dimensions consisting of lower or upper triangular Cholesky decompositions of symmetric or Hermitian positive-definite matrices. - upper ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – flag that indicates whether $L$ is lower triangular or upper triangular. Default: False Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – output tensor. Ignored if None. Default: None. Example: ``` >>> A = tensorplay.randn(3, 3) >>> A = A @ A.T + tensorplay.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix >>> L = tensorplay.linalg.cholesky(A) # Extract Cholesky decomposition >>> tensorplay.cholesky_inverse(L) 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]]) >>> A = tensorplay.randn(3, 2, 2, dtype=tensorplay.complex64) >>> A = A @ A.mH + tensorplay.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices >>> L = tensorplay.linalg.cholesky(A) >>> tensorplay.dist(tensorplay.inverse(A), tensorplay.cholesky_inverse(L)) tensor(5.6358e-7) ```