def wishartrand(nu, phi):
dim = phi.shape[0]
chol = cholesky(phi)
foo = np.zeros((dim, dim))
for i in range(dim):
for j in range(i + 1):
if i == j:
foo[i, j] = np.sqrt(chi2.rvs(nu - (i + 1) + 1))
else:
foo[i, j] = np.random.normal(0, 1)
return np.dot(chol, np.dot(foo, np.dot(foo.T, chol.T)))
评论列表
文章目录