本文簡要介紹 python 語言中 scipy.linalg.schur
的用法。
用法:
scipy.linalg.schur(a, output='real', lwork=None, overwrite_a=False, sort=None, check_finite=True)#
計算矩陣的 Schur 分解。
Schur 分解為:
A = Z T Z^H
其中 Z 是酉,T 是上三角,或者對於實數 Schur 分解(輸出=‘real’),quasi-upper 三角。在quasi-triangular形式中,說明complex-valued特征值對的2x2塊可以從對角線擠出。
- a: (M, M) 數組
矩陣分解
- output: {‘real’, ‘complex’},可選
構造實數或複數 Schur 分解(對於實矩陣)。
- lwork: 整數,可選
工作數組大小。如果 None 或 -1,它會自動計算。
- overwrite_a: 布爾型,可選
是否覆蓋 a 中的數據(可能會提高性能)。
- sort: {無,可調用,‘lhp’, ‘rhp’, ‘iuc’, ‘ouc’},可選
指定是否應該對上特征值進行排序。可以傳遞一個可調用對象,給定一個特征值,返回一個布爾值,表示特征值是否應該排序到左上角 (True)。或者,可以使用字符串參數:
'lhp' Left-hand plane (x.real < 0.0) 'rhp' Right-hand plane (x.real > 0.0) 'iuc' Inside the unit circle (x*x.conjugate() <= 1.0) 'ouc' Outside the unit circle (x*x.conjugate() > 1.0)
默認為無(無排序)。
- check_finite: 布爾型,可選
是否檢查輸入矩陣是否僅包含有限數。禁用可能會提高性能,但如果輸入確實包含無窮大或 NaN,則可能會導致問題(崩潰、非終止)。
- T: (M, M) ndarray
A 的 Schur 形式。對於實 Schur 分解來說它是實值的。
- Z: (M, M) ndarray
A 的酉 Schur 變換矩陣。對於實 Schur 分解,它是實值。
- sdim: int
當且僅當請求排序時,第三個返回值將包含滿足排序條件的特征值的數量。
- LinAlgError
在三種情況下引發錯誤:
由於 QR 算法未能計算所有特征值,該算法失敗。
如果請求了特征值排序,則特征值無法重新排序,因為無法分離特征值,通常是因為條件不佳。
如果請求了特征值排序,則舍入錯誤導致前導特征值不再滿足排序條件。
參數 ::
返回 ::
拋出 ::
例子:
>>> import numpy as np >>> from scipy.linalg import schur, eigvals >>> A = np.array([[0, 2, 2], [0, 1, 2], [1, 0, 1]]) >>> T, Z = schur(A) >>> T array([[ 2.65896708, 1.42440458, -1.92933439], [ 0. , -0.32948354, -0.49063704], [ 0. , 1.31178921, -0.32948354]]) >>> Z array([[0.72711591, -0.60156188, 0.33079564], [0.52839428, 0.79801892, 0.28976765], [0.43829436, 0.03590414, -0.89811411]])
>>> T2, Z2 = schur(A, output='complex') >>> T2 array([[ 2.65896708, -1.22839825+1.32378589j, 0.42590089+1.51937378j], [ 0. , -0.32948354+0.80225456j, -0.59877807+0.56192146j], [ 0. , 0. , -0.32948354-0.80225456j]]) >>> eigvals(T2) array([2.65896708, -0.32948354+0.80225456j, -0.32948354-0.80225456j])
任意自定義 eig-sorting 條件,具有正虛部,僅由一個特征值滿足
>>> T3, Z3, sdim = schur(A, output='complex', sort=lambda x: x.imag > 0) >>> sdim 1
相關用法
- Python SciPy linalg.solve_circulant用法及代碼示例
- Python SciPy linalg.svd用法及代碼示例
- Python SciPy linalg.spsolve用法及代碼示例
- Python SciPy linalg.spsolve_triangular用法及代碼示例
- Python SciPy linalg.solve_banded用法及代碼示例
- Python SciPy linalg.solve_discrete_lyapunov用法及代碼示例
- Python SciPy linalg.splu用法及代碼示例
- Python SciPy linalg.spilu用法及代碼示例
- Python SciPy linalg.solve用法及代碼示例
- Python SciPy linalg.svdvals用法及代碼示例
- Python SciPy linalg.solveh_banded用法及代碼示例
- Python SciPy linalg.solve_sylvester用法及代碼示例
- Python SciPy linalg.solve_toeplitz用法及代碼示例
- Python SciPy linalg.sqrtm用法及代碼示例
- Python SciPy linalg.svds用法及代碼示例
- Python SciPy linalg.sinm用法及代碼示例
- Python SciPy linalg.solve_continuous_lyapunov用法及代碼示例
- Python SciPy linalg.solve_continuous_are用法及代碼示例
- Python SciPy linalg.solve_discrete_are用法及代碼示例
- Python SciPy linalg.solve_triangular用法及代碼示例
- Python SciPy linalg.sinhm用法及代碼示例
- Python SciPy linalg.signm用法及代碼示例
- Python SciPy linalg.subspace_angles用法及代碼示例
- Python SciPy linalg.eigvalsh_tridiagonal用法及代碼示例
- Python SciPy linalg.cdf2rdf用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.linalg.schur。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。