SVD/Matrix decomposition over Z instead of R

I was looking at compression related applications of SVD and wanted to compare my intuition with how SVD would compress this image:

Since there are only 3 independent columns/rows, we can get an easy factorization as (I noticed I inverted the black and white here, apologies): So I was expecting to get something very similar when doing SVD, but it ends up beings totally different. Keeping only the first 3 principal components (the other singular values aren't 0, but are of the order $10^{-16}$ so I'm guessing its only because of numerical algorithms used in octave. For completion, here is the octave/matlab code:

c1 = ones(25,1);
c2 = [ones(5,1); zeros(15,1); ones(5,1)];
c3 = [ones(5,1); zeros(3,1); ones(9,1); zeros(3,1); ones(5,1)];
M = [repmat(c1,1,2) repmat(c2,1,3) repmat(c3,1,5) repmat(c2,1,3) repmat(c1,1,2)]
[U S V] = svd(M)

Since my initial concern was compression, I noticed that my factorization is clearly superior, since we only need to store integers, which requires much less space than storing real numbers. So my question is, are there such things as matrix factorization over Z (or other rings, or even other algebraic structures)?

Also, why are the columns found by SVD not just a multiple of mine?

• You seem to be interested in the Smith normal form. – J. M. is a poor mathematician May 17 '17 at 21:10
• Left and right singular vectors are always orthogonal; that's part of the point of SVD. And the columns / rows you wrote down don't have this property. – Qiaochu Yuan May 17 '17 at 23:13