In my experience, a programmer saying they actually like MATLAB means they either know very little about general programming, are not primarily a programmer but an engineer or have been pidgeonholed into doing just one thing that MATLAB does okay for quite a while.
The language is ugly and some relatively normal features are horribly clunky to use (object-oriented stuff, GUI primitives, ...), antiquated syntax that reminds me of BASIC. If you used any moderately modern language, (C++, Java, JavaScript, Python, Rust, Nim, ...) or even old ones like C, Lisp, Haskell - you just cannot like it.
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.
But yeah the problem is when engineers and scientists only use it and try to write applications with it. I’ve seen some FUCKED UP code written in MATLAB being used at huge research hospitals and in national security, and “subversioned” with duplicates on Dropbox. It’s actually extremely common, which should be shocking
Not at all for numerical calculations / matrix math etc.
No, the language is grotesque for numerical calculations. It might be good at doing matrix computations, but that doesn't mean the language isn't hideous. And it isn't that good at matrix computations, either, because it's so shit at memory management, reading fucking plaintext from a file, anything having to do with the most elementary data structures, handling errors, ....
There are free alternatives to Matlab for literally anything that Matlab is good at that perform at least as good as Matlab does.
Oh for Christ's sake. Here's math.js, copied and pasted from docs:
// create an array and a matrix
const array = [[2, 0], [-1, 3]] // Array
const matrix = math.matrix([[7, 1], [-2, 3]]) // Matrix
// perform a calculation on an array and matrix
math.square(array) // Array, [[4, 0], [1, 9]]
math.square(matrix) // Matrix, [[49, 1], [4, 9]]
// perform calculations with mixed array and matrix input
math.add(array, matrix) // Matrix, [[9, 1], [-3, 6]]
math.multiply(array, matrix) // Matrix, [[14, 2], [-13, 8]]
It's even easier with C++:
#include <iostream>
#include <Eigen/Dense>
// Create a 2x2 matrix called a.
Matrix2d a;
a << 1, 2,
3, 4;
// Create a 2x2 matrix called b using an alternative but just as easy syntax.
MatrixXd b(2,2);
b << 2, 3,
1, 4;
//Their sum
a + b;
//Their difference.
a - b;
// Increment a by amount b.
a += b;
// Make some 3d vectors.
Vector3d v(1,2,3);
Vector3d w(1,0,0);
// Mother fucking scalar product.
w - 2*v;
// Vector product. BAM!
w*v;
It's almost like you've never even fucking seen vectorized calculations done in C++.
And I'm not even sure if you are using that word right. MathWorks sure as hell doesn't. You see, in the world of numerical computing, vectorization means using processor instructions (sometimes called SIMD instructions) that are designed to work on multiple data elements at the same time, whereas in the land of Matlab it means not using a for loop. Which, to be fair, is good advice in most languages, but especially in Matlab where interpreted code is apparently transcribed by a hamster before execution on an abacus.
The Eigen C++ code above automatically uses SIMD instructions. In fact, it automatically uses the most powerful SIMD instructions on the many different hardware platforms it supports.
Meanwhile, Matlab... might use SIMD instructions maybe? depending on the computation you're doing. And despite being a CAS specifically focused on linear algebra, Matlab only gained this ability in, like, 2011. I kid you not. And it only got it then because it adopted MKL. Which means, for those keeping track at home, that only those operations for which Matlab uses MKL (plus FFT, apparently) use SIMD. How... cutting edge.
You said MATLAB was an ugly language for matrix calculations and then responded with some extremely basic operations in C++ using an external library. I don’t know what point that’s supposed to be proving. 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.
I mean you claimed MATLAB was worse at managing memory than C++ which is nonsensical. C++ is slowly dying specifically because it doesn’t manage memory
and yes ‘vectorized’ in MATLAB means using vector operations instead of for loops so it is optimized better. If you really need to use SIMD you can always write a MEX function
426
u/Stereoisomer Aug 05 '19 edited Aug 05 '19
In my experience, a programmer saying they actually like MATLAB immediately attracts every python dev in a five mile radius
Edit: someone edit this meme and post here for a karma double-dip I’m too lazy