Code runs faster with `DMatrix` than with `SMatrix`
sourproton opened this issue · comments
Hi. Along with @thibautflottat, I was experimenting converting a code that solves mean field equations from python to rust, using nalgebra
. Here's the source. The "translation" was a success and the code runs much faster. Great job with nalgebra
!
We have a couple 50x50 matrices upon which we do multiplications, eigenvalues and other kind of calculations to fill a 500x500 Vec<Vec<>>
.
We found out that on our machine the code that uses DMatrix
is slower than the equivalent SMatrix
version, with the same matrix dimensions. The DMatrix
code is the main
branch, and the SMatrix
version is the static
branch of the repo.
Is this expected behavior? Intuitively, we were expecting the static version to be less flexible (removing the option for the user to choose the variables of the problem, hard-coding them into const
s) but faster.
sorry wrong repo