C++'s standard library has valarray, which is supposed to avoid aliasing effects, and is allowed to use expression templates and other tricks. Something like:
should, in theory, achieve the same kind of performance as the C version (but none of this is guaranteed, sadly). A smart implementation would actually end up calling BLAS routines, which is what libraries like Eigen do.
Which reminds me: does Rust have infrastructure that would allow something like expression templates to exist?
Which reminds me: does Rust have infrastructure that would allow something like expression templates to exist?