code: def test_index_cppyy(ndim: int, batch_size: int):
      try:
          import cppyy
          import cppyy.ll
      except ImportError:
          return
  
      cppyy.cppdef(
          """
      float inner_product_two_args(float *a, float *b) {
          float result = 0;
      #pragma unroll
          for (size_t i = 0; i != ndim; ++i)
              result += a[i] * b[i];
          return 1 - result;
      }
      
      float inner_product_three_args(float *a, float *b, size_t n) {
          float result = 0;
          for (size_t i = 0; i != n; ++i)
              result += a[i] * b[i];
          return 1 - result;
      }
      
      float inner_product_four_args(float *a, size_t an, float *b, size_t) {
          float result = 0;
          for (size_t i = 0; i != an; ++i)
              result += a[i] * b[i];
          return 1 - result;
      }
      """.replace(
              "ndim", str(ndim)
          )
      )
  
      functions = [
          cppyy.gbl.inner_product_two_args,
          cppyy.gbl.inner_product_three_args,
          # cppyy.gbl.inner_product_four_args,
      ]
      signatures = [
          MetricSignature.ArrayArray,
          MetricSignature.ArrayArraySize,
          # MetricSignature.ArraySizeArraySize,
      ]
      for function, signature in zip(functions, signatures):
          metric = CompiledMetric(
              pointer=cppyy.ll.addressof(function),
              kind=MetricKind.IP,
              signature=signature,
          )
          index = Index(ndim=ndim, metric=metric)
  
          keys = np.arange(batch_size)
          vectors = random_vectors(count=batch_size, ndim=ndim)
  
          index.add(keys, vectors)
          matches = index.search(vectors, 10)
          assert len(matches) == batch_size
  
imports: import pytest
  import numpy
  from usearch.eval import random_vectors
  from usearch.index import Index, MetricKind, MetricSignature, CompiledMetric
label_desc: Use image node_id 2 for calling a global function with example usage: test_index_cppyy(ndim, batch_size) without return types