I am trying to optimize using a non-positive-definite covariance matrix. So I computed the eigenvalues and vectors in matlab using eigen(C). Then I removed the zero and negative eigenvalues and their corresponding vectors. Then recomputed Cadj (the adjusted C) using V*D*V' where V and D are the adjusted eigenvectors and eigenvalues respectively. I test positive definiteness using p from [R,p] = chol(Cadj), and it is still not positive definite. Am I doing something wrong?