class_docstr: A utility class for PLDA class used for statistics calculations.
  
  This is also used to pack deep embeddings and meta-information in one object.
  
  Arguments
  ---------
  modelset : list
      List of model IDs for each session as an array of strings.
  segset : list
      List of session IDs as an array of strings.
  start : int
      Index of the first frame of the segment.
  stop : int
      Index of the last frame of the segment.
  stat0 : tensor
      An ndarray of float64. Each line contains 0-th order statistics
      from the corresponding session.
  stat1 : tensor
      An ndarray of float64. Each line contains 1-st order statistics
      from the corresponding session.
docstr: Whiten first-order statistics
  If sigma.ndim == 1, case of a diagonal covariance.
  If sigma.ndim == 2, case of a single Gaussian with full covariance.
  If sigma.ndim == 3, case of a full covariance UBM.
  
  Arguments
  ---------
  mu : array
      Mean vector to be subtracted from the statistics.
  sigma : narray
      Co-variance matrix or covariance super-vector.
  isSqrInvSigma : bool
      True if the input Sigma matrix is the inverse of the square root of a covariance matrix.
docstr_tok: ["Whiten","first-order","statistics","If","sigma.ndim","==","1",",","case","of","a","diagonal","covariance",".","If","sigma.ndim","==","2",",","case","of","a","single","Gaussian","with","full","covariance",".","If","sigma.ndim","==","3",",","case","of","a","full","covariance","UBM",".","Arguments","--","--","--","--","-","mu",":","array","Mean","vector","to","be","subtracted","from","the","statistics",".","sigma",":","narray","Co-variance","matrix","or","covariance","super-vector",".","isSqrInvSigma",":","bool","True","if","the","input","Sigma","matrix","is","the","inverse","of","the","square","root","of","a","covariance","matrix","."]
code: def whiten_stat1(self, mu, sigma, isSqrInvSigma=False):
      """Whiten first-order statistics
      If sigma.ndim == 1, case of a diagonal covariance.
      If sigma.ndim == 2, case of a single Gaussian with full covariance.
      If sigma.ndim == 3, case of a full covariance UBM.
  
      Arguments
      ---------
      mu : array
          Mean vector to be subtracted from the statistics.
      sigma : narray
          Co-variance matrix or covariance super-vector.
      isSqrInvSigma : bool
          True if the input Sigma matrix is the inverse of the square root of a covariance matrix.
      """
  
      if sigma.ndim == 1:
          self.center_stat1(mu)
          self.stat1 = self.stat1 / numpy.sqrt(sigma.astype(STAT_TYPE))
  
      elif sigma.ndim == 2:
          # Compute the inverse square root of the co-variance matrix Sigma
          sqr_inv_sigma = sigma
  
          if not isSqrInvSigma:
              # eigen_values, eigen_vectors = scipy.linalg.eigh(sigma)
              eigen_values, eigen_vectors = linalg.eigh(sigma)
              ind = eigen_values.real.argsort()[::-1]
              eigen_values = eigen_values.real[ind]
              eigen_vectors = eigen_vectors.real[:, ind]
  
              sqr_inv_eval_sigma = 1 / numpy.sqrt(eigen_values.real)
              sqr_inv_sigma = numpy.dot(
                  eigen_vectors, numpy.diag(sqr_inv_eval_sigma)
              )
          else:
              pass
  
          # Whitening of the first-order statistics
          self.center_stat1(mu)  # CENTERING
          self.rotate_stat1(sqr_inv_sigma)
  
      elif sigma.ndim == 3:
          # we assume that sigma is a 3D ndarray of size D x n x n
          # where D is the number of distributions and n is the dimension of a single distribution
          n = self.stat1.shape[1] // self.stat0.shape[1]
          sess_nb = self.stat0.shape[0]
          self.center_stat1(mu)
          self.stat1 = (
              numpy.einsum(
                  "ikj,ikl->ilj",
                  self.stat1.T.reshape(-1, n, sess_nb),
                  sigma,
              )
              .reshape(-1, sess_nb)
              .T
          )
  
      else:
          raise Exception("Wrong dimension of Sigma, must be 1 or 2")
  
imports: import numpy
  import copy
  import pickle
  from scipy import linalg
label_desc: Use image node_id 15 for calling the StatObject_SB obj's underlying member method code with example usage: obj.whiten_stat1(mu, sigma, isSqrInvSigma) without return types