I am trying to numerically verify that

A symmetric matrix \mathbf{A} is positive semidefinite if and only if it is a covariance matrix.

Then I need to verify in both directions, i.e.

- Given a positive semidefinite matrix \mathbf{A}, show that it is a covariance matrix.
- Given a covariance matrix, show that it is positive semidefinite.

However, I am not sure

- What properties should a matrix have to be a covariance matrix.
- I know I could generate a covariance matrix using the following and I know that
`cov`

is positive semidefinite if and only if all of its eigenvalues are non-negative. But it turns out that`minimum(eigvals(cov))`

is a negative number close to 0 (on the order \sim 10^{-15}), I am not sure if I could conclude that`cov`

is positive semidefinite since numerical reasons.

```
n = 100
u = randn(n);
cov = u * u'
```

Any input will be appreciated.