21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

✬<br />

Theorem 5.5.7 (best low rank approximation).<br />

Let A = UΣV H be the SVD of A ∈ K m.n (→ Thm. 5.5.1). For 1 ≤ k ≤ rank(A) set U k :=<br />

[<br />

u·,1 , ...,u·,k<br />

]<br />

∈ K m,k , Vk := [ v·,1 ,...,v·,k<br />

]<br />

∈ K n,k , Σk := diag(σ 1 ,...,σ k ) ∈ K k,k .<br />

Then, for ‖·‖ = ‖·‖ F and ‖·‖ = ‖·‖ 2 , holds true<br />

∥<br />

∥A − U k Σ k Vk<br />

H ∥ ≤ ‖A − F‖ ∀F ∈ R k (m, n) .<br />

✫<br />

✩<br />

✪<br />

2 [m, n ] = size (P) ; [U, S, V] = svd (P) ; s = diag (S) ;<br />

3 k = 40; S( k +1:end , k +1:end ) = 0 ; PC = U∗S∗V ’ ;<br />

4<br />

5 figure ( ’ p o s i t i o n ’ , [ 0 0 1600 1200]) ; c o l = [ 0 : 1 / 2 1 5 : 1 ] ’ ∗ [ 1 , 1 , 1 ] ;<br />

6 subplot ( 2 , 2 , 1 ) ; image (P) ; t i t l e ( ’ o r i g i n a l image ’ ) ; colormap ( c o l ) ;<br />

7 subplot ( 2 , 2 , 2 ) ; image (PC) ; t i t l e ( ’ compressed (40 S .V . ) ’ ) ; colormap ( c o l ) ;<br />

8 subplot ( 2 , 2 , 3 ) ; image ( abs (P−PC) ) ; t i t l e ( ’ d i f f e r e n c e ’ ) ; colormap ( c o l ) ;<br />

9 subplot ( 2 , 2 , 4 ) ; cla ; semilogy ( s ) ; hold on ; plot ( k , s ( k ) , ’ ro ’ ) ;<br />

Proof. Write A k = U k Σ k Vk H . Obviously, with r = rankA,<br />

View of ETH Zurich main building<br />

Compressed image, 40 singular values used<br />

rankA k = k and ‖A − A k ‖ = ‖Σ − Σ k ‖ =<br />

{<br />

√ σk+1 , for ‖·‖ = ‖·‖ 2 ,<br />

σk+1 2 + · · · + σ2 r , for ‖·‖ = ‖·‖ F .<br />

100<br />

200<br />

100<br />

200<br />

➊ Pick B ∈ K n,n , rankB = k.<br />

dim Ker(B) = n − k ⇒ Ker(B) ∩ Span {v 1 ,...,v k+1 } ≠ {0} ,<br />

where v i , i = 1,...,n are the columns of V. For x ∈ Ker(B) ∩ Span {v 1 ,...,v k+1 }, ‖x‖ 2 = 1<br />

∥ ∥∥∥∥∥<br />

‖A − B‖ 2 k+1<br />

2 ≥ ‖(A − B)x‖2 2 = ‖Ax‖2 2 = ∑<br />

2<br />

σ j (vj H x)u k+1 ∑<br />

j<br />

= σj 2<br />

j=1 ∥<br />

(vH j x)2 ≥ σj+1 2 ,<br />

2 j=1<br />

k+1 ∑<br />

because<br />

Ôº º<br />

j<br />

j=1(v Hx)2 = 1.<br />

300<br />

400<br />

500<br />

600<br />

700<br />

800<br />

200 400 600 800 1000 1200<br />

300<br />

400<br />

500<br />

600<br />

700<br />

Ôº º<br />

800<br />

200 400 600 800 1000 1200<br />

➋<br />

Find ONB {z 1 , ...,z n−k } of Ker(B) and assemble it into a matrix Z = [z 1 ...z n−k ] ∈ K n,n−k<br />

Difference image: |original − approximated|<br />

Singular Values of ETH view (Log−Scale)<br />

10 6 k = 40 (0.08 mem)<br />

100<br />

10 5<br />

‖A − B‖ 2 n−k<br />

F ≥ ‖(A − B)Z‖2 F = ‖AZ‖2 F = ∑<br />

‖Az i ‖ 2 n−k<br />

2 = ∑<br />

i=1<br />

i=1 j=1<br />

r∑<br />

σj 2 (vH j z i) 2<br />

✷<br />

200<br />

300<br />

400<br />

10 4<br />

10 3<br />

500<br />

10 2<br />

600<br />

Note: information content of a rank-k matrix M ∈ K m,n is equivalent to k(m + n) numbers!<br />

700<br />

10 1<br />

Approximation by low-rank matrices ↔ matrix compression<br />

800<br />

200 400 600 800 1000 1200<br />

10 0<br />

0 100 200 300 400 500 600 700 800<br />

Example 5.5.6 (Image compression).<br />

However:<br />

there are better and faster ways to compress images than SVD (JPEG, Wavelets, etc.)<br />

Image composed of m×n pixels (greyscale, BMP format) ↔ matrixA ∈ R m,n , a ij ∈ {0, ...,255},<br />

see Ex. 5.3.9<br />

Ôº º<br />

1 P = double ( imread ( ’ eth .pbm ’ ) ) ;<br />

Thm. 5.5.7 ➣ best low rank approximation of image: Ã = U k Σ k V T<br />

Code 5.5.7: SVD based image compression<br />

✸<br />

Ôº¼¼ º

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!