Commit Graph

13178 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
93e9970964 Run clang-format on bench_small_matrix.cpp
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:28:20 -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
Rasmus Munk Larsen
8ddbe44799 Add small fixed-size matrix benchmarks for robotics/CV workloads
Benchmark the operations that dominate robotics and computer vision
inner loops: fixed-size matrix multiply, matrix-vector, inverse,
determinant, LLT, LDLT, PartialPivLU, ColPivHouseholderQR, JacobiSVD,
and SelfAdjointEigenSolver for sizes 2x2 through 8x9.

Key findings from the baseline measurements:
- MatMul/MatVec: excellent (<1ns for 3x3 float)
- Inverse 3x3: excellent (3.4ns)
- LLT 3x3→4x4: 8x jump (3.9→31.7ns float) due to inlining threshold
- ColPivQR 3x3: 166ns — expensive for such a small matrix
- JacobiSVD 3x3: 498ns double — the main CV bottleneck
- SelfAdjointEig: computeDirect() is 3.2x faster than iterative for 3x3
  (71ns vs 230ns) — many users may not know this API exists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:06:32 -07:00
Rasmus Munk Larsen
fe6ada10be Prevent nightly CI pipelines from being auto-cancelled
libeigen/eigen!2390

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-04 11:52:15 -07:00
Alexander Grund
8179474225 CI: Add AVX512-FP16 build tests with GCC 13
libeigen/eigen!1652

Co-authored-by: Alexander Grund <alexander.grund@tu-dresden.de>
2026-04-04 11:32:31 -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
Rasmus Munk Larsen
ebae0c7c10 ulp_accuracy: use dynamic work queue for thread load balancing
libeigen/eigen!2383

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 22:40:03 -07:00
Charles Schlosser
5977635d64 fix singed integer overflow UB in integer_types and other trivial compiler warnings
libeigen/eigen!2380
2026-04-03 03:36:28 +00:00
Rasmus Munk Larsen
60df12437e Fix ulp_accuracy crashes in Release builds
libeigen/eigen!2381

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 20:12:13 -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
8ec68856a6 Fix basicstuff_8 casting test failure on loongarch64
libeigen/eigen!2379

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 14:14:54 -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
30e669cfe1 Tensor module: const-correctness and constexpr improvements
libeigen/eigen!2239

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 17:49:56 -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
6a07970d7d CI: split NVHPC build and make fallback parallelism configurable
libeigen/eigen!2372

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 16:43:33 -07:00
Rasmus Munk Larsen
4be66f2830 CI: fail test jobs when no tests are found (--no-tests=error)
libeigen/eigen!2373

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 12:50:54 -07:00
Rasmus Munk Larsen
1df89cbc21 Right-size CI runners to reduce waste and shuffle build order to avoid OOM
libeigen/eigen!2367

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 19:10:34 -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
80ab2898e2 CI: install libclang-rt-14-dev for sanitizer smoketest
libeigen/eigen!2369

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 00:16:18 -07:00
Rasmus Munk Larsen
798d7f2bec CI: drop Clang-6, bump base image to Ubuntu 24.04 and Clang 12 to 14
libeigen/eigen!2366

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-30 22:00:17 -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
806c7b6590 CI: fix Windows build cache key containing invalid path characters
libeigen/eigen!2362

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 19:57:45 -07:00
Rasmus Munk Larsen
2776ba55eb Update slicing tutorial docs to reflect Eigen::placeholders namespace
libeigen/eigen!2360

Closes #3064

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 18:51:02 -07:00
Rasmus Munk Larsen
09581fda38 Modernize tensor contraction code: bug fixes, dead code removal, and cleanup
libeigen/eigen!2248

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 18:03:06 -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
255f522e2e Fix bugs, docs, and structure in unsupported/ public headers
libeigen/eigen!2254

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 17:06:40 -07:00
Pavel Guzenfeld
bd276fbb28 Map .inc files to C++ in Doxygen extension mapping
libeigen/eigen!2338
2026-03-29 16:48:13 -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
Rasmus Munk Larsen
409296d91d Add nightly benchmark regression detection pipeline
libeigen/eigen!2349

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 16:03:56 -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
Charles Schlosser
ba9871e46b fix and enable realview unit tests
libeigen/eigen!2356
2026-03-28 20:13:54 -07:00
Rasmus Munk Larsen
b8dab89663 CI: remove broken NVHPC CUDA pipeline
libeigen/eigen!2355

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 19:52:01 -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
5e521f3e45 Revert "add realview test"
This reverts merge request !2352
2026-03-28 17:27:01 -07:00
Charles Schlosser
87ae1dbe7f add realview test
libeigen/eigen!2352
2026-03-28 16:26:51 -07:00
Rasmus Munk Larsen
49a137ca24 CI: limit NVHPC build parallelism to avoid OOM kills
libeigen/eigen!2353

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 16:10:04 -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
Rasmus Munk Larsen
9706546a14 Add Householder blocked-right regression test
libeigen/eigen!2348

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-27 20:49:43 -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