diff --git a/ext/PDMatsSparseArraysExt/pdsparsemat.jl b/ext/PDMatsSparseArraysExt/pdsparsemat.jl index f6bef3f..129a33b 100644 --- a/ext/PDMatsSparseArraysExt/pdsparsemat.jl +++ b/ext/PDMatsSparseArraysExt/pdsparsemat.jl @@ -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 diff --git a/src/pdmat.jl b/src/pdmat.jl index 484f40c..82d63c2 100644 --- a/src/pdmat.jl +++ b/src/pdmat.jl @@ -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))