We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As the subject says, when I try to scale the values of a large sparse matrix using .*, a dense matrix is built, and OutOfMemoryError() is raised!
.*
OutOfMemoryError()
For instance,
n = 10_000_000 v = rand(n) A = sprand(n,n,2/n) v .* A # ERROR: OutOfMemoryError() A .* v' # ERROR: OutOfMemoryError()
Using Diagonal or spdiagm will do the computation,
Diagonal
spdiagm
julia> @btime $A * Diagonal($v); 97.998 ms (6 allocations: 381.50 MiB) julia> @btime Diagonal($v) * $A; 134.449 ms (6 allocations: 381.50 MiB) julia> @btime spdiagm($v) * $A; 1.794 s (31 allocations: 1.31 GiB) julia> @btime $A * spdiagm($v); 522.747 ms (31 allocations: 1.31 GiB)
where spdiagm(v) forms a sparse diagonal matrix at a great expense in time and space.
spdiagm(v)
See discussion here
The text was updated successfully, but these errors were encountered:
This is related to a previous issue
Sorry, something went wrong.
No branches or pull requests
As the subject says, when I try to scale the values of a large sparse matrix using
.*
, a dense matrix is built, andOutOfMemoryError()
is raised!For instance,
Using
Diagonal
orspdiagm
will do the computation,where
spdiagm(v)
forms a sparse diagonal matrix at a great expense in time and space.See discussion here
The text was updated successfully, but these errors were encountered: