covariance matrices are generally positive semidefinite. in realcomputation involving sample data, however, numerical errors can causethe sample covariance matrix to be negative semidefinite. In that case,you can calculate the square root of the sample covariance matrixdirectly first and then compute the sample covariance matrix, tomaintain the positivity.
however if you are concerned about rank-deficiency of the covariancematrix, there are quite a few reduced-rank subspace methods (i.e.eigenvalue decomposition) that can be helpful, so that you only dealwith the principle components ( this can be found in any multivariablestatistical analysis textbooks).