-
-
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
Transpose deprecation "permutedims tip" doesn't work. #18320
Comments
This works: julia> a = [:a, :b, :c]
3-element Array{Symbol,1}:
:a
:b
:c
julia> reshape(a, 1, length(a))
1×3 Array{Symbol,2}:
:a :b :c From: JuliaLang/LinearAlgebra.jl#257 Should I change the deprecation warning from:
To:
|
@Ismael-VC Yes. It would be great if you could update the deprecation warning and the |
@andreasnoack you ment
Just to be concise and get a feeling of what we lost and what we gained. I can't write that sentence becuase, even after reading the issues I don't get what this is all about, thank you in advance.
In one short sentence would that describe it? |
Thank you. I am also quite frustrated about this. I have a few comments on your new suggestion (which I like!):
What is this? The average user will have no idea what this refers to
Maybe something like: WARNING: transposing a non-numeric array would result in a no-op which is deprecated. Intead, use permutedims(x, [2, 1]) for matrices and reshape(x, 1, length(x)) for vectors or write a specific transpose(x::Array{Foo}) method if appropriate. I still don't get the no-op part. Is there ever a context where transpose does work on non-numeric vectors/matrices now? |
julia> a = Matrix{Matrix{Float64}}(2,2)
2×2 Array{Array{Float64,2},2}:
#undef #undef
#undef #undef
julia> for i in eachindex(a); a[i] = rand(2,2); end
julia> a[1]
2×2 Array{Float64,2}:
0.903635 0.532792
0.653868 0.454383
julia> a'[1] # Transposed from above even though it is an element of `a`
2×2 Array{Float64,2}:
0.903635 0.653868
0.532792 0.454383 |
Got it. Thanks for helping me understand the internals a bit more. I suppose this is nice for transposing a block matrix. I think the no-op part of the depwarn should be removed and it should just say something like: you can't transpose anything that is non-numeric unless you define a no-op transpose function for the data type: transpose(f::Foo) = f I still don't quite understand why this deprecation was necessary in the first place ಠ_ಠ |
@Ismael-VC I don't think |
For whoever is going to fix this warning, I think we should be encouraging the use of |
* close JuliaLang#18320 * Update NEWS.md * Update deprecated.jl * Update deprecated.jl
Reference: #17374
I'd love to read the whole discussion of why this behavior changed, but I can't, I guess it's because some kind of mathematical purity consideration, I just wanted to do
x'
and move on, I had to read the source code of the referenced issue, to understand both what it meant byno-op
and how to fix this issue:I don't get why it's worth removing these definitions, and force people to implement them for their own types too. Even if permutedims is the answer, I just wanted to use
x'
, as soon as I saw this I was like: ok ...I don't get this, but anyway I can (or so I thought) do this to make it work with all vectors again, it's just one line:But of course not, that was too naive.
I'm sure you guys know what you are doing and I trust you, but if we deprecate something, the warning should include the solution by today standards, not a tip, or consider and it have to be tested, I don't want to have to read 3+ year long discussions to figure out this or have to look at the Base code to understand what this means.
If I do:
I'll get a warning because now I'm redefining the method (but it works), do I really have to define transpose(x::T) for any new type if I may want to transpose a vector of those separately?
I also think it is a good idea to explain concisely why a feature is added, deprecated or removed in NEWS.md:
This tells me nothing and suggests (forces) me to read 3 threads.
The text was updated successfully, but these errors were encountered: