Posts about Fortran
I am learning Rust in my free time and having a ball. I was trying to port some numerical Fortran code to Rust (specifically gauleg.f) and encountered this. I am currently using a Vec
for a slight performance penalty, but I was wondering if there is some dark magic, possibly unsafe
, way to have such a stack-allocated dynamically sized object in Rust?
One reason why Fortan is still used to implement mathematical operations is because the language natively supports arithmetic operations on arrays.
When people ask for "operator overloading" in Java, Go or JavaScript, that's most of the time to be able to do element-wise additions/substractions/multiplications/divisions/etc. on arrays.
That's why I'm really pleased with Zig supporting "vectors" supporting the same operators as their underlying base type:
https://ziglang.org/documentation/master/#Vectors
Then, is it correct to say they provide something equivalent to Fortran's arrays? That would be another huge advantage of Zig.