code: def test_index_numba(ndim: int, batch_size: int):
      try:
          from numba import cfunc, types, carray
      except ImportError:
          return
  
      # Showcases how to use Numba to JIT-compile similarity measures for USearch.
      # https://numba.readthedocs.io/en/stable/reference/jit-compilation.html#c-callbacks
      signature_two_args = types.float32(
          types.CPointer(types.float32),
          types.CPointer(types.float32),
      )
      signature_three_args = types.float32(
          types.CPointer(types.float32),
          types.CPointer(types.float32),
          types.uint64,
      )
      signature_four_args = types.float32(
          types.CPointer(types.float32),
          types.uint64,
          types.CPointer(types.float32),
          types.uint64,
      )
  
      @cfunc(signature_two_args)
      def python_inner_product_two_args(a, b):
          a_array = carray(a, ndim)
          b_array = carray(b, ndim)
          c = 0.0
          for i in range(ndim):
              c += a_array[i] * b_array[i]
          return 1 - c
  
      @cfunc(signature_three_args)
      def python_inner_product_three_args(a, b, ndim):
          a_array = carray(a, ndim)
          b_array = carray(b, ndim)
          c = 0.0
          for i in range(ndim):
              c += a_array[i] * b_array[i]
          return 1 - c
  
      functions = [
          python_inner_product_two_args,
          python_inner_product_three_args,
      ]
      signatures = [
          MetricSignature.ArrayArray,
          MetricSignature.ArrayArraySize,
      ]
      for function, signature in zip(functions, signatures):
          metric = CompiledMetric(
              pointer=function.address,
              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 1 for calling a global function with example usage: test_index_numba(ndim, batch_size) and returns: unknown, unknown