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 api_guide_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.0, 0.0], [5.0, 3.0, 0.0], [-1.0, 1.0, 2.0]]) >>> out = paddle.linalg.cholesky_inverse(x) >>> print(out) Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True, [[ 0.61728376, -0.25925916, 0.22222215], [-0.25925916, 0.13888885, -0.08333330], [ 0.22222213, -0.08333331, 0.24999997]]) >>> # upper triangular matrix >>> out = paddle.linalg.cholesky_inverse(x.T, upper=True) >>> print(out) Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True, [[ 0.61728376, -0.25925916, 0.22222215], [-0.25925916, 0.13888885, -0.08333330], [ 0.22222213, -0.08333331, 0.24999997]])
