|
> Does Python handle matrix math as well? If you're playing around interactively, it's a bit easier to write (in Matlab) m = [1 0 0 ; 0 0 -1 ; 0 1 0]
than (in Python) m = np.array([[1, 0, 0], [0, 0, -1], [0, 1, 0]])
Also a bit longer example: m = rand(3,4)
a = [0.1 0.2 0.3]
m \ a'
versus m = np.random.rand(3,4)
a = np.array([0.1, 0.2, 0.3])
np.linalg.lstsq(m, a.T)
wtf?
google...
fine!
a = np.array([[0.1, 0.2, 0.3]])
np.linalg.lstsq(m, a.T)
But if you're developing software, you can't really easily and reliably deploy Matlab or Octave to run in the cloud in your production systems, whereas Python you can. |