Skip to content

Defer HessenbergQ multiplication to LinearAlgebra where available - #185

Merged
andreasnoack merged 2 commits into
masterfrom
hessenbergq-generic-mul
Oct 26, 2026
Merged

andreasnoack merged 2 commits into
masterfrom
hessenbergq-generic-mul

Conversation

@dkarrasch

@dkarrasch dkarrasch commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Closes #184, closes #183.

LinearAlgebra.jl now provides generic lmul!/rmul! for HessenbergQ (JuliaLang/LinearAlgebra.jl#1704), with the same signatures as the methods defined in src/svd.jl. Redefining them overwrites the upstream methods, which is an error during precompilation, so GenericLinearAlgebra no longer precompiles against LinearAlgebra master (see JuliaLang/LinearAlgebra.jl#1782).

  • Define the local HessenbergQ kernels only when LinearAlgebra lacks them, gated on hasmethod(lmul!, Tuple{LinearAlgebra.HessenbergQ,AbstractVecOrMat}). The upstream kernels handle the same element types, honour uplo, and are 13-29% faster on BigFloat in my measurements.
  • The HessenbergQs built in BidiagonalFactorization.getproperty store their reflectors below the subdiagonal, which is the 'L' layout that hessenberg produces; mark them as such instead of 'U'. Also pass the matching τ type parameter for leftQ.
  • Extend the HessenbergQ test to both factors, both bidiagonal orientations, real and complex BigFloat, all four multiplication directions, and the reconstruction of the original matrix.

Tested locally against LinearAlgebra master (upstream methods used) and on Julia 1.9.4 (local fallbacks used); the new testset passes in both configurations.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vv9VYe4nM23v8ruYwk9AQx


Generated by Claude Code

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.79%. Comparing base (658cf62) to head (1212d7b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
+ Coverage   95.73%   95.79%   +0.06%     
==========================================
  Files          11       11              
  Lines        1524     1546      +22     
==========================================
+ Hits         1459     1481      +22     
  Misses         65       65              

☔ 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.

LinearAlgebra now ships generic `lmul!`/`rmul!` methods for `HessenbergQ`
with the same signatures as the ones defined here. Redefining them
overwrites the upstream methods, which is an error during precompilation,
so only define the local fallbacks when LinearAlgebra lacks them.

The `HessenbergQ`s built in `BidiagonalFactorization.getproperty` store
their reflectors below the subdiagonal, which is the `'L'` layout that
`hessenberg` produces; mark them as such instead of `'U'`. Also pass the
matching `τ` type parameter for `leftQ`.

Extend the HessenbergQ test to both factors, both bidiagonal
orientations, real and complex BigFloat, all four multiplication
directions, and the reconstruction of the original matrix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vv9VYe4nM23v8ruYwk9AQx
@IanButterworth

IanButterworth commented Oct 26, 2026 •

Copy link
Copy Markdown

Claude:


Since 2026-10-12, GenericLinearAlgebra fails to precompile on Julia nightly (1.15-DEV): its lmul!(::HessenbergQ, ...) overwrites the LinearAlgebra method added in JuliaLang/LinearAlgebra.jl#1704 (stdlib bump JuliaLang/julia#63743). On PkgEval this also breaks its dependents, including DoubleFloats, CSVFiles and FileIO. The wrong-results concern in #183 was fixed by JuliaLang/LinearAlgebra.jl#1783, which julia master now includes. Could this be merged and released?

Written with Claude Code (Opus 5.5).

@dkarrasch

Copy link
Copy Markdown
Member Author

Ideally, we would need an approving review by someone with write access. I have now included a version bump, and once tests pass I'll merge, bypassing the rules, given @araujoms approving review.

@andreasnoack
andreasnoack merged commit e6b2f0e into master Oct 26, 2026
8 checks passed
@andreasnoack
andreasnoack deleted the hessenbergq-generic-mul branch October 26, 2026 15:03
@dkarrasch

Copy link
Copy Markdown
Member Author

Thanks, @andreasnoack!

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.

Recommendations regarding [l/r]mul! with HessenbergQ Precompilation fails on Julia 1.14 nightly: HessenbergQ lmul! methods overwrite LinearAlgebra's

5 participants