cholesky_inverse¶
- paddle.linalg. cholesky_inverse ( x: Tensor, upper: bool = False, name: str | None = None ) Tensor [source]
-
Using the Cholesky factor U to calculate the inverse matrix of a symmetric positive definite matrix, returns the matrix inv.
If upper is False, U is lower triangular matrix:
\[inv = (UU^{T})^{-1}\]If upper is True, U is upper triangular matrix:
\[inv = (U^{T}U)^{-1}\]- Parameters
-
x (Tensor) – A tensor of lower or upper triangular Cholesky decompositions of symmetric matrix with shape [N, N]. The data type of the x should be one of
float32
,float64
.upper (bool, optional) – If upper is False, x is lower triangular matrix, or is upper triangular matrix. Default: False.
name (str|None, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.
- Returns
-
Tensor. Computes the inverse matrix.
Examples
>>> import paddle >>> # lower triangular matrix >>> x = paddle.to_tensor([[3.,.0,.0], [5.,3.,.0], [-1.,1.,2.]]) >>> out = paddle.linalg.cholesky_inverse(x) >>> print(out) Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True, [[ 0.61728382, -0.25925916, 0.22222219], [-0.25925916, 0.13888884, -0.08333331], [ 0.22222218, -0.08333331, 0.25000000]]) >>> # upper triangular matrix >>> out = paddle.linalg.cholesky_inverse(x.T, upper=True) >>> print(out) Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True, [[ 0.61728382, -0.25925916, 0.22222219], [-0.25925916, 0.13888884, -0.08333331], [ 0.22222218, -0.08333331, 0.25000000]])