Thank you, odow! Actually, I use Julia JuMP. I am confused about how to realize the constraint ci’Xci>=0. X here is a large sparse matrix. The dimension of X is 1512*1512.
Q=sparse(eigvecs(Y)) //Y is value of variable X
if P[i]<=-1.0e-5 // P[i] is the ith eigenvalue of X
@constraint(model, Q[:,i]'*X*Q[:,i]>=0) //(Q[:,i] is the ith eigenvector of X)
When I run this code, I got this “Warning: The addition operator has been used on JuMP expressions a large number of times. This warning is safe to ignore but may indicate that model generation is slower than necessary. For performance reasons, you should not add expressions in a loop. Instead of x += , use append!(x,y) to modify x in place. Uf y is a single variable, you may also use push!(x, coef, y) in place of x += coef*y”.
Anyway to avoid this? Thanks!