{ } Raw JSON

bundles / scipy 1.18.0 / scipy / linalg / _decomp_cholesky / cholesky

function

scipy.linalg._decomp_cholesky:cholesky

source: /scipy/linalg/_decomp_cholesky.py:58

Signature

def cholesky(a, lower = False, overwrite_a = False, check_finite = True)

Summary

Compute the Cholesky decomposition of a matrix.

Extended Summary

Returns the Cholesky decomposition, or of a Hermitian positive-definite matrix A.

Parameters

a : (..., M, M) array_like

Matrix to be decomposed

lower : bool, optional

Whether to compute the upper- or lower-triangular Cholesky factorization. During decomposition, only the selected half of the matrix is referenced. Default is upper-triangular.

overwrite_a : bool, optional

Whether to overwrite data in a (may improve performance). Default is False. See tutorial_linalg_overwrite for details.

check_finite : bool, optional

Whether to check that the entire input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns

c : (..., M, M) ndarray

Upper- or lower-triangular Cholesky factor of a.

Raises

LinAlgError : if decomposition fails.

Notes

During the finiteness check (if selected), the entire matrix a is checked. During decomposition, a is assumed to be symmetric or Hermitian (as applicable), and only the half selected by option lower is referenced. Consequently, if a is asymmetric/non-Hermitian, cholesky may still succeed if the symmetric/Hermitian matrix represented by the selected half is positive definite, yet it may fail if an element in the other half is non-finite.

Examples

import numpy as np
from scipy.linalg import cholesky
a = np.array([[1,-2j],[2j,5]])
L = cholesky(a, lower=True)
✓
L
L @ L.T.conj()
✗
array([[1.+0.j, 0.-2.j],
       [0.+2.j, 5.+0.j]])

See also

cho_factor

Compute the Cholesky decomposition without explicitly setting the other triangle to 0.

Aliases

  • scipy.linalg.cholesky