Consider sorting eigenvalues and singular values
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Currently, there are no guarantees about ordering of eigenvalues and singular vectors returned by nalgebra's decompositions. A common convention throughout mathematical literature is to assume that eigenvalues and singular values are ordered in descending order. Many other mathematical libraries also do this. By following the same convention we would ease porting efforts from other languages into `nalgebra` code. Recently, a user had this exact issue when porting code from `numpy` (see #893).
The simplest way to achieve this is to compute a permutation of the eigenvalues/singular values and then apply the permutation also to the columns/rows of the accompanying orthogonal matrices (if computed). While this should have negligible overhead for larger matrices since the decomposition itself is `O(n^3)`, it is not clear to me if perhaps this has some non-trivial cost for small matrices. In this case, we should benchmark and perhaps consider providing means to opt **out** of this behavior if users are concerned about performance.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.