Skip to content

Commit

Permalink
Specialize sqrt for PDSparseMat
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Nov 22, 2023
1 parent dca9273 commit 33a80f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ext/PDMatsSparseArraysExt/pdsparsemat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Base.:/(x::AbstractVecOrMat{T}, a::PDSparseMat{T}) where {T<:Real} = convert(Arr

Base.inv(a::PDSparseMat) = PDMat(inv(a.mat))
LinearAlgebra.cholesky(a::PDSparseMat) = a.fact
Base.sqrt(A::PDSparseMat) = PDMat(sqrt(Hermitian(Matrix(A))))

### whiten and unwhiten

Expand Down
2 changes: 1 addition & 1 deletion src/pdmat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ LinearAlgebra.det(a::PDMat) = det(a.fact)
LinearAlgebra.logdet(a::PDMat) = logdet(a.fact)
LinearAlgebra.eigmax(a::PDMat) = eigmax(a.mat)
LinearAlgebra.eigmin(a::PDMat) = eigmin(a.mat)
LinearAlgebra.sqrt(A::PDMat) = PDMat(sqrt(Hermitian(A.mat)))
Base.sqrt(A::PDMat) = PDMat(sqrt(Hermitian(A.mat)))

function Base.kron(A::PDMatCholesky, B::PDMatCholesky)
return PDMat(kron(A.mat, B.mat), Cholesky(kron(A.fact.U, B.fact.U), 'U', A.fact.info))
Expand Down

0 comments on commit 33a80f3

Please sign in to comment.