This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / linalg / _decomp_cholesky / cho_solve

function

scipy.linalg._decomp_cholesky:cho_solve

source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_decomp_cholesky.py:222

Signature

def cho_solve(c_and_lower, b, overwrite_b = False, check_finite = True)

Summary

Solve the linear equations A x = b, given the Cholesky factorization of A.

Extended Summary

The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details.

Parameters

c_and_lower : tuple, (array, bool)

Cholesky factorization of an array, as given by cho_factor. The first element of the tuple is the matrix containing the Cholesky factor, and the second element is a boolean flag indicating whether the factor is in the lower or upper triangle.

b : array

Right-hand side

overwrite_b : bool, optional

Whether to overwrite data in b (may improve performance) See tutorial_linalg_overwrite for details.

check_finite : bool, optional

Whether to check that the input matrices contain 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

x : array

The solution to the system A x = b

Examples

import numpy as np
from scipy.linalg import cho_factor, cho_solve
A = np.array([[9, 3, 1, 5], [3, 7, 5, 1], [1, 5, 9, 2], [5, 1, 2, 6]])
c, low = cho_factor(A)
x = cho_solve((c, low), [1, 1, 1, 1])
np.allclose(A @ x - [1, 1, 1, 1], np.zeros(4))
✓
True

See also

cho_factor

Cholesky factorization of a matrix

Aliases

  • scipy.linalg.cho_solve