code: def bootstrapping_count_matrix(Ct, nbs=10000):
      
      # Get the number of states:
      N = Ct.shape[0]
      # Get the number of transition pairs:
      T = Ct.sum()
      # Reshape and normalize the count matrix:
      p = Ct.toarray()
      p = np.reshape(p, (N*N,)).astype(np.float)
      p = p / T
      # Perform the bootstrapping:
      svals = np.zeros((nbs, N))
      for s in range(nbs):
          # Draw sample:
          sel = np.random.multinomial(T, p)
          # Compute the count-matrix:
          sC = np.reshape(sel, (N, N))
          # Compute singular values:
          svals[s, :] = scl.svdvals(sC)
      # Compute mean and uncertainties:
      smean = np.mean(svals, axis=0)
      sdev = np.std(svals, axis=0)
  
      return smean, sdev
docs: Perform bootstrapping on trajectories to estimate uncertainties for singular values of count matrices.
  
      Parameters
      ----------
      Ct : csr-matrix
          count matrix of the data.
  
      nbs : int, optional
          the number of re-samplings to be drawn from dtrajs
  
      Returns
      -------
      smean : ndarray(N,)
          mean values of singular values
      sdev : ndarray(N,)
          standard deviations of singular values