Closed devmotion closed 2 years ago
maybe I should add at least the failing examples for isposdef?
Which are they? I think it would be good to add trivial tests. I'm not sure how to test anything non-trivial here since you can't construct the instances if the matrix isn't Hermitian and positive definite.
I thought about the failing examples in https://github.com/JuliaStats/PDMats.jl/issues/121.
Ah. Yes, it would probably be good to add them.
Bump 🙂
LGTM, @andreasnoack ?
What is the thinking about the case PDiagMat([0.0, 0.0])? I also thinking about the consequences of allowing the zero matrix for PDMat since I have usecase where it would be handy.
My impression was that PDMats (so far) is not designed to work with positive semi-definite matrices, and therefore https://github.com/invenia/PDMatsExtras.jl was created. But maybe it would still be better to define isposdef
only for PDMat, PDiagMat and ScalMat but not AbstractPDMat? It would also avoid the incorrect default isposdef(::PSDMat) = true
.
This PR adds generic definitions of
LinearAlgebra.isposdef
andLinearAlgebra.ishermitian
. It also removesBase.eltype
andBase.ndims
definitions which are not needed anymore sinceAbstractPDMat{T} <: AbstractMatrix{T}
.Fixes https://github.com/JuliaStats/PDMats.jl/issues/121. Fixes https://github.com/JuliaStats/PDMats.jl/issues/118.
I am not completely sure what's the best way to test these definitions (in particular
ishermitian
) - maybe I should add at least the failing examples forisposdef
?