You give C++ and Javascript as examples of languages in which "vectorized" arithmetic is ugly, and when someone literally "gets back to you" with explicit examples in both languages showing how trivial it is to do those computations, you can't fathom what the point is? Here, let me quote you to make it easier to see what the point of those examples is:
"I mean saying it is uglier than C++ is kind of silly. Try doing simple vectorized calculations from MATLAB but in C++ and get back to me on that. And JavaScript? Come on man lol."
You see, the point is that, despite your claim to the contrary, doing "simple vectorized calculations" in C++ and JavaScript is trivially easy, extremely readable, and at least in the case of C++, much more performant, not to mention free. To spell it out for you, the point is, you have obviously never tried to do "vectorized" computations in anything other than Matlab. Which gives weight to the argument that the only reason you think Matlab is any good at the things you think it's good at because you are ignorant of the alternatives. I don't know whether or not that's true. Maybe you aren't. But damn, those examples really make a strong case.
No one in research uses C++ as an alternative for MATLAB for a ton of reasons, one being that you have to compile it. This should be obvious to you.
Obviously many scientists don't use C++ for their research. My reading of the anti-Matlab crowd is, that's exactly the whole complaint, that is, that scientists make really bad decisions about which software to use. In my experience, scientists are the worst at using the wrong tool for the job, which the widespread use of Matlab testifies to. They just use whatever their advisor tells them to use, because they don't know any better. So you end up with this mish-mash spaghetti code in Matlab that took some poor graduate student 9 months to code when they could have learned how to do it in Python from scratch in a week with a simple "import sklearn" or whatever. Hey, I don't know you, so I don't know if that's you or not, but I mean, your comments aren't painting a picture of a scientist whose very well-informed with respect to the available software tools in the numerical computing space. (Scientists don't use C++ because it has to be compiled?! Really?!)
Of course, tons of scientists do use C++ and Python for their research. Maybe in your field the only thing people use is Matlab, and so "if all you have is a hammer, everything looks like a nail." But if you branch out a bit, you'll find a ton of statisticians, data scientists, and ecologists using R, HPC people using C++, mathematicians using Python, Pari, and Mathematica, physicists using a lot of C/C++ and Mathematica, etc. From my point of view, scientists in other fields have the same problem of not using the right tool for the job. For example, I think R is the Matlab of ecology. Nothing against R, but it has its strengths and weaknesses, and it just shouldn't be used for everything under the sun. Sure, do your data analysis and plotting in R.
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.
1
u/Feminintendo Aug 06 '19
You give C++ and Javascript as examples of languages in which "vectorized" arithmetic is ugly, and when someone literally "gets back to you" with explicit examples in both languages showing how trivial it is to do those computations, you can't fathom what the point is? Here, let me quote you to make it easier to see what the point of those examples is:
You see, the point is that, despite your claim to the contrary, doing "simple vectorized calculations" in C++ and JavaScript is trivially easy, extremely readable, and at least in the case of C++, much more performant, not to mention free. To spell it out for you, the point is, you have obviously never tried to do "vectorized" computations in anything other than Matlab. Which gives weight to the argument that the only reason you think Matlab is any good at the things you think it's good at because you are ignorant of the alternatives. I don't know whether or not that's true. Maybe you aren't. But damn, those examples really make a strong case.
Obviously many scientists don't use C++ for their research. My reading of the anti-Matlab crowd is, that's exactly the whole complaint, that is, that scientists make really bad decisions about which software to use. In my experience, scientists are the worst at using the wrong tool for the job, which the widespread use of Matlab testifies to. They just use whatever their advisor tells them to use, because they don't know any better. So you end up with this mish-mash spaghetti code in Matlab that took some poor graduate student 9 months to code when they could have learned how to do it in Python from scratch in a week with a simple "import sklearn" or whatever. Hey, I don't know you, so I don't know if that's you or not, but I mean, your comments aren't painting a picture of a scientist whose very well-informed with respect to the available software tools in the numerical computing space. (Scientists don't use C++ because it has to be compiled?! Really?!)
Of course, tons of scientists do use C++ and Python for their research. Maybe in your field the only thing people use is Matlab, and so "if all you have is a hammer, everything looks like a nail." But if you branch out a bit, you'll find a ton of statisticians, data scientists, and ecologists using R, HPC people using C++, mathematicians using Python, Pari, and Mathematica, physicists using a lot of C/C++ and Mathematica, etc. From my point of view, scientists in other fields have the same problem of not using the right tool for the job. For example, I think R is the Matlab of ecology. Nothing against R, but it has its strengths and weaknesses, and it just shouldn't be used for everything under the sun. Sure, do your data analysis and plotting in R.