Skip to content

Instantly share code, notes, and snippets.

@nuit
Created August 21, 2014 02:38
Show Gist options
  • Save nuit/6e9bc5cb0b29fca8c52d to your computer and use it in GitHub Desktop.
Save nuit/6e9bc5cb0b29fca8c52d to your computer and use it in GitHub Desktop.
basic matrix operations with numpy
import numpy as np
x=np.array([1,5,2])
y=np.array([7,4,1])
z=np.array([[1,2,3],
[4,5,6],
[7,8,9]])
a=x+y
m=x*y
t=z.transpose()
print a,m,'\n',t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment