-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
should not be recursive
#1034
Comments
The |
I'm quite confused why #408 was closed it looks like near the end, people were mostly in agreement that
or to put it under a trait
and yet the issue was closed leaving I understand that this is in some cases mathematically consistent with other functions. however a . this is one of those situations where it feels that we have let some esoteric principle win out over a really annoying usability problem. like really, take a step back from the linalg textbook for a second, does it really make sense that |
No, the recursiveness seems to be necessary for a transpose, consider the following: transpose_necessary_property1(t, a) = (t∘t)(a) == a
transpose_necessary_property2(t, u, v) = t(v*u) == t(u)*t(v)
for candidate ∈ (permutedims, transpose)
v = [rand(2, 2) for _ ∈ 0:1, _ ∈ 0:2]
u = [rand(2, 2) for _ ∈ 0:2, _ ∈ 0:2]
transpose_necessary_property1(candidate, u) ||
println(candidate, " fails the first necessary property, can't be transpose")
transpose_necessary_property2(candidate, u, v) ||
println(candidate, " fails the second necessary property, can't be transpose")
end It outputs:
|
This PR and the associated discussion are also relevant: JuliaLang/julia#7244. |
this is only necessary if you treat the elements as scalars and every which is exactly what I am protesting: I find it very silly that I understand that this has been discussed at length before, but reading through some threads I really don't see any good justification or consensus that the only compelling use case at all I see in those discussions is to transpose block matrices, which should have been done with a new type + dispatch |
All of our basic linear algebra operations are recursive. It's required that transpose also be recursive to maintain There is a strong case to be made that we should indeed get rid of this behaviour in Julia 2.0 (if that ever happens). And leave the representations of interesting vector spaces represented nested arrays to a special type -- not to Anyways this is breaking so this appropriate labels. |
This reminds of the mathematical programming language Fricas. Its type system and standard library distinguish between:
However, it seems to me that the trend in Julia is to use traits instead of abstract types? So I guess adienes' suggestion may materialize partially, but only in Julia 2? |
I don't see |
Rethinking this issue, I'm finding it a bit absurd. It's not even a feature request, seeing as the single-argument Perhaps the underlying issue is the already discussed way Julia's
|
I follow, but do not agree with the argument. anyway, looks like this is unlikely to change. thank you for the thoughts |
You could just leave it open, many other open issues exist with the https://github.com/JuliaLang/julia/labels/speculative or https://github.com/JuliaLang/julia/labels/breaking labels. |
I understand the argument for
adjoint
, buttranspose
is really something different. I think it's somewhat silly that e.g.Matrix{String}
cannot betranspose
'd. if a type wants to opt-in to recursive transpose it can do so via dispatchThe text was updated successfully, but these errors were encountered: