product of two well-conditioned matrices become ill-conditioned, help!
2 次查看(过去 30 天)
显示 更早的评论
Hi all,
I found a product of two matrices is with cond = inf, while the original two matrices are with finite (small) condition numbers. One is even column-orthogonal matrix.
The situation is a bit complicated. So let me first post the code first.
X0=ini_pt(A,b);
if issparse(X0)
X0=full(X0);
end
[U, D]=eig(X0);
r=sum(diag(D)>10^(-12));
[D, order]=sort(diag(D),'descend');
U=U(:,order);
U1=U(:,1:r);
if (r<size(U,2))
U2=U(:,r+1:size(U,2));
else U2=[];
end
D=diag(D);
X0=D(1:r,1:r);
for i=1:size(A,1)
A{i}=U1'*A{i}*U1;
end
bigA=[];
for i=1:size(A,1)
bigA=[bigA;A{i}(:)'];
end
cond(bigA)
The whole point of this paragraph of codes is to construct a matrix bigA whose rows are given by vec(U1'*A{i}*U1)', where U1 is an n-by-r column-orthogonal matrix obtained by combining the eigenvectors corresponding to the r positive eigenvalues of X0. Using facts from linear algebra, the bigA can also be obtained by
D=diag(D);
X0=D(1:r,1:r);
bigA0=[];
for i=1:size(A,1)
bigA0=[bigA0;A{i}(:)'];
end
bigA=(bigA0')*(kron(U1',U1')');
bigA0 is the matrix whose rows are vec(A{i})'. The problem is that even cond(bigA0) is finite (some number close to 5) and cond(U1)=1,
cond(bigA)=inf,
no matter which of the above two methods I use. This contrasts to the theory that condition number should be sub-multiplicative. I don't know which part goes wrong. I'm not sure if it's a bug, so I'm posting it as a question but not to the bug report forum.
Remark:
One thing I found strange is that, in my situation, n=20, r=18, the matrix U1 is with 18 orthogonal columns. But I found that
svd(U1)= [1 ..... 1]^T , <--- 18 ones.
However,
svds(U1)= [1 .... 1 0]^T , <--- 17 ones with the final being zero.
Please let me know if you need the data cell A and vector b.
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!