Skip to content

Instantly share code, notes, and snippets.

@mazieres
Created March 18, 2015 08:43
Show Gist options
  • Save mazieres/6a7fb55d2e512220204b to your computer and use it in GitHub Desktop.
Save mazieres/6a7fb55d2e512220204b to your computer and use it in GitHub Desktop.
def symmetrize(a):
# http://stackoverflow.com/a/2573982/1565438
return a + a.T - numpy.diag(a.diagonal())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment