You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a sparse matrix is multiplied elementwise by a dense one, the result remains sparse. I expect the same to happen when the sparse matrix is multiplied by an NxN view of a larger array. However, this does not seem to be the case.
Here is a minimal example:
using SparseArrays
A =sprand(10, 10, 0.1) # 10x10 sparse matrix
B =rand(10, 10, 10) # big dense array
C = B[:, :, 1] # 10x10 dense matrix
C_view =view(B, :, :, 1) # 10x10 view of Bprintln(typeof(A .* C)) # Output: SparseMatrixCSC{Float64, Int64}println(typeof(A .* C_view)) # Output: Matrix{Float64}
I am using julia v1.10.0 and SparseArrays v1.10.0
The text was updated successfully, but these errors were encountered:
rayegun
changed the title
In-place multiplication by a view of a dense matrix gives a dense matrix
In-place elementwise multiplication by a view of a dense matrix gives a dense matrix
Feb 7, 2024
rayegun
changed the title
In-place elementwise multiplication by a view of a dense matrix gives a dense matrix
Elementwise multiplication by a view of a dense matrix gives a dense matrix
Feb 7, 2024
When a sparse matrix is multiplied elementwise by a dense one, the result remains sparse. I expect the same to happen when the sparse matrix is multiplied by an NxN view of a larger array. However, this does not seem to be the case.
Here is a minimal example:
I am using julia
v1.10.0
and SparseArraysv1.10.0
The text was updated successfully, but these errors were encountered: