Linked by snydeq on Mon 25th Oct 2010 21:23 UTC
General Development InfoWorld's Peter Wayner reports on once niche programming languages gaining mind share among enterprise developers for their unique abilities to provide solutions to increasingly common problems. From Python to R to Erlang, each is being increasingly viewed as an essential tool for prototyping on the Web, hacking big data sets, providing quick predictive modeling, powering NoSQL experiments, and unlocking the massive parallelism of today's GPUs.
Permalink for comment 447252
To read all comments associated with this story, please click here.
RE[2]: Surprised about matlab
by jwwf on Tue 26th Oct 2010 22:03 UTC in reply to "RE: Surprised about matlab"
jwwf
Member since:
2006-01-19

Try doing something like this in python. I guarantee it will take more than 4 lines.

A = rand(5); % Create a random 5x5 matrix.
B = A * A.'; % Multiply by its transpose.
C = sum(B, 2); % Sum rows.
D = (A * diag(C)).^2 % Multiply each column by the row sum, then square each element.


from numpy import *
from numpy.random import *

a = random_integers(1,10,(5,5))
b = dot(a, a.transpose())
c = b.sum(axis=0)
d = square(dot(a, diag(c)))

OK, so 4 lines, plus 2 imports. ;)

Note to prospective hecklers - I learned numpy 15 minutes ago and haven't thought about linear algebra in years. I am sure there is a better way to do this.

Reply Parent Score: 3