scipy.sparse.linalg.

expm#

scipy.sparse.linalg.expm(A)[source]#

使用 Pade 近似計算矩陣指數。

參數:
A(M,M) 類陣列或稀疏陣列

要進行指數運算的 2D 陣列或矩陣(稀疏或密集)

回傳:
expA(M,M) ndarray

A 的矩陣指數

註解

這是演算法 (6.1),它是演算法 (5.1) 的簡化版本。

在 0.12.0 版本中新增。

參考文獻

[1]

Awad H. Al-Mohy and Nicholas J. Higham (2009) “A New Scaling and Squaring Algorithm for the Matrix Exponential.” SIAM Journal on Matrix Analysis and Applications. 31 (3). pp. 970-989. ISSN 1095-7162

範例

>>> from scipy.sparse import csc_array
>>> from scipy.sparse.linalg import expm
>>> A = csc_array([[1, 0, 0], [0, 2, 0], [0, 0, 3]])
>>> A.toarray()
array([[1, 0, 0],
       [0, 2, 0],
       [0, 0, 3]], dtype=int64)
>>> Aexp = expm(A)
>>> Aexp
<Compressed Sparse Column sparse array of dtype 'float64'
    with 3 stored elements and shape (3, 3)>
>>> Aexp.toarray()
array([[  2.71828183,   0.        ,   0.        ],
       [  0.        ,   7.3890561 ,   0.        ],
       [  0.        ,   0.        ,  20.08553692]])