Skip to content

Solve a real UmfpackLU against a ComplexF32 vector in ldiv! - #1112

Merged
ViralBShah merged 1 commit into
mainfrom
vs/umfpack-complex-rhs-eltype
Oct 26, 2026
Merged

ViralBShah merged 1 commit into
mainfrom
vs/umfpack-complex-rhs-eltype

Conversation

@ViralBShah

Copy link
Copy Markdown
Member

ldiv! of a real UmfpackLU with a ComplexF32 vector throws a MethodError; the matrix case and \ work.

Before

julia> F = lu(sparse([2.0 1; 1 3])); ldiv!(F, ComplexF32[1, 2])
ERROR: MethodError: no method matching solve!(::Vector{Float64}, ::SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, ::Vector{Float32}, ::Int64; workspace::SparseArrays.UMFPACK.UmfpackWS{Int64})

After

julia> F = lu(sparse([2.0 1; 1 3])); ldiv!(F, ComplexF32[1, 2])
2-element Vector{ComplexF32}:
 0.2f0 + 0.0f0im
 0.6f0 + 0.0f0im

The vector kernel for a complex right-hand side and a real factor solves the real and imaginary parts separately, through a scratch buffer it built with c = real.(b). That buffer has the real eltype of b, Float32 here, and UMFPACK only solves in Float64. It is now allocated as Float64 and filled in place, as the matrix kernel already does. The 3-argument form and transpose(F) and F' go through the same kernel.

🤖 Generated with Claude Code

@ViralBShah ViralBShah added backport 1.13 Change should be backported to release-1.13 backport 1.14 labels Oct 26, 2026
@ViralBShah
ViralBShah enabled auto-merge (squash) October 26, 2026 13:30
The complex-vector kernel built its real-part buffer with `real.(b)`, which is
`Float32` for a `ComplexF32` right-hand side, and UMFPACK has no `Float32` solve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ViralBShah
ViralBShah force-pushed the vs/umfpack-complex-rhs-eltype branch from 63054c1 to 1fcdf3b Compare October 26, 2026 13:32
@ViralBShah
ViralBShah disabled auto-merge October 26, 2026 13:56
@ViralBShah
ViralBShah enabled auto-merge (squash) October 26, 2026 13:56
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.72%. Comparing base (48204b2) to head (1fcdf3b).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1112   +/-   ##
=======================================
  Coverage   94.72%   94.72%           
=======================================
  Files          16       16           
  Lines       10310    10315    +5     
=======================================
+ Hits         9766     9771    +5     
  Misses        544      544           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ViralBShah
ViralBShah merged commit 8036bf3 into main Oct 26, 2026
12 checks passed
@ViralBShah
ViralBShah deleted the vs/umfpack-complex-rhs-eltype branch October 26, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.13 Change should be backported to release-1.13 backport 1.14

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant