Skip to content
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

sparse .* rowvec is dense #20954

Closed
JeffBezanson opened this issue Mar 9, 2017 · 1 comment · Fixed by #20959
Closed

sparse .* rowvec is dense #20954

JeffBezanson opened this issue Mar 9, 2017 · 1 comment · Fixed by #20959
Labels
sparse Sparse arrays

Comments

@JeffBezanson
Copy link
Member

but sparse .* vec gives sparse:

julia> m = sprand(5,5,.2)
5×5 SparseMatrixCSC{Float64,Int64} with 4 stored entries:
  [1, 1]  =  0.553674
  [3, 1]  =  0.431147
  [5, 1]  =  0.324723
  [1, 3]  =  0.248959

julia> v = rand(5);

julia> m .* v'
5×5 Array{Float64,2}:
 0.419685  0.0  0.178785  0.0  0.0
 0.0       0.0  0.0       0.0  0.0
 0.32681   0.0  0.0       0.0  0.0
 0.0       0.0  0.0       0.0  0.0
 0.24614   0.0  0.0       0.0  0.0

julia> m .* v
5×5 SparseMatrixCSC{Float64,Int64} with 4 stored entries:
  [1, 1]  =  0.419685
  [3, 1]  =  0.309619
  [5, 1]  =  0.261807
  [1, 3]  =  0.188711

In 0.5 they both give sparse.

@JeffBezanson JeffBezanson added the sparse Sparse arrays label Mar 9, 2017
@pabloferz
Copy link
Contributor

pabloferz commented Mar 9, 2017

#20102 should fix this, but it needs more discussion. I could take out the bits that would solve this issue and submit a separate PR though (by could I mean will).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sparse Sparse arrays
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants