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

[Breaking] Make inverting a PDSparseMat throw an error #119

Merged
merged 1 commit into from Sep 19, 2020

Conversation

ElOceanografo
Copy link
Contributor

Alter the inv() method for PDSparseMat to fall through to the inv() method of its underlying matrix. If that is a SparseMatrixCSC, an error will be thrown asking the user to convert to a dense matrix first (the default behavior in LinearAlgebra). This would address #87.

I considered writing a more PDMats-specific error message (e.g. "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, for instance using inv(PDMat(Matrix(J)))". However, making the method fall through to whatever is defined for the underlying matrix type allows for the possibility someone will one day write a sparse matrix type that does have a sparse inverse. In that case, inverting a PDSparseMat wrapping such a matrix will "just work."

Alter the inv() method for PDSparseMat to fall through to the inv() method of its underlying matrix.  If that is a SparseMatrixCSC, an error will be thrown asking the user to convert to a dense matrix first (the default behavior in LinearAlgebra).
@andreasnoack andreasnoack changed the title Make inverting a PDSparseMat throw an error [Breaking] Make inverting a PDSparseMat throw an error Sep 19, 2020
@andreasnoack andreasnoack merged commit d50e35a into JuliaStats:master Sep 19, 2020
@ararslan ararslan mentioned this pull request Mar 1, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants