cholesky_solve¶
- paddle.linalg. cholesky_solve ( x, y, upper=False, name=None ) [source]
-
Solves a linear system of equations A @ X = B, given A’s Cholesky factor matrix u and matrix B.
Input x and y is 2D matrices or batches of 2D matrices. If the inputs are batches, the outputs is also batches.
- Parameters
-
x (Tensor) – The input matrix which is upper or lower triangular Cholesky factor of square matrix A. Its shape should be [*, M, M], where * is zero or more batch dimensions. Its data type should be float32 or float64.
y (Tensor) – Multiple right-hand sides of system of equations. Its shape should be [*, M, K], where * is zero or more batch dimensions. Its data type should be float32 or float64.
upper (bool, optional) – whether to consider the Cholesky factor as a lower or upper triangular matrix. Default: False.
name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
The solution of the system of equations. Its data type is the same as that of x.
- Return type
-
Tensor
Examples
import paddle u = paddle.to_tensor([[1, 1, 1], [0, 2, 1], [0, 0,-1]], dtype="float64") b = paddle.to_tensor([[0], [-9], [5]], dtype="float64") out = paddle.linalg.cholesky_solve(b, u, upper=True) print(out) # [-2.5, -7, 9.5]