-
-
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
permutedims(::SparseMatrixCSC) calls a fallback method #28324
Comments
We'll need a |
OK. In case someone cares to comment first, these are the relevant lines in sparsematrix.jl adjoint(A::SparseMatrixCSC) = Adjoint(A)
transpose(A::SparseMatrixCSC) = Transpose(A)
Base.copy(A::Adjoint{<:Any,<:SparseMatrixCSC}) = ftranspose(A.parent, conj)
Base.copy(A::Transpose{<:Any,<:SparseMatrixCSC}) = ftranspose(A.parent, identity) The following should provide a minimal fix Base.permutedims(A::SparseMatrixCSC) = ftranspose(A.parent, identity)
function Base.permutedims(A::SparseMatrixCSC, (a,b))
(a, b) == (2, 1) && return ftranspose(A.parent, identity)
(a, b) == (1, 2) && return copy(A)
throw(ArgumentError("no valid permutation of dimensions"))
end
|
You are right that
This has indeed been discussed. Maybe @Sacha0 remembers which are the relevant issues. Would you prefer to get a |
If it comes down to a choice between preserving the current consensus for
That's a good question. But, maybe better questions are what do you want and what is the best interface for providing it ? Currently, we have julia> v = view(randn(1000, 1000), 1:2, 1:2);
julia> copy(v)
2×2 Array{Float64,2}:
-0.981013 1.06454
-1.69617 1.73077
julia> collect(v)
2×2 Array{Float64,2}:
-0.981013 1.06454
-1.69617 1.73077 The same holds for |
Yes and for some reason it has fallen in dismay. I'm pretty neutral wrt |
Regarding the semantics of to the inimitable @mbauman. Best! |
I'm preparing a what I hope is a non-controversial PR :) |
Famous last words 😉. |
Yes, For now, we're living with the fact that |
This appears resolved to me. I get the same performance for both operations reported above. |
The documentation recommends
permutedims
to get a material transpose. There is an efficient function, but it is not called:The text was updated successfully, but these errors were encountered: