Step 1) Write the function using high level abstractions Step 2) Glance over the generated assembly and make sure that it vectorized the way you wanted.
Isn't that sth you would also need to do in Fortran? IMO Julia makes this so easy with its `@code_*` macros and is one of the main reasons why I use it.
people like to complain about matlab as a programming language but if you're using it that way you're doing it wrong.
matlab (the core language) is awesome for expressing matrices and vectors and their operations as well as visualizing the results. you shouldn't be using programming language flow control (or any of the other programming language features), you should be learning how to write for loops as vector and matrix operations and learning from the excellent toolboxes.
Also the swapping of u and tmp doesn't work like that in python. Might in fortran.
Unicode support and a few other syntax niceties make translation from the blackboard to the editor nice and clean. Fortran is great but legibility and easy tooling like (reproducible) package managers are paramount in teaching
- Matlab in the first few science lab courses + first CS course.
- C++ in second CS course
- Fortran for the scientific computing course
I found Fortran worse than matlab. The error messages were difficult to parse, and it was much more difficult to do step through debugging like in matlab.
But later I learned Python, and now use it professionally to do scientific computing, and I would give anything to go back to Fortran. Or use Rust or Julia. Or if Wolfram/Mathematica if that was possible. Anything but Python.
The fundamental problem with Python is that all the math is hacked into it, unlike Julia/Matlab/Mathematica where the math takes first priority and other values are secondary.
This was the path I took, before going to Python, Go, and Rust.
Bostonian•1h ago