cholesky¶
-
cholesky(a)¶ Cholesky decomposition.
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.
Returns: - L : (…, M, M) ndarray
Lower-triangular Cholesky factor of a.
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.]])