code: def sparse_ll_dirichlet(ind1, data1, ind2, data2):
      # The probability of rolling data2 in sum(data2) trials on a die that rolled data1 in sum(data1) trials
      n1 = np.sum(data1)
      n2 = np.sum(data2)
  
      if n1 == 0 and n2 == 0:
          return 0.0
      elif n1 == 0 or n2 == 0:
          return 1e8
  
      log_b = 0.0
      i1 = 0
      i2 = 0
      while i1 < ind1.shape[0] and i2 < ind2.shape[0]:
          j1 = ind1[i1]
          j2 = ind2[i2]
  
          if j1 == j2:
              if data1[i1] * data2[i2] != 0:
                  log_b += log_beta(data1[i1], data2[i2])
              i1 += 1
              i2 += 1
          elif j1 < j2:
              i1 += 1
          else:
              i2 += 1
  
      self_denom1 = 0.0
      for d1 in data1:
          self_denom1 += log_single_beta(d1)
  
      self_denom2 = 0.0
      for d2 in data2:
          self_denom2 += log_single_beta(d2)
  
      return np.sqrt(
          1.0
          / n2
          * (
              log_b
              - log_beta(n1, n2)
              - (self_denom2 - log_single_beta(n2))
          )
          + 1.0
          / n1
          * (
              log_b
              - log_beta(n2, n1)
              - (self_denom1 - log_single_beta(n1))
          )
      )
  
imports: from __future__ import print_function
  import locale
  import numba
  import numpy
  from umap.utils import norm
label_desc: Use image node_id 30 for calling a global function with example usage: sparse_ll_dirichlet(ind1, data1, ind2, data2) and returns: np, int, int