-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix broadcast! where the destination is a structured matrix #20886
Conversation
wrong issue number? Does the Symmetric wrapper type support |
Good catch; OP updated.
|
This behavior was explicitly requested by @andreasnoack in #19228 (comment). The problem with assigning outside of the diagonal for symmetric matrices is that you're modifying two values at once. Only allowing assignment on the diagonal ensures that the behavior of |
Much thanks for the pointer! Hm, that's tricky. On the one hand, not allowing |
would give different results for symmetric A vs non symmetric. For generic programming we could introduce a symmetric setter function that does the same thing on symmetric and non symmetric inputs. |
One could argue that behavior is correct though, depending on how one interprets
So |
No one has been arguing for any interpretation of setindex on a single entry changing multiple values, multiple people have argued (and written code for Symmetric) to enforce against that. SymTridiagonal is surely a bug/oversight that we should fix asap. |
Cheers, sounds good, and shall do :). Thanks! |
there are several broken tests that need switching over here |
Thanks all! (Ref. #20901 (comment).) |
Due to an oversight in #19926,
broadcast!
where the destination is a structured matrix presently fails. This pull request fixes the preceding issue and adds tests to guard against regression.Some of the tests are
@test_broken
for the following reason: WhileDiagonal
setindex!
(#11582) supports setting off-diagonal entries to zero (and similarly subtypes ofAbstractTriangular
provide analogous behavior), the other special matrix types (Bidiagonal
,Tridiagonal
, andSymTridiagonal
) do not provide analogous behavior (they always throw, which I'm guessing was an oversight in #15092). That behavior is necessary for a given structured matrix type to function as a destination forAbstractArray
broadcast!
, hence the broken tests; I have a fix (separate PR) in the works forsetindex!
overBidiagonal
,Tridiagonal
, andSymTridiagonal
. Best!