Skip to content

Commit eca5218

Browse files
Make inverting a PDSparseMat throw an error
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).
1 parent 9e1d882 commit eca5218

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pdsparsemat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151

5252
### Algebra
5353

54-
Base.inv(a::PDSparseMat{T}) where {T<:Real} = PDMat( a\eye(T,a.dim) )
54+
Base.inv(a::PDSparseMat{T}) where {T<:Real} = PDMat(inv(a.mat))
5555
LinearAlgebra.logdet(a::PDSparseMat) = logdet(a.chol)
5656

5757
### whiten and unwhiten

0 commit comments

Comments
 (0)