Commit Graph

7722 Commits

Author SHA1 Message Date
Rasmus Munk Larsen
8346cc3410 Fix three bugs in SelfAdjointEigenSolver and improve test coverage
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>
2026-04-04 18:07:55 -07:00
Rasmus Munk Larsen
3eed3b0ab9 Fix Gram-Schmidt bug in SelfAdjointEigenSolver::computeDirect and add small matrix benchmarks
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>
2026-04-04 15:24:42 -07:00
Florian Maurin
b57d860f3e Fix GCC maybe-uninitialized warning in InnerProduct
libeigen/eigen!2386

Closes #3015
2026-04-03 19:41:09 -07:00
Rasmus Munk Larsen
a3074053a6 Speed up pexp_double by ~15-17%
libeigen/eigen!2388

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-03 17:09:11 -07:00
Rasmus Munk Larsen
a91913e961 Speed up plog_float by 1.6x with improved accuracy
libeigen/eigen!2382

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-03 13:45:01 -07:00
Pavel Guzenfeld
e315a8cdd0 Inline IndexedViewMethods.inc into DenseBase.h
libeigen/eigen!2330

Closes #2766
2026-04-02 15:26:56 -07:00
Rasmus Munk Larsen
61a8662876 Improve log1p accuracy and speed with direct range reduction
libeigen/eigen!2378

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 11:29:25 -07:00
Rasmus Munk Larsen
d31a73437f Vectorize asinh and acosh for float and double
libeigen/eigen!2376

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 21:46:36 -07:00
Rasmus Munk Larsen
9513d3878e Vectorize sinh, cosh, and log10
libeigen/eigen!2368

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 20:41:18 -07:00
Rasmus Munk Larsen
64885cc6a3 Fix remaining MSVC warnings in Windows CI (C4804, C4244, C4146, C4305)
libeigen/eigen!2374

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 17:20:31 -07:00
Rasmus Munk Larsen
b54640df19 Fix NVHPC warnings in Visitor.h and Memory.h
libeigen/eigen!2370

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 15:09:37 -07:00
Rasmus Munk Larsen
7fcbed7acb Fill packet math coverage gaps across multiple architectures
libeigen/eigen!2237

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 14:52:32 -07:00
Rasmus Munk Larsen
1ade3636b9 Fix BDCSVD bidiagonal hard-case failures on ARM with GCC
libeigen/eigen!2365

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-30 20:17:37 -07:00
Rasmus Munk Larsen
801a9ee690 Fix ~1,460 MSVC warnings from generic code instantiated with bool
libeigen/eigen!2364

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 21:05:49 -07:00
Rasmus Munk Larsen
732ebc8cc2 Modernize evaluator files
libeigen/eigen!2245

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 17:40:39 -07:00
Rasmus Munk Larsen
c8633ceeea Clean up top-level Eigen headers
libeigen/eigen!2252

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 16:28:09 -07:00
Pavel Guzenfeld
753a6ac5b3 Fix private shadowing of protected base members in iterative solvers
libeigen/eigen!2357

Closes #1859
2026-03-29 15:40:48 -07:00
Rasmus Munk Larsen
9fe2f03fa4 Revert "Lower BDCSVD crossover threshold from 16 to 8"
This reverts merge request !2358
2026-03-29 15:25:09 -07:00
Rasmus Munk Larsen
12fe90db8b Lower BDCSVD crossover threshold from 16 to 8
libeigen/eigen!2358

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 14:33:22 -07:00
Pavel Guzenfeld
b7f6aed1b9 Fix dangling reference in IndexedView with expression indices
libeigen/eigen!2335

Closes #1943
2026-03-29 09:39:13 -07:00
Rasmus Munk Larsen
624ab58e8d Add bidiagonal SVD API to BDCSVD and remove dead debug code
libeigen/eigen!2238

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 20:38:31 -07:00
Rasmus Munk Larsen
0fe8cdfa3b Extract RankRevealingBase CRTP mixin to eliminate decomposition code duplication
libeigen/eigen!2272

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 19:12:23 -07:00
Rasmus Munk Larsen
f928a9f534 Fix static alignment for generic clang vector backend
libeigen/eigen!2351

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 15:50:58 -07:00
Pavel Guzenfeld
90ca5bfd9a Strip lapacke.h to only the declarations used by Eigen
libeigen/eigen!2322

Closes #2851
2026-03-27 20:16:46 -07:00
Rasmus Munk Larsen
cf508c096b Add block Householder right-side application for HouseholderSequence
libeigen/eigen!2342

