Given matrix A, is it possible to conveniently get the invertible matrices P and Q that appear in the matrix equivalence and satisfy A=P[I_r,0;0,0]Q with numpy or scipy?
Asked
Active
Viewed 115 times
3
-
Do you know to calculate the decomposition without python? If yes [link](http://docs.scipy.org/doc/scipy/reference/linalg.html) should give you the needed tools, to implement that in python. – Dschoni Oct 04 '13 at 11:49
-
And what do you mean by [I_r,0;0,0]? – Dschoni Oct 04 '13 at 11:54
-
@Dschoni It's a block matrix, which is almost an identity matrix but with only `r` 1's – Ziyuan Oct 04 '13 at 13:06
-
@Dschoni I can do it as the manual way but I wonder whether there are built-in methods. This it important for calculating all generalized matrix inverses. – Ziyuan Oct 04 '13 at 13:51
1 Answers
1
Probably you can do a singular value decomposition (SVD) and then multiply the singular values to one of the unitary matrice.
See definition of SVD at http://en.wikipedia.org/wiki/Singular_value_decomposition
basically you will get a unitary matrix, a diagonal matrix and another unitary matrix. The diagonal matrix has number of nonzero elements equal to rank(A).
In python code, it's
P, S, Q = numpy.linalg.svd(A)
for i, row in enumerate(Q):
row *= S[i]
See http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html about numpy.linalg.svd
P, Q then become exactly what you want. But keep in mind there's not a unique way of such decomposition.

Bo-Xiao Zheng
- 63
- 5