Bug fixes:
1. computeDirect 3x3: eigenvalues from computeRoots() are theoretically
sorted via the trigonometric formula, but floating-point rounding
(especially in float) can break the ordering. Add a 3-element sorting
network after computeRoots() to guarantee sorted output.
2. compute(): Inf input silently returns Success with garbage results,
unlike NaN which correctly returns NoConvergence. Add an isfinite()
check on the scaling factor (which is maxCoeff of the matrix) to
detect Inf/NaN early and return NoConvergence.
3. computeFromTridiagonal(): lacks the equilibration scaling that
compute() applies, causing overflow and NoConvergence for tridiagonal
matrices with large entries. Add the same scale-to-[-1,1] pattern.
New tests:
- Eigenvalue sorting verification (both iterative and direct solvers)
- Repeated/degenerate eigenvalues (all equal, multiplicity n-1, two
clusters, nearly repeated separated by O(epsilon))
- Extreme eigenvalue ranges (high condition number spanning many orders
of magnitude, near-underflow, near-overflow, mixed positive/negative,
rank-deficient with zero eigenvalue)
- computeFromTridiagonal with large and tiny values
- Diagonal matrices (eigenvalues must match sorted diagonal)
- operatorInverseSqrt accuracy (sqrtA*invSqrtA=I, invSqrtA*A*invSqrtA=I,
symmetry)
- RowMajor storage for computeDirect (2x2, 3x3, float, double) and
iterative solver (dynamic RowMajor)
- Inf input detection
- Tridiagonal structure verification (off-tridiagonal entries are zero)
- Direct solver stress tests: 3x3 (near-planar covariance, triple
eigenvalue, double eigenvalue, large off-diagonal, nearly singular)
and 2x2 (equal eigenvalues, tiny off-diagonal, huge diagonal ratio,
anti-diagonal dominant, negative entries)
- Tightened unitary tolerance from fixed 32*test_precision to
4*n*epsilon (scales with matrix size)
- Fixed typo: "expponential" -> "exponential"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This provide several advantages:
- more flexibility in designing unit tests
- unit tests can be glued to speed up compilation
- unit tests are compiled with same predefined macros, which is a requirement for zapcc
Renamed meta_{true|false} to {true|false}_type, meta_if to conditional, is_same_type to is_same, un{ref|pointer|const} to remove_{reference|pointer|const} and makeconst to add_const.
Changed boolean type 'ret' member to 'value'.
Changed 'ret' members refering to types to 'type'.
Adapted all code occurences.
* Clean a bit the Triadiagonalization making sure it the inplace
function really works inplace ;), and that only the lower
triangular part of the matrix is referenced.
* Remove the Tridiagonalization member object of SelfAdjointEigenSolver
exploiting the in place capability of HouseholdeSequence.
* Update unit test to check SelfAdjointEigenSolver only consider
the lower triangular part.
* use SelfAdjointView instead of Eigen2's SelfAdjoint flag.
* add tests and documentation.
* allow eigenvalues() for non-selfadjoint matrices.
* they no longer depend only on SelfAdjointEigenSolver, so move them to
a separate file
- Updated unit tests to check above constructor.
- In the compute() method of decompositions: Made temporary matrices/vectors class members to avoid heap allocations during compute() (when dynamic matrices are used, of course).
These changes can speed up decomposition computation time when a solver instance is used to solve multiple same-sized problems. An added benefit is that the compute() method can now be invoked in contexts were heap allocations are forbidden, such as in real-time control loops.
CAVEAT: Not all of the decompositions in the Eigenvalues module have a heap-allocation-free compute() method. A future patch may address this issue, but some required API changes need to be incorporated first.
* add a new Eigen2Support module including Cwise, Flagged, and some other deprecated stuff
* add a few cwiseXxx functions
* adapt a few modules to use cwiseXxx instead of the .cwise() prefix