Artificial intelligent assistant

Simplest way of creating a positive (semi-) definite matrix? I want to construct an arbitrary $n\times n$ positive semi-definite matrix. Maybe I can randomly create an $n\times m$ matrix and use its covariance matrix. But I want to know if there's any other (efficient) way of doing this? Thanks.

You can try if this way works out for you:

Create a diagonal Matrix $M$ with diagonal entries $(\geq) > 0$. Then take an invertible matrix $P$ and calculate $E = PMP^{-1}$, hence E and M are similar, hence E is also positive (semi-) definit. Using this way you have to worry about finding arbitrary invertible matrices. One way for that would be to do random elementary row/column operations to the identity matrix(for that you can create elementary matrices by random, which is an easy task).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy eb84d7fa37f92ba224cfa64d94fe1534