SVD-based Matrix Compression Task

From GM-RKB
(Redirected from SVD-based Compression Task)
Jump to navigation Jump to search

An SVD-based Matrix Compression Task is a matrix compression task that requires the use of an SVD task.

     A = np.random.randn(9, 6) + 1.j*np.random.randn(9, 6)
     A = numpy.array([
               [2.0, 0.0, 8.0, 6.0, 0.0], 
               [1.0, 6.0, 0.0, 1.0, 7.0], 
               [5.0, 0.0, 7.0, 4.0, 0.0], 
               [7.0, 0.0, 8.0, 5.0, 0.0],
               [0.0, 10.0, 0.0, 0.0, 7.0]])
     U,sigma,Vh = numpy.linalg.svd(A, full_matrices=True)
     U.shape, Vh.shape, sigma.shape
     for i in xrange(1, 51, 5):
         dA = np.matrix(U[:, :i]) * np.diag(sigma[:i]) * np.matrix(Vh[:i, :])


References

2006