-
Notifications
You must be signed in to change notification settings - Fork 93
Improvements to rules for norm
#337
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
Changes from all commits
19578d6
9993979
6b6487d
b03b83d
b666c37
972b6dd
c12b829
e4d60f2
96eafd6
07eb77b
d3833fc
79ecf73
f1b5ba4
3f893e4
46bf4c5
71d4ac9
e400bd5
81f85b7
43a2756
0331eda
69a92dc
87e4313
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,36 @@ Symmetric | |
```` | ||
""" | ||
_unionall_wrapper(::Type{T}) where {T} = T.name.wrapper | ||
|
||
""" | ||
WithSomeZeros{T} | ||
|
||
This is a union of LinearAlgebra types, all of which are partly structral zeros, | ||
with a simple backing array given by `parent(x)`. All have methods of `_rewrap` | ||
to re-create. | ||
|
||
This exists to solve a type instability, as broadcasting for instance | ||
`λ .* Diagonal(rand(3))` gives a dense matrix when `x==Inf`. | ||
But `withsomezeros_rewrap(x, λ .* parent(x))` is type-stable. | ||
""" | ||
WithSomeZeros{T} = Union{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would call these StructuredSparseArray There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You approve of the mechanism, #337 (comment)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am willing to give it a shot. It seems unfortunate not to take advantage of the fact that we know where the zeros are, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I misunderstand you, but both For UpperTriangular, I haven't tried to time this against broadcasting... there could be trade-offs, maybe broadcasting skips half, but if so it needs lots of if statements. Frankly I doubt that anyone has ever called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would also be good to fix this instability upstream. Can't we argue that the off-diagonal elements are a strong zero like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like all structural zeros should be strong yes. |
||
Diagonal{T}, | ||
UpperTriangular{T}, | ||
UnitUpperTriangular{T}, | ||
# UpperHessenberg{T}, # doesn't exist in Julia 1.0 | ||
LowerTriangular{T}, | ||
UnitLowerTriangular{T}, | ||
} | ||
for S in [ | ||
:Diagonal, | ||
:UpperTriangular, | ||
:UnitUpperTriangular, | ||
# :UpperHessenberg, | ||
:LowerTriangular, | ||
:UnitLowerTriangular, | ||
] | ||
@eval withsomezeros_rewrap(::$S, x) = $S(x) | ||
end | ||
|
||
# Bidiagonal, Tridiagonal have more complicated storage. | ||
oxinabox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# AdjOrTransUpperOrUnitUpperTriangular would need adjoint(parent(parent())) |
Uh oh!
There was an error while loading. Please reload this page.