I am trying to compute a matrix that will be used for a convex optimisation problem. I have got an error back that

the matrix must be positive or negative semidefinite.

so my question is how I can be sure when I create the matrix that I will be positive or negative semidefinite?

thank you for your help,