本文簡要介紹 python 語言中 scipy.linalg.lu_solve
的用法。
用法:
scipy.linalg.lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True)#
求解方程組 a x = b,給定 a 的 LU 分解
- (lu, piv):
係數矩陣 a 的因式分解,如 lu_factor 給出。特別是 piv 是 0 索引的主元索引。
- b: 數組
右側
- trans: {0, 1, 2},可選
要解決的係統類型:
反式
係統
0
a x = b
1
a^T x = b
2
a^H x = b
- overwrite_b: 布爾型,可選
是否覆蓋b中的數據(可能會提高性能)
- check_finite: 布爾型,可選
是否檢查輸入矩陣是否僅包含有限數。禁用可能會提高性能,但如果輸入確實包含無窮大或 NaN,則可能會導致問題(崩潰、非終止)。
- x: 數組
係統解決方案
參數 ::
返回 ::
例子:
>>> 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,))) True
相關用法
- Python SciPy linalg.lu_factor用法及代碼示例
- Python SciPy linalg.lu用法及代碼示例
- Python SciPy linalg.lsqr用法及代碼示例
- Python SciPy linalg.logm用法及代碼示例
- Python SciPy linalg.ldl用法及代碼示例
- Python SciPy linalg.leslie用法及代碼示例
- Python SciPy linalg.lsmr用法及代碼示例
- Python SciPy linalg.lobpcg用法及代碼示例
- Python SciPy linalg.lgmres用法及代碼示例
- Python SciPy linalg.lstsq用法及代碼示例
- Python SciPy linalg.eigvalsh_tridiagonal用法及代碼示例
- Python SciPy linalg.cdf2rdf用法及代碼示例
- Python SciPy linalg.LaplacianNd用法及代碼示例
- Python SciPy linalg.solve_circulant用法及代碼示例
- Python SciPy linalg.polar用法及代碼示例
- Python SciPy linalg.clarkson_woodruff_transform用法及代碼示例
- Python SciPy linalg.rsf2csf用法及代碼示例
- Python SciPy linalg.hessenberg用法及代碼示例
- Python SciPy linalg.tril用法及代碼示例
- Python SciPy linalg.triu用法及代碼示例
- Python SciPy linalg.svd用法及代碼示例
- Python SciPy linalg.ishermitian用法及代碼示例
- Python SciPy linalg.invhilbert用法及代碼示例
- Python SciPy linalg.factorized用法及代碼示例
- Python SciPy linalg.SuperLU用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.linalg.lu_solve。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。