-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
JuliaLang/julia
#23261Labels
sparseSparse arraysSparse arrays
Description
Currently, when you take the diagonal of a sparse matrix, you get a dense vector:
julia> S = sprand(10, 10, 0.1)
10×10 SparseMatrixCSC{Float64,Int64} with 10 stored entries:
[3 , 1] = 0.284124
[2 , 2] = 0.627361
[9 , 5] = 0.339561
[5 , 6] = 0.848555
[1 , 8] = 0.538286
[3 , 8] = 0.703678
[5 , 8] = 0.0960039
[8 , 8] = 0.00592429
[5 , 9] = 0.170894
[1 , 10] = 0.324079
julia> diag(S)
10-element Array{Float64,1}:
0.0
0.627361
0.0
0.0
0.0
0.0
0.0
0.00592429
0.0
0.0This should arguably be a sparse vector since for a generic sparse matrix, the diagonal is sparse.
Metadata
Metadata
Assignees
Labels
sparseSparse arraysSparse arrays