linalg.cholesky
Description
Return the Cholesky decomposition, L * L.H, of the square matrix a, where L is lower-triangular, and .H is the conjugate-transpose operator (which is a regular transposed operator if a is real-valued). a must be Hermitian (symmetric if real-valued) and positive-definite. No checking is performed to verify whether a is Hermitian or not. In addition, only the lower-triangular and diagonal elements of a are used. Only L is actually returned.
Mandatory Input Parameters
Parameter |
Type |
Description |
|---|---|---|
a |
(…,M,M) array_like |
Hermitian (symmetric if all elements are real), positive-definite input matrix |
Optional Input Parameters
None
Return Value
Type |
Description |
|---|---|
(…, M, M) array_like |
Lower-triangular Cholesky factor of a. A matrix object is returned if a is a matrix object. |
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | >>> import numpy as np >>> A = np.array([[1,-2j], [2j,5]]) >>> A array([[ 1.+0.j, -0.-2.j], [ 0.+2.j, 5.+0.j]]) >>> L = np.linalg.cholesky(A) >>> L array([[1.+0.j, 0.+0.j], [0.+2.j, 1.+0.j]]) >>> >>> np.allclose(A, np.dot(L, L.T.conj())) True >>> >>> A = [[1,-2j], [2j,5]] >>> L = np.linalg.cholesky(A) >>> L array([[1.+0.j, 0.+0.j], [0.+2.j, 1.+0.j]]) >>> >>> np.linalg.cholesky(np.matrix(A)) matrix([[1.+0.j, 0.+0.j], [0.+2.j, 1.+0.j]]) >>> |
Parent topic: Linear Algebra Functions