سؤال

I have a matrix M of dimensions 6x6 and it has rank 1. How can I factorize it into two matrices of dimensions 6x1 (say A) and 1x6 (say B) so that M=A*B.

هل كانت مفيدة؟

المحلول

take the largest eigen vector and multiply it by the largest eigenvalue :

 A=[1 2 3 4]'*[1 2 3 4]
 A =

     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, the result is good only up to a sign change.

EDIT: if you assume that the two vectors can be 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 the solution is even less unique. You are determining 2*n values based on only n. This is one solution among many.

For example, look at this other even simpler solution (which will assume your matrix is perfectly 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 a totally different result, but that still factorizes the matrix. If you want non-negative factorizations only to slightly reduce the space of possible results, I'd suggest you ask a new question!

نصائح أخرى

If it has rank 1, then all columns/rows are multiples of the first column/row (or indeed of any non-zero column/row). i.e.:

m = M(:,1);
M = [ a*m, b*m, c*m, d*m, e*m, f*m ];

Hopefully you can take it from there.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top