docs: def logpdf_diagonal_gaussian(self, x, mean, cov):
          '''
          Compute logpdf of a multivariate Gaussian distribution with diagonal covariance at a given point x.
          A multivariate Gaussian distribution with a diagonal covariance is equivalent
          to a collection of independent Gaussian random variables.
  
          x should be a sparse matrix. The logpdf will be computed for each row of x.
          mean and cov should be given as 1D numpy arrays
          mean[i] : mean of i-th variable
          cov[i] : variance of i-th variable'''
  
          n = x.shape[0]
          dim = x.shape[1]
          assert(dim == len(mean) and dim == len(cov))
  
          # multiply each i-th column of x by (1/(2*sigma_i)), where sigma_i is sqrt of variance of i-th variable.
          scaled_x = x.dot(self.diag(1./(2*np.sqrt(cov))) )
          # multiply each i-th entry of mean by (1/(2*sigma_i))
          scaled_mean = mean/(2*np.sqrt(cov))
  
          # sum of pairwise squared Eulidean distances gives SUM[(x_i - mean_i)^2/(2*sigma_i^2)]
          return -np.sum(np.log(np.sqrt(2*np.pi*cov))) - pairwise_distances(scaled_x, [scaled_mean], 'euclidean').flatten()**2