← Math simulations  ·  EE263, Stanford

Low-rank approximation: compressing a matrix with the SVD

Any matrix has an SVD A = Σ σi ui vi. Keeping only the k largest singular values gives Ak = Σi<k σi ui vi, the best rank-k approximation of A (Eckart–Young). It stores U[:, :k], σ[:k], V[:k, :]: only k(m+n) numbers instead of mn. Sweep k and watch the image rebuild from a few components; the singular-value spectrum shows why some matrices compress and noise does not.

Image

Rank k

rank k8
singular values kept8 of 96
storage (numbers)
compression
relative error ‖AAk‖/‖A
 
Original
Rank-8 approximation
Singular values σi (log scale). kept (i < k)   dropped