def _compute_log_det_cholesky(matrix_chol, covariance_type, n_features):
 if (covariance_type == 'full'):
  (n_components, _, _) = matrix_chol.shape
  log_det_chol = np.sum(np.log(matrix_chol.reshape(n_components, (-1))[:, ::(n_features + 1)]), 1)
 elif (covariance_type == 'tied'):
  log_det_chol = np.sum(np.log(np.diag(matrix_chol)))
 elif (covariance_type == 'diag'):
  log_det_chol = np.sum(np.log(matrix_chol), axis=1)
 else:
  log_det_chol = (n_features * np.log(matrix_chol))
 return log_det_chol

def _compute_log_det_cholesky ( matrix_chol , covariance_type , n_features ) : if ( covariance_type == 'full' ) : ( n_components , _ , _ ) = matrix_chol . shape log_det_chol = np . sum ( np . log ( matrix_chol . reshape ( n_components , ( - 1 ) ) [ : , : : ( n_features + 1 ) ] ) , 1 ) elif ( covariance_type == 'tied' ) : log_det_chol = np . sum ( np . log ( np . diag ( matrix_chol ) ) ) elif ( covariance_type == 'diag' ) : log_det_chol = np . sum ( np . log ( matrix_chol ) , axis = 1 ) else : log_det_chol = ( n_features * np . log ( matrix_chol ) ) return log_det_chol
compute the log-det of the cholesky decomposition of matrices .