bundles / scipy 1.17.1 / scipy / linalg / _decomp_lu / lu_solve
function
scipy.linalg._decomp_lu:lu_solve
source: /scipy/linalg/_decomp_lu.py :134
Signature
def lu_solve ( lu_and_piv , b , trans = 0 , overwrite_b = False , check_finite = True ) Summary
Solve an equation system, a x = b, given the LU 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
(lu, piv)Factorization of the coefficient matrix a, as given by lu_factor. In particular piv are 0-indexed pivot indices.
b: arrayRight-hand side
trans: {0, 1, 2}, optionalType of system to solve:
===== ========= trans system ===== ========= 0 a x = b 1 a^T x = b 2 a^H x = b ===== =========
overwrite_b: bool, optionalWhether to overwrite data in b (may increase performance)
check_finite: bool, optionalWhether 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: arraySolution to the system
Examples
import numpy as np from scipy.linalg import lu_factor, lu_solve A = np.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]]) b = np.array([1, 1, 1, 1]) lu, piv = lu_factor(A) x = lu_solve((lu, piv), b) np.allclose(A @ x - b, np.zeros((4,)))✓
See also
- lu_factor
LU factorize a matrix
Aliases
-
scipy.linalg.lu_solve