code: def test_sym_matrix_to_vec_is_the_inverse_of_vec_to_sym_matrix(rng):
      n = 5
      p = n * (n + 1) // 2
  
      # when diagonal is included
      vec = rng.random(p)
      sym = vec_to_sym_matrix(vec)
  
      assert_array_almost_equal(sym_matrix_to_vec(sym), vec)
  
      # when diagonal given separately
      diagonal = rng.random(n + 1)
      sym = vec_to_sym_matrix(vec, diagonal=diagonal)
  
      assert_array_almost_equal(
          sym_matrix_to_vec(sym, discard_diagonal=True), vec
      )
  
      # multiple matrices case when diagonal is included
      vecs = np.asarray([vec, 2.0 * vec, 0.5 * vec])
      syms = vec_to_sym_matrix(vecs)
  
      assert_array_almost_equal(sym_matrix_to_vec(syms), vecs)
  
      # multiple matrices case when diagonal is given separately
      diagonals = np.asarray([diagonal, 3.0 * diagonal, -diagonal])
      syms = vec_to_sym_matrix(vecs, diagonal=diagonals)
  
      assert_array_almost_equal(
          sym_matrix_to_vec(syms, discard_diagonal=True), vecs
      )
  
imports: import copy
  import warnings
  from math import cosh, exp, log, sinh, sqrt
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from pandas import DataFrame
  from scipy import linalg
  from sklearn.covariance import EmpiricalCovariance, LedoitWolf
  from nilearn._utils.extmath import is_spd
  from nilearn.connectome.connectivity_matrices import ConnectivityMeasure, _check_spd, _check_square, _form_symmetric, _geometric_mean, _map_eigenvalues, prec_to_partial, sym_matrix_to_vec, vec_to_sym_matrix
  from nilearn.tests.test_signal import generate_signals
label_desc: Use image node_id 24 for calling a global function with example usage: test_sym_matrix_to_vec_is_the_inverse_of_vec_to_sym_matrix(rng) without return types