Python: Sample from multivariate normal with N means and same covariance matrix
问题 Suppose I want to sample 10 times from multiple normal distributions with the same covariance matrix (identity) but different means, which are stored as rows of the following matrix: means = np.array([[1, 5, 2], [6, 2, 7], [1, 8, 2]]) How can I do that in the most efficient way possible (i.e. avoiding loops) I tried like this: scipy.stats.multivariate_normal(means, np.eye(2)).rvs(10) and np.random.multivariate_normal(means, np.eye(2)) But they throw an error saying mean should be 1D. Slow