code: def from_sym_2_tri(symm):
      
  
      inds = np.triu_indices_from(symm)
      tri = symm[inds]
      return tri
docs: convert a 2D symmetric matrix to an upper
         triangular matrix in 1D format
  
      Parameters
      ----------
  
      symm : 2D array
            Symmetric matrix
  
  
      Returns
      -------
  
      tri: 1D array
            Contains elements of upper triangular matrix