-
-
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
Inconsistency in descending transpose
between sparse and dense arrays
#28369
Comments
It's a bug. Maybe easier to see in julia> transpose(sparse(M))[1,1]
2×2 Transpose{Int64,Array{Int64,2}}:
1 1
0 0
julia> copy(transpose(sparse(M)))[1,1]
2×2 Array{Int64,2}:
1 0
1 0 I guess |
andreasnoack
added
bug
Indicates an unexpected problem or unintended behavior
sparse
Sparse arrays
labels
Jul 31, 2018
Indeed the two definitions julia/stdlib/SparseArrays/src/sparsematrix.jl Lines 870 to 871 in 81ee3ae
|
IIRC the assumption of scalar elements are used quite a lot in the sparse code. |
Not sure how robust this is, but julia> Base.copy(A::Transpose{<:Any,<:SparseMatrixCSC}) =
SparseArrays.ftranspose(A.parent, x -> copy(transpose(x)));
julia> S = sparse(M);
julia> copy(transpose(S))[1,1]
2×2 Array{Int64,2}:
1 1
0 0 |
jlapeyre
added a commit
to jlapeyre/julia
that referenced
this issue
Jul 31, 2018
jlapeyre
added a commit
to jlapeyre/julia
that referenced
this issue
Jul 31, 2018
jlapeyre
added a commit
to jlapeyre/julia
that referenced
this issue
Aug 1, 2018
KristofferC
pushed a commit
that referenced
this issue
Feb 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ideally, I expect sparse and dense objects to represent the same thing, but to employ different representations internally. I convert between them only to take advantage of differences in algorithmic efficiency.
I guess there is no perfect solution to this kind of thing. Computer-language types and mathematical-object types (sets) are far from congruent. E.g., in math, it is common to interpret objects in one section of a manuscript or book in a particular way without worrying about breaking examples in another section. Even the most flexible computer-language type system is more rigid.
The text was updated successfully, but these errors were encountered: