Question: How well-suited is using Rust for complicated mathematics?

133 points dlo_xyz

Hey everyone,

Let me give a bit of context for my question, then actually ask the question.

I work algorithm development in the area of navigation, guidance, and control for safety-critical systems. Day to day, I do my algorithm development and mathematical prototyping in MATLAB. It's a great tool for testing out and visualizing ideas, but not so good for actual deployment of algorithms on real hardware.

Due to my new job, I can't live in MATLAB fantasy land all day anymore. Instead, I then typically take the algorithms I develop in MATLAB and re-write them in C or C++. My C and C++ are very rusty, no pun intended, and so I find myself learning all sorts of new facets about computer science I never considered in my electrical engineering degree. Given that all my algorithms live on safety-critical systems, there are so many pitfalls that can occur with C and C++ that I began looking for an alternative.

So naturally, I found Rust! I've been working through the Rust book from No Starch Press and so far I love the language. I sincerely appreciate the strict rules from the compiler and the need to explicitly think through the memory ownership and other principles that are pitfalls in C and C++. As someone without a CS degree, it's been great to learn about these issues without chasing a whole new degree.

​

So here is the actual question:

How well suited is the Rust programming to language for complicated mathematics? By complicated mathematics, I'm referring to concepts such as:

  • Linear Algebra Operations
  • Noise Estimation and Sensor Characterization
  • Sensor Fusion via Kalman Filtering

​

If anyone has experience using Rust for applications like this and is willing to share about their experience, I'd greatly appreciate to hear about it!