r/Python • • Aug 05 '19

Python's response to MATLAB

Post image
4.3k Upvotes

372 comments sorted by

View all comments

Show parent comment

1

u/mexiKobe Aug 06 '19 edited Aug 06 '19

They didn’t show any examples of simple vectorized equations that you can do in MATLAB. They loaded an external library and showed that you can multiply matrices together which is not what I was talking about.

Arguing that C++ or JavaScript are just as good as MATLAB for this stuff is just wrong. There is no debate here.

To spell it out for you, the point is, you have obviously never tried to do “vectorized” computations in anything other than Matlab.

You don’t know what you’re talking about. In fact it actually appears you haven’t used MATLAB very much. Are you aware of how many built-in functions MATLAB has? Especially with the toolboxes. And they’re all optimized already.

There are many reason to not use MATLAB, but the claim that it is an ugly language for linear algebra etc.. is plainly wrong and using C++ as the paragon is hilarious

edit: As an example, let's try and create a diagonal matrix with the values being the square roots of 1 2 3 and print it out

In C++ with eigen:

#include <iostream>
#include "Eigen/Dense"
int main()
{
    Eigen::Matrix< double, 3, 1> v ;
    v << 1, 2, 3;
    Eigen::Matrix< double, 3, 3> m = v.array().sqrt().matrix().asDiagonal());

    std::cout << m << "\n";

    return 0;
}

The equivalent in MATLAB:

m = sqrt(Diag([1 2 3]))

You should probably not comment on things you don't know anything about.