Skip to content

Instantly share code, notes, and snippets.

@andrewmusselman
Created May 22, 2013 22:17
Show Gist options
  • Save andrewmusselman/5631395 to your computer and use it in GitHub Desktop.
Save andrewmusselman/5631395 to your computer and use it in GitHub Desktop.
import numpy as np
mp = matrix([[0.00, 0.25, 0.25, 0.8],[0.75, 0.00, 0.25, 0.9],[0.25, 0.75, 0.50, 0.3]])
numpy.linalg.svd(mp)
U, s, V = np.linalg.svd(mp, full_matrices=True)
U.shape, V.shape, s.shape
S = np.zeros((3, 4), dtype=complex)
S[:3, :3] = np.diag(s)
np.allclose(mp, np.dot(U, np.dot(S, V)))
@koooee
Copy link

koooee commented May 22, 2013

hello world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment