本文簡要介紹 python 語言中 scipy.linalg.qr_multiply
的用法。
用法:
scipy.linalg.qr_multiply(a, c, mode='right', pivoting=False, conjugate=False, overwrite_a=False, overwrite_c=False)#
計算 QR 分解並將 Q 與矩陣相乘。
計算分解
A = Q R
,其中 Q 是酉/正交和 R 上三角。將 Q 與向量或矩陣 c 相乘。- a: (M, N), 數組
輸入數組
- c: array_like
要乘以
q
的輸入數組。- mode: {‘left’, ‘right’},可選
如果模式是‘left’,則返回
Q @ c
,如果模式是‘right’,則返回c @ Q
。 c 的形狀必須適合矩陣乘法,如果 mode 是 ‘left’,min(a.shape) == c.shape[0]
,如果 mode 是 ‘right’,a.shape[0] == c.shape[1]
。- pivoting: 布爾型,可選
因式分解是否應包括rank-revealing qr 分解的旋轉,請參閱 qr 的文檔。
- conjugate: 布爾型,可選
Q是否應該是complex-conjugated。這可能比顯式共軛更快。
- overwrite_a: 布爾型,可選
a 中的數據是否被覆蓋(可能會提高性能)
- overwrite_c: 布爾型,可選
c 中的數據是否被覆蓋(可能會提高性能)。如果使用它,c 必須足夠大以保持結果,即
c.shape[0]
=a.shape[0]
如果模式為 ‘left’。
- CQ: ndarray
Q
和c
的乘積。- R: (K, N), ndarray
結果 QR 分解的 R 數組,其中
K = min(M, N)
。- P: (N,) 數組
整數樞軸數組。僅在
pivoting=True
時返回。
- LinAlgError
如果 QR 分解失敗,則引發。
參數 ::
返回 ::
拋出 ::
注意:
這是 LAPACK 例程
?GEQRF
、?ORMQR
、?UNMQR
和?GEQP3
的接口。例子:
>>> import numpy as np >>> from scipy.linalg import qr_multiply, qr >>> A = np.array([[1, 3, 3], [2, 3, 2], [2, 3, 3], [1, 3, 2]]) >>> qc, r1, piv1 = qr_multiply(A, 2*np.eye(4), pivoting=1) >>> qc array([[-1., 1., -1.], [-1., -1., 1.], [-1., -1., -1.], [-1., 1., 1.]]) >>> r1 array([[-6., -3., -5. ], [ 0., -1., -1.11022302e-16], [ 0., 0., -1. ]]) >>> piv1 array([1, 0, 2], dtype=int32) >>> q2, r2, piv2 = qr(A, mode='economic', pivoting=1) >>> np.allclose(2*q2 - qc, np.zeros((4, 3))) True
相關用法
- Python SciPy linalg.qr_insert用法及代碼示例
- Python SciPy linalg.qr_update用法及代碼示例
- Python SciPy linalg.qr_delete用法及代碼示例
- Python SciPy linalg.qr用法及代碼示例
- Python SciPy linalg.qz用法及代碼示例
- Python SciPy linalg.qmr用法及代碼示例
- 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.lu_factor用法及代碼示例
- Python SciPy linalg.SuperLU用法及代碼示例
- Python SciPy linalg.lsqr用法及代碼示例
- Python SciPy linalg.cho_factor用法及代碼示例
- Python SciPy linalg.fractional_matrix_power用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.linalg.qr_multiply。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。