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

MemoryError in inv(SparseMatrixCSC) #5166

Closed
acroy opened this issue Dec 16, 2013 · 3 comments
Closed

MemoryError in inv(SparseMatrixCSC) #5166

acroy opened this issue Dec 16, 2013 · 3 comments

Comments

@acroy
Copy link
Contributor

acroy commented Dec 16, 2013

Using inv with a sparse matrix gives

julia> inv(speye(2,2))
ERROR: no method MemoryError(ASCIIString)
 in inv at linalg/sparse.jl:489

since MemoryError doesn't have a string property.
In any case, instead of throwing an exception I would suggest

inv(A::SparseMatrixCSC) = error("The inverse of a sparse matrix can often be dense and can cause the computer to run out of memory. If you are sure you have enough memory, please convert your matrix to a dense matrix.")

IMHO, an MemoryError should only be thrown if it is clear that there will not be enough memory. Here the functionality is simply not implemented, so an error would be more appropriate.

@ivarne
Copy link
Sponsor Member

ivarne commented Dec 16, 2013

This will probably be fixed when #4744 gets addressed.

I am sure you can get a Pull Request approved as a temporary fix for this, but if do not want attribution, someone else will definitely do it pretty quickly. Make sure to add a comment about MemoryError, so that it will be found when somebody adds a msg field to MemoryError

@magistere
Copy link
Contributor

Fully agree with @acroy that here error is more appropriate.

@StefanKarpinski
Copy link
Sponsor Member

cc: @ViralBShah

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

No branches or pull requests

4 participants