cholesky

cholesky(x: array, /, *, upper: bool = False) array

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).

Note

Whether an array library explicitly checks whether an input array is a symmetric positive-definite matrix (or a stack of matrices) is implementation-defined.

Parameters:
  • x (array) – input array having shape (..., M, M) and whose innermost two dimensions form square symmetric positive-definite matrices. Should have a floating-point data type.

  • upper (bool) – 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.

Returns:

out (array) – 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 Type Promotion Rules and must have the same shape as x.