QR分解為矩形矩陣,其中n > m為scipy/numpy。

[英]QR decomposition for rectangular matrices in which n > m in scipy/numpy


I have a m x n rectangular matrix A for which n > m. Given the rank r <= m of A, the reduced QR decomposition yields matrix Q with m x r dimensions, and R with r x n dimensions. The columns of Q are an orthonormal basis for the range of A. R will be upper triangular but in a staircase pattern. Columns in R with a pivot correspond to independent columns in A.

我有一個m×n的矩形矩陣a,其中n > m,給出了秩r <= m的a,減少的QR分解產生了m x r維的矩陣Q, r和r x n維數。Q的列是一個標准正交基,對a的范圍是上三角形,但在階梯模式。R中的列向量與a中的獨立列對應。

When I apply qr function from numpy.linalg (there is also a version of this function in scipy.linalg, which seems to be the same), it returns matrix Q with m x m dimensions, and R with m x n dimensions, even when the rank of matrix A is less than m. This seems to be the "full" QR decomposition, for which the columns of Q are an orthonormal basis for Re^m. Is it possible to identify the independent columns of A through this R matrix returned by function qr in numpy.linalg;scipy.linalg?

當我從numpy中應用qr函數時。linalg(在scipy中也有這個函數的版本)。linalg似乎是相同的),它返回與m x m維矩陣Q,R m x n維度,即使矩陣的秩小於m。這似乎是“完整”的QR分解,列的Q是一個標准正交基的再保險^ m。是否可以通過在numpy.linalg, scipy.linalg的函數qr返回的R矩陣來識別A的獨立列?

1 个解决方案

#1


0  

Check for diagonal elements of R that are non-zero:

檢查非零的R的對角元素:

import numpy as np
min_tol = 1e-9
A = np.array([[1,2,3],[4,3,2],[1,1,1]])
print("Matrix rank of: {}".format(np.linalg.matrix_rank(A)))
Q,R = np.linalg.qr(A)
indep = np.where(np.abs(R.diagonal()) >  min_tol)[0]
print(A[:, indep])
print("Independent columns are: {}".format(indep))

see also here: How to find degenerate rows/columns in a covariance matrix

參見這里:如何在協方差矩陣中找到退化的行/列。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/08/24/7210266a1dda2f1210e3b88553d37e62.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com