-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Inconsistencies with transpose and Diagonal * Sparse #420
Comments
I'll have a look at this in the next day or two. |
I'm not sure if it is relevant to this issue, similar problems arise for the Symmetric type of sparse matrices, ex: julia> s = sprandn(3,3,0.5);
julia> ss = Symmetric(s'*s) #Everything is still sparse
3×3 Symmetric{Float64,SparseMatrixCSC{Float64,Int64}}:
1.78954 0.0318829 0.0
0.0318829 0.166128 0.0
0.0 0.0 0.0
julia> ss*2 # Symmetric{Float64,SparseMatrixCSC{Float64,Int64}} Works fine
julia> 2*ss # Array{Float64,2} Not sparse and lost Symmetric tag
julia> ss+ss # Array{Float64,2} Same problem
julia> ss*ss # Array{Float64,2} Same problem and as noted above (but with additional missing Symmetry tag) ss'*Diagonal(randn(3)) # Array{Float64,2} Not sparse no Symmetry tag
Diagonal(randn(3))'*ss # Same And I don't understand the reasoning behind julia> ss[1,2] = 2
ERROR: ArgumentError: Cannot set a non-diagonal index in a symmetric matrix which causes ss*Diagonal(randn(3))
Diagonal(randn(3))*ss I guess this is related to JuliaLang/julia#8240, but for sparse matrices. |
The cause of this part of the issue
is that the A[c]_mul_B[c] instances here are provided by diagonal.jl (lines 190 and 205). Those methods expect to be able to use When eltype(D) = Complex, we end up in generic So who is at fault?
@Sacha0 - as far as I can tell, the |
Hm, tricky that. Not automagically resizing the destination sparse matrix's storage seems like it breaks a worthwhile abstraction, so perhaps automagically resizing is best? Opinions from the usual sparse suspects? Best! |
For all those who need a fix right now, |
This is fixed in 0.7 |
This bug report is split out from @fredrikekre's https://github.com/JuliaLang/julia/issues/21286#issuecomment-292077402:
Here are some other faulty things with Diagonal/SparseMatrixCSC I found looking at JuliaLang/julia#20367 but then forgot about:
I (George) have checked and the issues are still present at
This obviously is related to #136 and JuliaLang/julia#21431
The text was updated successfully, but these errors were encountered: