Skip to content

fix dispatch for schur(::UpperHessenberg)#1565

Open
stevengj wants to merge 6 commits intomasterfrom
hess_schur_fix
Open

fix dispatch for schur(::UpperHessenberg)#1565
stevengj wants to merge 6 commits intomasterfrom
hess_schur_fix

Conversation

@stevengj
Copy link
Copy Markdown
Member

Fixes an apparent bug in JuliaLang/julia#47872 — schur(A::UpperHessenberg{T}) called copy_similar(A, eigtype(T))) but the copy_similar function strips away the UpperHessenberg wrapper. As a result, the optimized schur! function was not being called.

Following #1557, this changes it to call eigencopy_oftype, which preserves the UpperHessenberg wrapper (and also Hermitian wrappers, but schur already has a specialized dispatch for Hermitian cases). It also adds a fallback schur! for non-BLAS types, to avoid breaking anything.

cc @albertomercurio, @Jutho, and @dkarrasch, who were involved in the original PR.

@stevengj stevengj added the performance Must go faster label Mar 19, 2026
```
"""
schur(A::AbstractMatrix{T}) where {T} = schur!(copy_similar(A, eigtype(T)))
schur(A::UpperHessenberg{T}) where {T} = schur!(copy_similar(A, eigtype(T)))
Copy link
Copy Markdown
Member Author

@stevengj stevengj Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why this schur(A::UpperHessenberg{T}) method was added in the first place — it seems redundant with schur(A::AbstractMatrix{T})?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.32%. Comparing base (bbaf1f6) to head (fa191cb).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1565      +/-   ##
==========================================
- Coverage   94.35%   94.32%   -0.03%     
==========================================
  Files          35       35              
  Lines       16004    16004              
==========================================
- Hits        15100    15096       -4     
- Misses        904      908       +4     

☔ View full report in Codecov by Sentry.
📢 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.

Co-authored-by: Mateus Araújo <maltusan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants