code: def kl_loss(covariance, precision):
      
      assert covariance.shape == precision.shape
      dim, _ = precision.shape
      logdet_p_dot_c = fast_logdet(np.dot(precision, covariance))
      return 0.5 * (np.sum(precision * covariance) - logdet_p_dot_c - dim)
docs: Computes the KL divergence between precision estimate and
      reference covariance.
  
      The loss is computed as:
  
          Trace(Theta_1 * Sigma_0) - log(Theta_0 * Sigma_1) - dim(Sigma)
  
      Parameters
      ----------
      covariance : 2D ndarray (n_features, n_features)
          Maximum Likelihood Estimator of covariance
  
      precision : 2D ndarray (n_features, n_features)
          The precision matrix of the covariance model to be tested
  
      Returns
      -------
      KL-divergence