|
2 | 2 | from .constants import inf
|
3 | 3 |
|
4 | 4 | def cholesky(x: array, /, *, upper: bool = False) -> array:
|
5 |
| - """ |
6 |
| - Returns the lower (upper) Cholesky decomposition x = LLᵀ (x = UᵀU) of a symmetric positive-definite matrix (or a stack of matrices) ``x``, where ``L`` is a lower-triangular matrix or a stack of matrices (``U`` is an upper-triangular matrix or a stack of matrices). |
| 5 | + r""" |
| 6 | + Returns the lower (upper) Cholesky decomposition of a complex Hermitian or real symmetric positive-definite matrix ``x``. |
7 | 7 |
|
8 |
| - .. |
9 |
| - NOTE: once complex numbers are supported, each square matrix must be Hermitian. |
| 8 | + If ``x`` is real-valued, let :math:`\mathbb{K}` be the set of real numbers $\mathbb{R}$, and, if ``x`` is complex-valued, let $\mathbb{K}$ be the set of complex numbers $\mathbb{C}$. |
| 9 | +
|
| 10 | + The lower **Cholesky decomposition** of a complex Hermitian or real symmetric positive-definite matrix :math:`x \in\ \mathbb{K}^{n \times n}` is defined as |
| 11 | +
|
| 12 | + .. math:: |
| 13 | + x = LL^{H} \qquad \text{L $\in\ \mathbb{K}^{n \times n}$} |
| 14 | +
|
| 15 | + where :math:`L` is a lower triangular matrix and :math:`L^{H}` is the conjugate transpose when :math:`L` is complex-valued and the transpose when :math:`L` is real-valued. |
| 16 | +
|
| 17 | + The upper Cholesky decomposition is defined similarly |
| 18 | +
|
| 19 | + .. math:: |
| 20 | + x = UU^{H} \qquad \text{U $\in\ \mathbb{K}^{n \times n}$} |
| 21 | +
|
| 22 | + where :math:`U` is an upper triangular matrix. |
| 23 | +
|
| 24 | + When ``x`` is a stack of matrices, the function must compute the Cholesky decomposition for each matrix in the stack. |
10 | 25 |
|
11 | 26 | .. note::
|
12 |
| - Whether an array library explicitly checks whether an input array is a symmetric positive-definite matrix (or a stack of matrices) is implementation-defined. |
| 27 | + Whether an array library explicitly checks whether an input array is Hermitian or a symmetric positive-definite matrix (or a stack of matrices) is implementation-defined. |
13 | 28 |
|
14 | 29 | Parameters
|
15 | 30 | ----------
|
16 | 31 | x: array
|
17 |
| - input array having shape ``(..., M, M)`` and whose innermost two dimensions form square symmetric positive-definite matrices. Should have a real-valued floating-point data type. |
| 32 | + input array having shape ``(..., M, M)`` and whose innermost two dimensions form square complex Hermitian or real symmetric positive-definite matrices. Should have a floating-point data type. |
18 | 33 | upper: bool
|
19 |
| - If ``True``, the result must be the upper-triangular Cholesky factor ``U``. If ``False``, the result must be the lower-triangular Cholesky factor ``L``. Default: ``False``. |
| 34 | + If ``True``, the result must be the upper-triangular Cholesky factor :math:`U`. If ``False``, the result must be the lower-triangular Cholesky factor :math:`L`. Default: ``False``. |
20 | 35 |
|
21 | 36 | Returns
|
22 | 37 | -------
|
23 | 38 | out: array
|
24 |
| - an array containing the Cholesky factors for each square matrix. If ``upper`` is ``False``, the returned array must contain lower-triangular matrices; otherwise, the returned array must contain upper-triangular matrices. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion` and must have the same shape as ``x``. |
| 39 | + an array containing the Cholesky factors for each square matrix. If ``upper`` is ``False``, the returned array must contain lower-triangular matrices; otherwise, the returned array must contain upper-triangular matrices. The returned array must have a floating-point data type determined by :ref:`type-promotion` and must have the same shape as ``x``. |
25 | 40 | """
|
26 | 41 |
|
27 | 42 | def cross(x1: array, x2: array, /, *, axis: int = -1) -> array:
|
|
0 commit comments