code: def test_recurrence_matrix(n, k, width, sym, metric, self):
      srand()
      # Make a data matrix
      data = np.random.randn(3, n)
  
      D = librosa.segment.recurrence_matrix(
          data,
          k=k,
          width=width,
          sym=sym,
          axis=-1,
          metric=metric,
          self=self,
      )
  
      # First test for symmetry
      if sym:
          assert np.allclose(D, D.T)
  
      # Test for target-axis invariance
      D_trans = librosa.segment.recurrence_matrix(
          data.T,
          k=k,
          width=width,
          sym=sym,
          axis=0,
          metric=metric,
          self=self,
      )
      assert np.allclose(D, D_trans)
  
      # If not symmetric, test for correct number of links
      if not sym and k is not None:
          real_k = min(k, n - width)
          if self:
              real_k += 1
          assert not np.any(D.sum(axis=0) != real_k)
  
      if self:
          assert np.allclose(np.diag(D), True)
  
      # Make sure the +- width diagonal is hollow
      # It's easier to test if zeroing out the triangles leaves nothing
      idx = np.tril_indices(n, k=width)
  
      D[idx] = False
      D.T[idx] = False
      assert not np.any(D)
  
imports: from typing import Union
  import warnings
  import os
  import numpy
  import scipy
  from scipy.spatial.distance import cdist, pdist, squareform
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 10 for calling a global function with example usage: test_recurrence_matrix(n, k, width, sym, metric, ) without return types