The solution of Semidefinite Programming (SDP) violates the constraints

I try to solve a SDP, the result shows that the solution is feasible and optimal, but when I substitute the obtained solution back into the constraints, I find it violates many constraints.

using JuMP, MosekTools, LinearAlgebra, Random
n = 3
Q = rand(-50:50,n,n)
c = rand(-50:50,n)
l = zeros(n)
u = ones(n)
SemiDP = Model(with_optimizer(Mosek.Optimizer))
@variable(SemiDP, X[1:n,1:n])
@variable(SemiDP, x[1:n])
@objective(SemiDP, Min, dot(Q,X)+c'*x)
@constraint(SemiDP, x*u'-X .>= 0) 
@constraint(SemiDP, X.>=0) 
@SDconstraint(SemiDP, [1 x'; x X]>=0)
println("termination_status:", termination_status(SemiDP))

It shows the solution is optimal and primal feasible, but when I substitute the solution into the constraints:

value.(x)*u'-value.(X) .>= 0
eigvals([1 value.(x)'; value.(x) value.(X)]) #to see if the matrix is Semidefinite

I find it violates many constraints, e.g. some bool values are 0, and some eigenvalues are negative. Could anybody give some ideas on how the problem comes?

Here is what I get

julia> value.(x)*u'-value.(X)
3×3 Matrix{Float64}:
  4.63377e-10  -2.53719e-10  1.44575e-9
  3.61053e-10  -2.6613e-10   2.56338e-9
 -3.33895e-10   1.68968e-10  1.42857e-11

julia> eigvals([1 value.(x)'; value.(x) value.(X)])
4-element Vector{Float64}:

The biggest violation for the first constraint is -2.53719e-10 and the biggest for the second is -3.4264861390395915e-10 which is within the tolerance so I don’t think there is any issue.


Thanks for your reply, I missed the point you talk about.