What's the truncation error in SVD?

조회 수: 8 (최근 30일)
Xiaohan Du
Xiaohan Du 2017년 8월 30일
편집: Christine Tobler 2017년 8월 30일
Hi all,
I'm trying to prove one thing: perform SVD on matrix a, the truncation error of singular values equals to truncation error of products of singular vectors. Here is the code:
clear; clc;
% PART 1.
% define the matrix a.
a = magic(8);
% define number of singular values left after truncation.
n = 2;
[u, s, v] = svd(a, 0);
% sum all singular values.
ds = diag(s);
dss = sum(ds);
% sum first n singular values
dssn = sum(ds(1:n));
% work out the error after truncation.
dsp = 1 - dssn / dss;
% PART 2
% multiply left singular vectors with singular values
u = u * s;
% select the first n singular vectors, i.e. to truncate
us = u(:, 1:n);
vs = v(:, 1:n);
% reconstruct the solution
ur = us * vs';
% work out the error
up = norm(ur - a, 'fro') / norm(a, 'fro');
I expect dsp = up, but dsp = 0.0431, up = 0.0613, why?

답변 (1개)

Christine Tobler
Christine Tobler 2017년 8월 30일
편집: Christine Tobler 2017년 8월 30일
Use dsp = norm(ds(n+1:end)) / norm(ds) instead of the sum.
This is because in norm(U*S*V', 'fro'), you can move U and V outside of the norm since they are orthogonal, leaving you with norm(S, 'fro'), and since S is diagonal, this is equal to norm(diag(S)).

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by