How to do rank-1 factorization in MATLAB? -
i have matrix m of dimensions 6x6 , has rank 1. how can factorize 2 matrices of dimensions 6x1 (say a) , 1x6 (say b) m=a*b.
take largest eigen vector , multiply largest eigenvalue :
a=[1 2 3 4]'*[1 2 3 4] = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 [v,e] = eigs(a,1); sqrt(e)*v ans = -1.0000 -2.0000 -3.0000 -4.0000
of course, result sign change.
edit: if assume 2 vectors can different:
a=[1 2 3 4]'*[5 6 7 8] [uu,ss,vv]=svd(a); u=uu(:,1)*ss(1,1) v=vv(:,1) assert(norm(u*v'-a)<1e-10)
now solution less unique. determining 2*n values based on n. 1 solution among many.
for example, @ other simpler solution (which assume matrix rank 1) :
aa=a(:,:)./repmat(a(1,:),[size(a,1),1]); bb=a(:,:)./repmat(a(:,1),[1,size(a,2)]); u=aa(:,1); v=bb(1,:)'*a(1); assert(norm(u*v'-a)<1e-10)
it produces totally different result, still factorizes matrix. if want non-negative factorizations reduce space of possible results, i'd suggest ask new question!
Comments
Post a Comment