Open oxinabox opened 4 years ago
See #19228, specifically #19228 (comment)
Thanks for the links. Yep, this issue basically is about revisiting that decision. It's been 4 years; things have changed in the language. We now have the ability to extensively customize broadcast behavour.
So we could bring the behavour of Symmertic/Hermitian closer inline with Digaonal/LowerTriangualar/UpperTriangular, which all do allow the equalivent structure preserving inplace operations.
I'm adding the triage label so we can get a broader discussion here. I'm personally in favor, as these seem like good operations to have.
"All" that needs to happen here is that our structured broadcast implementation needs to be expanded to include considerations of symmetric/hermitian matrices:
It'll be a bit of work, but totally possible and shouldn't really be contentious — especially for the cases where we're broadcasting scalars or other symmetric structures.
To keep this issue focused, lets avoid talking about what to do for asymmetric (/non-conjugate symmetric) operations that can be turned into symmetric (/conjugate symmetric) ones. i.e. not talking about making it so that after running
AH[2,3] = 100
then it is observatory asAH[2,3] == AH[3,2] == 100
. Just about things that do preserve the symmetry (/conjugate symmetry)
@oxinabox at the risk of defocusing this issue, is AH[2,3] == AH[3,2] == 100
not desirable to you? it is to me. is it discussed somewhere else other than https://github.com/JuliaLang/julia/pull/19228#discussion_r110451034 ?
to answer my own question: https://github.com/JuliaLang/julia/pull/33071
Apologies for the noise around locking/transferring - I had moved this overenthusiastically to a discussion.
We should allow symmetry/conjugate-symmetry preserving operations on Symmertic/Hermitian matrices. For example the following failures should not be failures.
These are annoying, they make it hard to write code that is generic to the type of the
AbstractArray
; even when you know that the operation you are doing will be symmertic if the input is etc. E.g. because you are implementing a linear operator, (I think as a rule linear operators tend to preserve a structure one cares about for a type that represents a particular vector subspace)To keep this issue focused, lets avoid talking about what to do for asymmetric (/non-conjugate symmetric) operations that can be turned into symmetric (/conjugate symmetric) ones. i.e. not talking about making it so that after running
AH[2,3] = 100
then it is observatory asAH[2,3] == AH[3,2] == 100
. Just about things that do preserve the symmetry (/conjugate symmetry)The effect on this on the parent matrix could either be specifically undefined, or define to only set in the given upper/lower, or actually change both.
related: #38055