code: def test_sym_mat_to_vector():
      """Test converting between vectors and symmetric matrices."""
      mat = np.array(
          [[0, 1, 2, 3], [1, 4, 5, 6], [2, 5, 7, 8], [3, 6, 8, 9]]
      )
      assert_array_equal(
          _sym_mat_to_vector(mat), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
      )
  
      vec = np.arange(10)
      assert_array_equal(
          _vector_to_sym_mat(vec),
          [[0, 1, 2, 3], [1, 4, 5, 6], [2, 5, 7, 8], [3, 6, 8, 9]],
      )
  
      # Test complex values: diagonals should be complex conjugates
      comp_vec = np.arange(3) + 1j
      assert_array_equal(
          _vector_to_sym_mat(comp_vec),
          [[0.0 + 0.0j, 1.0 + 1.0j], [1.0 - 1.0j, 2.0 + 0.0j]],
      )
  
      # Test preservation of data type
      assert _sym_mat_to_vector(mat.astype(np.int8)).dtype == np.int8
      assert _vector_to_sym_mat(vec.astype(np.int8)).dtype == np.int8
      assert (
          _sym_mat_to_vector(mat.astype(np.float16)).dtype == np.float16
      )
      assert (
          _vector_to_sym_mat(vec.astype(np.float16)).dtype == np.float16
      )
  
imports: import pickle
  from itertools import product
  from os import path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from pytest import raises
  import mne
  from mne.channels import equalize_channels
  from mne.proj import Projection
  from mne.time_frequency import CrossSpectralDensity, csd_array_fourier, csd_array_morlet, csd_array_multitaper, csd_fourier, csd_morlet, csd_multitaper, csd_tfr, pick_channels_csd, read_csd, tfr_morlet
  from mne.time_frequency.csd import _sym_mat_to_vector, _vector_to_sym_mat
  from mne.utils import sum_squared
label_desc: Use image node_id 11 for calling a global function with example usage: test_sym_mat_to_vector() without return types