def sample(self): """Returns a Gaussian, drawn from this prior.""" d = self.mu.shape[0] wishart = Wishart(d) gaussian = Gaussian(d) ret = Gaussian(d) wishart.setDof(self.n) wishart.setScale(self.getLambda()) ret.setPrecision(wishart.sample()) gaussian.setPrecision(self.k * ret.getPrecision()) gaussian.setMean(self.mu) ret.setMean(gaussian.sample()) return ret