Use numext:: math in library headers

.agents/conventions.md asks library implementation headers to call numext:: rather than std::, because the numext:: overloads are device-callable and correct for Eigen's own scalar types. check_style.py reports this on added lines; converting the existing calls removes the reason that check is scoped to added lines.

60 lines across 16 files. Every std:: math site in the library trees was classified individually, and each proposed conversion was then re-checked by an independent reviewer asked to refute it — because "std:: → numext::" is not uniformly safe. Of 107 sites: 57 conversions confirmed, 14 rejected on review, 25 correct as std::, 11 left as maintainer decisions.

Two cases needed more than a token swap

  • std::frexp has no numext:: equivalent. The four sites take the prescribed form instead — EIGEN_USING_STD(frexp) followed by an unqualified call, as pfrexp does in GenericPacketMath.h.
  • The NEON pabs<Packet2l> site spells the call (std::abs)(x), parenthesised to guard the name against a macro. numext:: needs no such guard, so the parentheses go. (This site is invisible to the std::name( grep, which is why it had not been noticed.)

Deliberately not converted

  • std::real/std::imag in the SIMD complex backends (36 occurrences). There the scalar type is std::complex<float|double> and the code is host-only, so std:: is correct rather than an oversight.
  • The integer-argument calls in TensorDeviceSycl and PolynomialSolver. numext::log2 and numext::pow have integer overloads that dispatch to exact integer algorithms, so converting an integer call site would change the algorithm, not the spelling. Same for numext::signbit in BFloat16 (different return type) and std::polar in Circulant (no numext:: counterpart). These want a decision about semantics, not a sweep — happy to follow up separately.

On the fma sites in SSE/PacketMath.h: converted. numext::fma forwards to std::fma on the host and to the device intrinsic under GPU compilation, so the host result is unchanged and the device path gains the intrinsic.

Depends on !2800 (merged), which fixes a dead std::ceil in ArpackSupport that this sweep would otherwise have preserved.

Merge request reports

Loading