cholesky¶

`paddle.` `cholesky` ( x, upper=False, name=None ) [source]

Computes the Cholesky decomposition of one symmetric positive-definite matrix or batches of symmetric positive-definite matrice.

If upper is True, the decomposition has the form \(A = U^{T}U\) , and the returned matrix \(U\) is upper-triangular. Otherwise, the decomposition has the form \(A = LL^{T}\) , and the returned matrix \(L\) is lower-triangular.

Parameters
• x (Tensor) – The input tensor. Its shape should be [*, M, M], where * is zero or more batch dimensions, and matrices on the inner-most 2 dimensions all should be symmetric positive-definite. Its data type should be float32 or float64.

• upper (bool) – The flag indicating whether to return upper or lower triangular matrices. Default: False.

Returns

A Tensor with same shape and data type as x. It represents

triangular matrices generated by Cholesky decomposition.

Return type

Tensor

Examples

```import paddle
import numpy as np

a = np.random.rand(3, 3)
a_t = np.transpose(a, [1, 0])
x_data = np.matmul(a, a_t) + 1e-03