How can I calculate the frobenius norm piecewise on matrix product?

11 visualizaciones (últimos 30 días)
Steffen
Steffen el 12 de Nov. de 2013
Comentada: Matt J el 12 de Nov. de 2013
I want to calculate norm(A*B - C*C,'fro')
A and B are huge but thin factor matrices (1000000 x 20 and 20 * 1000000). C (1000000 x 2000000)is a huge sparse matrix but C * C isn't sparse. A*B and C*C result in memory errors.
How can I calculate the frobeniusnorm without calculating the product explicitly? I guess I have to calculate the norm piecewise but how can I do this in matlab?
  4 comentarios
Matt J
Matt J el 12 de Nov. de 2013
Editada: Matt J el 12 de Nov. de 2013
What about C'*C? Can you compute that without memory errors?
Steffen
Steffen el 12 de Nov. de 2013
Nope, I can't compute C' * C without a memory error.

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 12 de Nov. de 2013
Editada: Matt J el 12 de Nov. de 2013
If you can compute C'*C without memory errors
FrobeniusNorm= sqrt( trace((A'*A)*(B*B')) + norm(C'*C,'fro')^2 ...
-2*trace((A'*C)*(B*C)'))
  2 comentarios
Matt J
Matt J el 12 de Nov. de 2013
Editada: Matt J el 12 de Nov. de 2013
Nope, I can't compute C' * C without a memory error.
You can still use the above expression, but in place of norm(C'*C,'fro'), you will have to do, e.g.,
Ccell=mat2tiles(C',[inf,2000]); %see link
frob=@(q) norm(q,'fro');
secondterm=frob(cellfun(@(z)frob(C*z), Ccell));
where MAT2TILES is available here.
Matt J
Matt J el 12 de Nov. de 2013
...and then do
FrobeniusNorm= sqrt( trace((A'*A)*(B*B')) + secondterm^2 ...
-2*trace((A'*C)*(B*C)'))

Iniciar sesión para comentar.

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by