code: def _vector_to_sym_mat(vec):
      """Convert vector to a symmetric matrix.
  
      The upper triangle of the matrix (including the diagonal) will be filled
      with the values of the vector.
  
      Parameters
      ----------
      vec : list or 1d-array
          The vector to convert to a symmetric matrix.
  
      Returns
      -------
      mat : 2d-array
          The symmetric matrix.
  
      See Also
      --------
      _sym_mat_to_vector
      """
      dim = _n_dims_from_triu(len(vec))
      mat = np.zeros((dim, dim) + vec.shape[1:], dtype=vec.dtype)
  
      # Fill the upper triangle of the matrix
      mat[np.triu_indices(dim)] = vec
  
      # Fill out the lower tri (make conjugate to ensure matrix is hermitian)
      mat = mat + np.rollaxis(mat, 1).conj()
  
      # We counted the diagonal twice
      if np.issubdtype(mat.dtype, np.integer):
          mat[np.diag_indices(dim)] //= 2
      else:
          mat[np.diag_indices(dim)] /= 2
  
      return mat
  
imports: import copy
  import numbers
  import numpy
  from scipy.fft import rfftfreq
  from .._fiff.pick import _picks_to_idx, pick_channels
  from ..parallel import parallel_func
  from ..time_frequency.multitaper import _compute_mt_params, _csd_from_mt, _mt_spectra, _psd_from_mt_adaptive
  from ..utils import ProgressBar, _check_fname, _import_h5io_funcs, _validate_type, copy_function_doc_to_method_doc, logger, verbose, warn
  from ..viz.misc import plot_csd
  from .tfr import EpochsTFR, _cwt_array, _get_nfft, morlet
label_desc: Use image node_id 3 for calling a global function with example usage: _vector_to_sym_mat(vec) and returns: mat