Cholesky decomposition. Return the lower or upper Cholesky decomposition, ``L * L.H`` or ``U.H * U``, of the square matrix ``a``, where ``L`` is lower-triangular, ``U`` is upper-triangular, and ``.H`` is the conjugate transpose operator (which is the ordinary transpose if ``a``
(a, /, *, upper=False)
| 788 | |
| 789 | @array_function_dispatch(_cholesky_dispatcher) |
| 790 | def cholesky(a, /, *, upper=False): |
| 791 | """ |
| 792 | Cholesky decomposition. |
| 793 | |
| 794 | Return the lower or upper Cholesky decomposition, ``L * L.H`` or |
| 795 | ``U.H * U``, of the square matrix ``a``, where ``L`` is lower-triangular, |
| 796 | ``U`` is upper-triangular, and ``.H`` is the conjugate transpose operator |
| 797 | (which is the ordinary transpose if ``a`` is real-valued). ``a`` must be |
| 798 | Hermitian (symmetric if real-valued) and positive-definite. No checking is |
| 799 | performed to verify whether ``a`` is Hermitian or not. In addition, only |
| 800 | the lower or upper-triangular and diagonal elements of ``a`` are used. |
| 801 | Only ``L`` or ``U`` is actually returned. |
| 802 | |
| 803 | Parameters |
| 804 | ---------- |
| 805 | a : (..., M, M) array_like |
| 806 | Hermitian (symmetric if all elements are real), positive-definite |
| 807 | input matrix. |
| 808 | upper : bool |
| 809 | If ``True``, the result must be the upper-triangular Cholesky factor. |
| 810 | If ``False``, the result must be the lower-triangular Cholesky factor. |
| 811 | Default: ``False``. |
| 812 | |
| 813 | Returns |
| 814 | ------- |
| 815 | L : (..., M, M) array_like |
| 816 | Lower or upper-triangular Cholesky factor of `a`. Returns a matrix |
| 817 | object if `a` is a matrix object. |
| 818 | |
| 819 | Raises |
| 820 | ------ |
| 821 | LinAlgError |
| 822 | If the decomposition fails, for example, if `a` is not |
| 823 | positive-definite. |
| 824 | |
| 825 | See Also |
| 826 | -------- |
| 827 | scipy.linalg.cholesky : Similar function in SciPy. |
| 828 | scipy.linalg.cholesky_banded : Cholesky decompose a banded Hermitian |
| 829 | positive-definite matrix. |
| 830 | scipy.linalg.cho_factor : Cholesky decomposition of a matrix, to use in |
| 831 | `scipy.linalg.cho_solve`. |
| 832 | |
| 833 | Notes |
| 834 | ----- |
| 835 | Broadcasting rules apply, see the `numpy.linalg` documentation for |
| 836 | details. |
| 837 | |
| 838 | The Cholesky decomposition is often used as a fast way of solving |
| 839 | |
| 840 | .. math:: A \\mathbf{x} = \\mathbf{b} |
| 841 | |
| 842 | (when `A` is both Hermitian/symmetric and positive-definite). |
| 843 | |
| 844 | First, we solve for :math:`\\mathbf{y}` in |
| 845 | |
| 846 | .. math:: L \\mathbf{y} = \\mathbf{b}, |
| 847 |
nothing calls this directly
no test coverage detected
searching dependent graphs…