Skip to content

exp: Padé denominator solve via LinearSolve default algorithm (alias_A)#240

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:exp-gesv-denominator
Jul 10, 2026
Merged

exp: Padé denominator solve via LinearSolve default algorithm (alias_A)#240
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:exp-gesv-denominator

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 5, 2026

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas. Draft; opened by an agent at Chris's direction.

Switches ExpMethodHigham2005Base's cached Padé denominator solve from LinearSolve's default algorithm to GESVFactorization (SciML/LinearSolve.jl#1078, v4.3.0): one combined gesv! per refactorization, restoring raw-LAPACK parity at small n (−1.8% vs the original gesv! code at n=5, ties within noise at n=10–250; bit-identical accuracy and allocation bytes across all 12 benchmark cells). Also restores the historical SingularException contract — the default algorithm's QR safety-fallback silently resolved singular denominators.

Compat: LinearSolve = "4.2"unmergeable until LinearSolve 4.3.0 tags (#1078). Full EU basictests pass locally against the dev'd branch (22 testsets, 1 pre-existing broken).

🤖 Generated with Claude Code

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

LinearSolve 4.3.0 (with GESVFactorization, SciML/LinearSolve.jl#1078) is released. Rebased onto current master and bumped compat to LinearSolve = "4.3". Verified locally against 4.3.0: exp! ≈ Base.exp to 2.3e-15, exp-methods testset 40/40, Phi testset 284/284. Ready for CI once the registry propagates 4.3.0.

Route ExpMethodHigham2005Base's Padé denominator solve (V - U) X = (V + U)
through a cached LinearSolve workspace using the *default* algorithm choice
with alias_A/alias_b, replacing the raw LAPACK.gesv! calls.

The default size-selects the fastest available LU — notably
RecursiveFactorization when loaded (the common case in SciML/exponential-
integrator stacks), whose solve is ~2-2.7x faster than LAPACK LU at
small/medium n. alias_A lets it refactorize in place (no O(n^2) copy);
per-call allocation stays small and O(1)-ish. On a singular denominator
the solve returns a Failure retcode, which this code turns back into the
SingularException exp! has always thrown.

An earlier revision pinned GESVFactorization for raw-gesv! parity; with
alias_A the default is allocation-competitive and faster (RFLU), needs no
4.3-only feature, and auto-benefits from future LinearSolve improvements,
so it wins here. Requires LinearSolve 4.1 (alias_A in-place refactorization).

Verified vs Base.exp to ~2e-15; exp-methods 40/40 and Phi 284/284 on
LinearSolve 4.1.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYp371jx6LurezUDhKcYRh
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title exp: Padé denominator via GESVFactorization exp: Padé denominator solve via LinearSolve default algorithm (alias_A) Jul 10, 2026
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Switched from GESVFactorization to LinearSolve's default algorithm choice (with alias_A/alias_b) after re-benchmarking with matched aliasing — thanks @ChrisRackauckas for pushing on this.

With alias_A = true the default:

  • is allocation-competitive (no O(n²) backup copy — my earlier "+2–4.5%" was measured without alias on the default, an unfair comparison);
  • has a 2–2.7× faster solve at small/medium n when RecursiveFactorization is loaded (RFLU beats LAPACK LU — the common case in exponential-integrator stacks), vs GESV/LU which are pinned to LAPACK;
  • needs only LinearSolve 4.1 (alias_A in-place refactorization), not the 4.3-only GESVFactorization — so compat dropped "4.3""4.1" and this no longer waits on the latest release;
  • auto-benefits from future LinearSolve algorithm improvements.

Singular-denominator behavior is unchanged: the solve returns a Failure retcode, which the code converts back to the SingularException exp! has always thrown.

Verified against registered LinearSolve 4.1.0: exp!Base.exp to ~2e-15, exp-methods testset 40/40, Phi testset 284/284. (GESVFactorization remains a useful general-purpose LinearSolve alg from #1078 regardless — it's just not the optimal pick for this fresh-every-call pattern.)

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review July 10, 2026 08:03
@ChrisRackauckas
ChrisRackauckas merged commit 50c03f7 into SciML:master Jul 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants