-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Showing sparse arrays in dictionaries #10257
Comments
Related performance issue with current implementation julia> @time a = sprandn(50_000, 100_000, 0.01);
elapsed time: 3.249520351 seconds (1474 MB allocated, 7.23% gc time in 5 pauses with 3 full sweep)
julia> D = Dict("a"=>a);
julia> @time display(D)
Dict{ASCIIString,Base.SparseMatrix.SparseMatrixCSC{Float64,Int64}} with 1 entry:
"a" => …
elapsed time: 72.493628928 seconds (29965 MB allocated, 4.88% gc time in 1291 pauses with 1 full sweep) |
Hah, yes, that's unfortunate. It's happening because sparse matrices print with a leading '\n'. It'd make sense for |
This is significantly better now, but still not ideal: julia> a
Dict{Any,Any} with 1 entry:
"sparse" => 5x5 sparse matrix with 5 Float64 entries:… |
Actually, it now matches dense matrices. Is there more you want done here? If so, either the title should change or it should be closed in favor of a more general printing issue. julia> a
Dict{Any,Any} with 2 entries:
"dense" => 5x5 Array{Float64,2}:…
"sparse" => 5x5 sparse matrix with 5 Float64 entries:… |
This is completely fine. I think we can close this specific issue. |
This is probably more general than sparse, but at least for the sparse matrix case, I would love to show something better than
...
. Something likem x n sparse matrix with nnz nonzeros
.The text was updated successfully, but these errors were encountered: