make Adjoint/Transpose behave like typical constructors#25461
make Adjoint/Transpose behave like typical constructors#25461mbauman merged 2 commits intoJuliaLang:masterfrom
Conversation
I'm curious --- why do we need this? Constructors are not required to be idempotent; that's one of the main differences with |
Thanks for reviewing! :) I am not certain I follow, so let's iterate: If you meant "why do we need If you instead meant "why do we need the idempotent Thoughts? Thanks! |
This is the one I meant. It seems confusing to have an |
I sympathize. I also appreciate what I believe was the motivation for this suggestion, i.e. that |
Eh, we've probably violated that before. |
|
I agree, this seems strange. I assumed by "proper constructor" in you meant that The strange part is adjoint vectors, since they mean something special… It's funny, since we dispatch on |
|
Any of the possible definitions are fine by me at this stage; I am happy to explore whichever definition gains broad favor :). (With |
|
My naive expectations would be that
A case where these would hold but |
|
I agree that |
|
I deeply agree with @timholy's point. Perhaps that provides good justification for the |
I can think of at least two other constructors that are not idempotent: |
|
👍 to adding an extra layer of wrapping. I think I'll add a sentence or two to the manual with some of these examples. |
While that's true, they probably should return the requested type, which means it would make sense to have a |
|
Seems we have consensus! :) Being loathe to cause long nights of self-doubt sitting underneath a ginko tree, I will revise those methods post-haste. |
|
Would it make sense for |
|
Thanks all! :) |
They always should add an extra wrapping, instead of eagerly do adjoint/transpose. See JuliaLang#25461
They always should add an extra wrapping, instead of eagerly do adjoint/transpose. See #25461
They always should add an extra wrapping, instead of eagerly do adjoint/transpose. See JuliaLang#25461
This pull request is the hopefully last set of functional changes in the JuliaLang/LinearAlgebra.jl#57 series (after #24969, #25083, #25125, #25148, #25217, and #25364).
Specifically, this pull request's first commit replaces some instances of
Adjoint/Transposewithadjoint/transpose(namely those missed in #25364 but caught by changes in the second commit), and its second commit makesAdjoint/Transposebehave like typical constructors (instead of e.g. satisfyingAdjoint(Adjoint(A)) === A).Unless I am forgetting something (please remind me if so!), after this pull request only news, docs, and cleanup remain for JuliaLang/LinearAlgebra.jl#57. Best!