-
-
Notifications
You must be signed in to change notification settings - Fork 18
Structured broadcasting for UpperHessenberg #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1325 +/- ##
==========================================
+ Coverage 93.74% 93.76% +0.02%
==========================================
Files 34 34
Lines 15752 15769 +17
==========================================
+ Hits 14766 14786 +20
+ Misses 986 983 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
43b3963
to
499c286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome how "little" work needs to be done to make it work.
@@ -27,28 +31,46 @@ Broadcast.BroadcastStyle(::StructuredMatrixStyle{Diagonal}, ::StructuredMatrixSt | |||
StructuredMatrixStyle{LowerTriangular}() | |||
Broadcast.BroadcastStyle(::StructuredMatrixStyle{Diagonal}, ::StructuredMatrixStyle{<:Union{UpperTriangular,UnitUpperTriangular}}) = | |||
StructuredMatrixStyle{UpperTriangular}() | |||
Broadcast.BroadcastStyle(::StructuredMatrixStyle{Diagonal}, ::StructuredMatrixStyle{UpperHessenberg}) = | |||
StructuredMatrixStyle{UpperHessenberg}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, where do you handle the case Broadcast.BroadcastStyle(::StructuredMatrixStyle{UpperHessenberg}, ::StructuredMatrixStyle{UpperHessenberg})
? Like in UH .+ UH
. Is there some fallback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled by the fallback method
Broadcast.result_style(s1::S, s2::S) where S<:BroadcastStyle
The BroadcastStyle
methods are only required when promotion is needed.
@@ -388,4 +393,11 @@ end | |||
@test ind == CartesianIndex(1,1) | |||
end | |||
|
|||
@testset "Rectangular UpperHessenberg" begin | |||
UH = UpperHessenberg(ones(4,3)) | |||
UH2 = UH .+ UH .- UH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that even work with
UH2 = UH .+ UH .- UH | |
UH2 = UH + UH - UH |
?
This adds a custom structured broadcasting style for an
UpperHessenberg
, which now retains structure on some broadcasting operations.Unlike an
UpperTriangular
, anUpperHessenberg
can retain its structure in broadcasting operations involving other banded matrices such anTridiagonal
. We may also, in the future, make::UpperTriangular .+ ::Bidiagonal
produce anUpperHessenberg
.