Closes #3057

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-27 19:56:08 -07:00
Rasmus Munk Larsen
79d7d280a5 Fix bugs in evaluator files
libeigen/eigen!2244

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 01:25:51 +00:00
Charles Schlosser
eb4b2eeffa UBSAN: use appropriate SSE intrinsics for loading 4 and 8 bytes
libeigen/eigen!2346
2026-03-27 19:54:10 +00:00
Tyler Veness
9939a4c6e3 Fix SparseLU and SparseQR for custom scalar types
libeigen/eigen!2345
2026-03-27 00:13:11 -07:00
Rasmus Munk Larsen
002229ce47 Fix RowMajor gemm_pack_lhs for backends without half/quarter packets
libeigen/eigen!2344

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-23 23:33:42 -07:00
Rasmus Munk Larsen
843ffcec8b Fix warnings reported by NVHPC 26.1
libeigen/eigen!2324

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 11:43:40 -07:00
Florian Maurin
71ef987edb Fixes triangular solves on indexed/sliced dense expressions
libeigen/eigen!2340

Closes #2814
2026-03-22 11:12:21 -07:00
Rasmus Munk Larsen
6490b17e6f Fix sanitizer regressions in sparse serializer and packet tests
libeigen/eigen!2319

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 09:10:16 -07:00
Pavel Guzenfeld
a0e30732a7 Remove trailing semicolon from EIGEN_UNUSED_VARIABLE macro
libeigen/eigen!2301

Closes #3007

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-21 16:54:13 -07:00
Rasmus Munk Larsen
54b04fc6b1 Fix mixed-type GEMM packing for backends without half/quarter packets
libeigen/eigen!2297

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 09:46:54 -07:00
Pavel Guzenfeld
1d21d62fbc Fix computeInverseAndDetWithCheck for dynamic result matrices
libeigen/eigen!2312

Closes #2917
2026-03-21 08:38:27 -07:00
Rasmus Munk Larsen
cc8c7cf0e6 Fix bugs and clean up SparseCore module
libeigen/eigen!2250

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 13:31:12 +00:00
Rasmus Munk Larsen
8115b45e50 Fix integer sanitizer issues in shifts and test ranges
libeigen/eigen!2320

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 17:27:02 -07:00
Yu You
9d161e0c87 Fine-tune gebp_kernel for aarch64
libeigen/eigen!2278
2026-03-20 14:29:03 -07:00
Pavel Guzenfeld
30128de0e3 Guard eigen_fill_helper on trivially copyable scalars
libeigen/eigen!2313

Closes #2956
2026-03-20 19:03:13 +00:00
Pavel Guzenfeld
36ca36d0de Guard redundant constexpr static member redeclarations for C++17+
libeigen/eigen!2299

Closes #3061

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-18 20:24:09 -07:00
Pavel Guzenfeld
0fd8002b11 Fix most vexing parse in SparseSparseProductWithPruning.h
libeigen/eigen!2298

Closes #3060

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-18 15:13:22 +00:00
Rasmus Munk Larsen
ea13a98dec Fix imag_ref for real scalar types and clean up svd_fill.h
libeigen/eigen!2303

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-15 19:56:01 -07:00
Antonio Sánchez
929785924c Fix more cache size queries.
libeigen/eigen!2296
2026-03-14 16:07:44 +00:00
Antonio Sánchez
b2f95d3733 Fix more cache size queries.
libeigen/eigen!2295
2026-03-14 15:43:24 +00:00
Antonio Sánchez
9ae0e0f195 Remove include from within Eigen namespace.
libeigen/eigen!2294
2026-03-13 21:03:24 +00:00
onalante-ebay
3a2ba7c434 Optimize predux_any<Packet4f>
libeigen/eigen!2277
2026-03-12 09:15:16 -07:00
Rasmus Munk Larsen
8368a12f0f Add runtime cache size detection for ARM and improve GEMM blocking
libeigen/eigen!2282

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-11 22:36:33 -07:00
Charles Schlosser
2a2456c873 restore Eigen/src/Core/arch/Altivec/MatrixProduct.h to b1e74b1cc
libeigen/eigen!2279
2026-03-12 03:26:03 +00:00
Charles Schlosser
c4eb3c4f4c fix custom visitors
libeigen/eigen!2275

Closes #2920
2026-03-11 10:52:49 +00:00
Antonio Sánchez
4387e32481 Fix row-skipping bug in general_matrix_vector_product::run_small_cols
libeigen/eigen!2276
2026-03-10 15:16:00 -07:00