mxnet.np.linalg.cholesky

cholesky(a, upper=False)

Cholesky decomposition.

Notes

upper param is requested by API standardization in https://data-apis.org/array-api/latest/extensions/generated/signatures.linalg.cholesky.html instead of parameter in official NumPy operator.

Return the Cholesky decomposition, L * L.T, of the square matrix a, where L is lower-triangular and .T is the transpose operator. a must be symmetric and positive-definite. Only L is actually returned. Complex-valued input is currently not supported.

Parameters
  • a ((.., M, M) ndarray) – Symmetric, positive-definite input matrix.

  • upper (bool) – If True, the result must be the upper-triangular Cholesky factor. If False, the result must be the lower-triangular Cholesky factor. Default: False.

Returns

L – Lower-triangular Cholesky factor of a.

Return type

(.., M, M) ndarray

Raises

MXNetError – If the decomposition fails, for example, if a is not positive-definite.

Notes

Broadcasting rules apply.

The Cholesky decomposition is often used as a fast way of solving

\[A \mathbf{x} = \mathbf{b}\]

(when A is both symmetric and positive-definite).

First, we solve for \(\mathbf{y}\) in

\[L \mathbf{y} = \mathbf{b},\]

and then for \(\mathbf{x}\) in

\[L.T \mathbf{x} = \mathbf{y}.\]

Examples

>>> A = np.array([[16, 4], [4, 10]])
>>> A
array([[16.,  4.],
       [ 4., 10.]])
>>> L = np.linalg.cholesky(A)
>>> L
array([[4., 0.],
       [1., 3.]])
>>> np.dot(L, L.T)
array([[16.,  4.],
       [ 4., 10.]])