Commit e9d545e
Supply the _costabs Dual overload SupernodalLU's matching documents (#1118)
`src/SupernodalLU/matching.jl` says of `_costabs`:
Value types with no exact Float64 conversion (e.g. ForwardDiff.Dual) get
an overload in the package extension that extracts the primal value.
No such overload exists. It was left behind when the solver was vendored from
PurePardiso.jl, so the comment documents behaviour the package does not have.
MC64 matching decides its max-product assignment in Float64, so `_costabs`
needs a real magnitude per entry. Without the overload, factoring a `Dual`
matrix whose diagonal is missing or weak - exactly when `matching = :auto`
engages - throws:
MethodError: no method matching Float64(::ForwardDiff.Dual{Nothing, Float64, 1})
_costabs at matching.jl:206 [inlined]
mc64_matching(::SparseMatrixCSC{Dual{Nothing, Float64, 1}, Int64})
Only the *ordering* of candidate pivots comes from these numbers; the
factorization itself stays in Dual arithmetic, so taking the primal loses
nothing.
Reachable today through `LinearSolve.__init`. The public path is unaffected:
`__dual_init` strips duals before any algorithm sees them, so `solve` and
`init` on a Dual sparse problem factor in Float64 and never reach this code.
`_scalarval` needs no such fix - returning `NaN` for a Dual is intended and
documented there (`anorm` is informational; thresholds stay in native
arithmetic).
Test: an anti-diagonal matrix, which has no structural diagonal at all so
matching always engages, checked in both value and derivative against the
closed form. It fails on the unfixed code at the `snlu` call.
GROUP=Core passes.
Claude-Session: https://claude.ai/code/session_017rr42T1vFRRT8D7DMAmJzf
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 4c58ce2 commit e9d545e
2 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
766 | 777 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
0 commit comments