-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
'ᵀ as syntax for transpose #40070
Comments
Hmm - I can see how it "looks" like nested adjoint then transpose, but I believe the intention was to (generically) be able to create "modified versions of
Sorry, I don't see how this follows. Just like |
I've slightly modified the wording in the original post – your argument addressed my suggestion that it would have to be avoided, but this isn't at all the point I wanted to make. No matter whether the operator ends up being used or not (in fact I fully agree that sticking to Going with a new syntax that is incompatible with common math notation, particularly when it is so in an error-prone fashion (as for e.g. square complex matrices, both interpretations give results of the same size), just seems like an unforced design mistake to me. And even if it turns out that the benefits of this notation (which?) outweigh the drawbacks (increased cognitive load), surely that conclusion should be reached by a process more deliberate than "it seemed like the only sensible interpretation"? People can still define |
More to the point: You write
I've read through some of the chain of issues leading to the PR, and agree with your statement – but does it matter what the intentions were if the end result is ambiguous? My concern is that this, which is supposed to address JuliaLang/LinearAlgebra.jl#410, leaves us in precisely the same situation with just a slightly differently coloured paint job. @ StefanKarpinski writes:
Ironically, for the common case of complex matrices, even the "obvious" interpretation is the same for both JuliaLang/LinearAlgebra.jl#410 and this – both |
To put this in context: There had been a lot of discussion about this already and #37247 had just been merged, with the main goal being to support
In the context of Julia, I don't really think this is the same situation. In Julia, we have broadcasting syntax, which has a clearly defined meaning as broadcasting a function over sized containers and for operators is written as OTOH, we support unicode suffixes for any non-syntactic operator. What IMHO further warrants this way of thinking is that Either way, I understand that this is the kind of syntax people tend to have very strong opinions about and my opinion is just one among many, but I wanted to explain my thinking a bit better. Re-reading the old discussions, (P.S.: Sorry for the wall of text. I unfortunately can't join the next triage call, so I wanted to explain my thinking a little.) |
Triage still doesn't like this syntax and most of us don't want to reinstate it. |
But the change to "allow unicode modifiers after ' " introduced in PR #37247 is still in place. Are the further uses for this anyone has in mind? |
Honest question: what did |
Transpose, like MATLAB. |
I got a bit lost in the issues relating to this. Was the idea of a postfix notation for |
PR #38062 introduces
'ᵀ
into Base.We have had
a' == adjoint(a)
for a long time, so it is natural to "read"a'
as aᴴ, a†, a*, or whatever your preferred math notation for the Hermitian conjugate/adjoint might be. Also, aᵀ pretty unambiguously meanstranspose(a)
.Thus, it would be natural to assume that
a'ᵀ
would be equivalent to a†ᵀ, that is,transpose(adjoint(a))
, or (for complex matrices) the element-wise complex conjugate.However, that is not the case in the release candidate:
a'ᵀ
is defined astranspose(a)
!This strikes me as highly misleading – given how naturally Julia syntax maps to common math notation in most cases, I would have bet quite a bit on the interpretation as the transposed adjoint. This is one of those cases where one interpretation seems so natural to me that I wouldn't even have considered that somebody else could view it differently.
Perhaps this quite significantly depends on the types of mathematics one is in regular contact with? My educational background is maths/physics at ETH Zurich, and I work in quantum computing research these days. This is a context in which a'ᵀ (i.e. a†ᵀ, i.e. a*ᵀ, i.e. aᴴᵀ) actually makes sense and is reasonably common – in fact, A̅ := A†ᵀ is probably the most natural way of defining complex conjugation in many category-theory approaches to quantum mechanics –, so I can believe that this interpretation might be less immediate to people in other areas.
Still, I think it is clear that the design rationale provided in #38062, where @simeonschaub writes "I feel like transpose is really the only sensible meaning of 'ᵀ," hasn't been sufficiently examined. Since we are at rc3 already, it seems the way to go would be to pull this from 1.6 and reopen the discussion on a transposition operator for 1.7.
From my point of view, this is ambiguous enough to be a net design negative for the language as a whole – but certainly for the budding Julia quantum ecosystem, where the new operator would actively cause confusion.
The text was updated successfully, but these errors were encountered: