diff --git a/src/parameters_matrix.jl b/src/parameters_matrix.jl index d4ced00..55ec0d5 100644 --- a/src/parameters_matrix.jl +++ b/src/parameters_matrix.jl @@ -98,7 +98,7 @@ struct PositiveDefinite{TL<:AbstractVector{<:Real},Tε<:Real} <: AbstractParamet ε::Tε end -Base.:(==)(X::PositiveDefinite, Y::PositiveDefinite) = X.L == Y.L +Base.:(==)(X::PositiveDefinite, Y::PositiveDefinite) = X.L == Y.L && X.ε == Y.ε value(X::PositiveDefinite) = A_At(vec_to_tril(X.L)) + X.ε * I diff --git a/test/parameters_matrix.jl b/test/parameters_matrix.jl index 4f17751..ae86e8c 100644 --- a/test/parameters_matrix.jl +++ b/test/parameters_matrix.jl @@ -61,6 +61,8 @@ using ParameterHandling: vec_to_tril, tril_to_vec @test isposdef(value(X)) X.L .= 0 # zero the unconstrained value @test isposdef(value(X)) + @test X != positive_definite(X_mat) + @test positive_definite(X_mat, 1e-3) != positive_definite(X_mat, 1e-2) @test_throws ArgumentError positive_definite(zeros(3, 3)) @test_throws ArgumentError positive_definite(X_mat, 0.0) test_parameter_interface(X)