code: def from_tri_2_sym(tri, dim):
      
      symm = np.zeros((dim, dim))
      symm[np.triu_indices(dim)] = tri
      return symm
docs: convert a upper triangular matrix in 1D format
         to 2D symmetric matrix
  
  
      Parameters
      ----------
  
      tri: 1D array
          Contains elements of upper triangular matrix
  
      dim : int
          The dimension of target matrix.
  
  
      Returns
      -------
  
      symm : 2D array
          Symmetric matrix in shape=[dim, dim]