dpnp.scipy.linalg.cho_solve

dpnp.scipy.linalg.cho_solve(c_and_lower, b, overwrite_b=False, check_finite=True)[source]

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

For full documentation refer to scipy.linalg.cho_solve.

Parameters:
(c, lower)tuple, ({dpnp.ndarray, usm_ndarray}, bool)

Cholesky factorization of A (..., M, M), as given by dpnp.scipy.linalg.cho_factor.

b{(M,), (..., M, K)} {dpnp.ndarray, usm_ndarray}

Right-hand side.

overwrite_bbool, optional

Whether to overwrite data in b (may improve performance).

Default: False.

check_finitebool, 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.

Default: True.

Returns:
x{(M,), (..., M, K)} dpnp.ndarray

The solution to the system A x = b.

Warning

This function synchronizes in order to validate array elements when check_finite=True.

See also

dpnp.scipy.linalg.cho_factor()

Cholesky factorization of a matrix.

Examples

>>> import dpnp as np
>>> A = np.array([[9., 3., 1., 5.], [3., 7., 5., 1.],
...               [1., 5., 9., 2.], [5., 1., 2., 6.]])
>>> c, low = np.scipy.linalg.cho_factor(A)
>>> x = np.scipy.linalg.cho_solve((c, low), np.ones(4))
>>> x
array([-0.01749271,  0.11953353,  0.01166181,  0.1574344 ])
>>> np.allclose(A @ x, np.ones(4))
array(True)