n**f 发帖数: 121 | 1 Assume I have a n*k matrix G where n>k. And I know rank(G) = k. According to
matrix theory G'G has full-rank and its inverse can be calculated. However
when I plug in the data to a numerical software, the software actually
complained that G'G is singular. For my problem, k is between 100 ~ 1000,
and
n is between 500 and 5000.
I manually wrote a C++ Gauss Elimination algorithm to verify that G'G has
rank
of k. But I notice that the Gauss Elimination algorithm would report the
matrix as singular if I set a threshold too high (i.e., 1e-7) to detect zero
elements. My suspicion is that the matrix is "almost singular".
I have the following questions:
1. What software (for example MATLAB) would automatically detect these
nearly
singular matrices and provide robust solution to the inverse?
2. What matrix metrics can be used to measure how close a matrix is to
singularity?
Many thanks! |
t***s 发帖数: 4666 | 2 rule #1 in matrix computation, avoid calculating inverse explicitly at
all expense. use QR or SVD.
to
However
zero
【在 n**f 的大作中提到】 : Assume I have a n*k matrix G where n>k. And I know rank(G) = k. According to : matrix theory G'G has full-rank and its inverse can be calculated. However : when I plug in the data to a numerical software, the software actually : complained that G'G is singular. For my problem, k is between 100 ~ 1000, : and : n is between 500 and 5000. : I manually wrote a C++ Gauss Elimination algorithm to verify that G'G has : rank : of k. But I notice that the Gauss Elimination algorithm would report the : matrix as singular if I set a threshold too high (i.e., 1e-7) to detect zero
|
n**f 发帖数: 121 | 3 how about LU?
【在 t***s 的大作中提到】 : rule #1 in matrix computation, avoid calculating inverse explicitly at : all expense. use QR or SVD. : : to : However : zero
|
t***s 发帖数: 4666 | 4 no good.
【在 n**f 的大作中提到】 : how about LU?
|
n**f 发帖数: 121 | 5 I tried SVD and the condition number (i.e., max singular value / min
singular value) is huge ~1e14. I guess the singularity comes from the
problem formulation now...
【在 t***s 的大作中提到】 : no good.
|
s*******g 发帖数: 483 | 6 pinv() in matlab will solve the problem
it adds a diagonal identity matrix multiplied with a very small factor to
improve numerical stability
if you want to solve linear system, you can transfer it trivially to an
optimization problem and use conjugate gradient which is supposed to be
robust |
n**f 发帖数: 121 | 7 Thanks. But I do not have access to MATLAB
All svd type of stuff is copied from Numerical Recipe.
【在 s*******g 的大作中提到】 : pinv() in matlab will solve the problem : it adds a diagonal identity matrix multiplied with a very small factor to : improve numerical stability : if you want to solve linear system, you can transfer it trivially to an : optimization problem and use conjugate gradient which is supposed to be : robust
|