title: Positive semi-definite error when sampling from multivariate norm in python?
body: <p>NB: this problem actually happens inside tensorflow, and results in samples not exactly from the true pdf. The principle is, however, the same in numpy, and my aim is to understand the following warning. </p>
  
  <p>Namely, I am trying to sample from a multivariate normal in python. That is</p>
  
  <pre><code>np.random.multivariate_normal(mean = some_mean_vector, cov = some_cov_matrix)
  </code></pre>
  
  <p>Of course, any valid covariance matrix must be positive semi-definite. However, some covariance matrices used for sampling (that pass every test for positive semi-definiteness), give the following warning</p>
  
  <pre><code>/usr/local/lib/python3.6/site-packages/ipykernel/__main__.py:1: RuntimeWarning: covariance is not positive-semidefinite.
  </code></pre>
  
  <p>One such matrix is</p>
  
  <pre><code>A = array([[  1.00000359e-01,  -3.66802835e+00],[ -3.66802859e+00,   1.34643845e+02]], dtype=float32)
  </code></pre>
  
  <p>for which I can find both the cholesky decomposition and eigenvalues without warning (the smallest eigenvalue is 7.42144039e-05). </p>
  
  <p>Can anyone help and tell me why this might be happening?  </p>
  
  <p>(In tensorflow, I just feed the cholesky decomposition of the above matrix, and receive inexact samples, which messes up everything I'm trying to do). </p>