code: def test_geometric_mean_properties_check_invariance():
      n_matrices = 40
      n_features = 15
      spds = [
          random_spd(n_features, eig_min=1.0, cond=10.0, random_state=0)
          for _ in range(n_matrices)
      ]
  
      gmean = _geometric_mean(spds)
  
      # Invariance under reordering
      spds.reverse()
      spds.insert(0, spds[1])
      spds.pop(2)
      assert_array_almost_equal(_geometric_mean(spds), gmean)
  
      # Invariance under congruent transformation
      non_singular = random_non_singular(n_features, random_state=0)
      spds_cong = [
          non_singular.dot(spd).dot(non_singular.T) for spd in spds
      ]
      assert_array_almost_equal(
          _geometric_mean(spds_cong),
          non_singular.dot(gmean).dot(non_singular.T),
      )
  
      # Invariance under inversion
      spds_inv = [linalg.inv(spd) for spd in spds]
      init = linalg.inv(np.mean(spds, axis=0))
      assert_array_almost_equal(
          _geometric_mean(spds_inv, init=init), linalg.inv(gmean)
      )
  
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 16 for calling a global function with example usage: test_geometric_mean_properties_check_invariance() without return types