mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
3eed3b0ab97dc1b691ab3451d4dd21b238d53101
Fix a bug in the 3x3 direct eigensolver's Gram-Schmidt orthogonalization for near-degenerate eigenvalues. The code was subtracting the projection onto eivecs.col(l) (itself) instead of onto eivecs.col(k): // Before (bug): subtracts scalar multiple of self — does nothing useful eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l)) * eivecs.col(l); // After (fix): removes component along eivecs.col(k) eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l)) * eivecs.col(k); This path is taken when two of three eigenvalues are nearly equal, which is common for covariance matrices of near-planar point clouds. Also add comprehensive small fixed-size matrix benchmarks covering the operations that dominate robotics/CV inner loops: matmul, matvec, inverse, determinant, LLT, LDLT, PartialPivLU, ColPivHouseholderQR, JacobiSVD, SelfAdjointEigenSolver (iterative and direct) for sizes 2x2 through 8x9. Note: the direct 3x3 eigensolver (computeDirect) is 3x faster than the iterative solver but has 5-6 orders of magnitude worse residuals for near-degenerate eigenvalues. This is inherent to the closed-form algorithm, not a consequence of the Gram-Schmidt bug. Users should prefer compute() when accuracy matters and computeDirect() only when speed is critical and eigenvalues are well-separated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
For more information go to http://eigen.tuxfamily.org/ or https://libeigen.gitlab.io.
For pull request, bug reports, and feature requests, go to https://gitlab.com/libeigen/eigen.
Languages
C++
85.6%
Fortran
8.9%
CMake
2%
C
1.6%
Cuda
1.2%
Other
0.6%