code: def sparse_sum(ind1, data1, ind2, data2):
      result_size = ind1.shape[0] + ind2.shape[0]
      result_ind = np.zeros(result_size, dtype=np.int32)
      result_data = np.zeros(result_size, dtype=np.float32)
  
      i1 = 0
      i2 = 0
      nnz = 0
  
      # pass through both index lists
      while i1 < ind1.shape[0] and i2 < ind2.shape[0]:
          j1 = ind1[i1]
          j2 = ind2[i2]
  
          if j1 == j2:
              val = data1[i1] + data2[i2]
              if val != 0:
                  result_ind[nnz] = j1
                  result_data[nnz] = val
                  nnz += 1
              i1 += 1
              i2 += 1
          elif j1 < j2:
              val = data1[i1]
              if val != 0:
                  result_ind[nnz] = j1
                  result_data[nnz] = val
                  nnz += 1
              i1 += 1
          else:
              val = data2[i2]
              if val != 0:
                  result_ind[nnz] = j2
                  result_data[nnz] = val
                  nnz += 1
              i2 += 1
  
      # pass over the tails
      while i1 < ind1.shape[0]:
          j1 = ind1[i1]
          val = data1[i1]
          if val != 0:
              result_ind[nnz] = j1
              result_data[nnz] = val
              nnz += 1
          i1 += 1
  
      while i2 < ind2.shape[0]:
          j2 = ind2[i2]
          val = data2[i2]
          if val != 0:
              result_ind[nnz] = j2
              result_data[nnz] = val
              nnz += 1
          i2 += 1
  
      # truncate to the correct length in case there were zeros created
      result_ind = result_ind[:nnz]
      result_data = result_data[:nnz]
  
      return result_ind, result_data
  
imports: from __future__ import print_function
  import locale
  import numpy
  import numba
  from pynndescent.utils import norm, tau_rand
  from pynndescent.distances import kantorovich, jensen_shannon_divergence, symmetric_kl_divergence
label_desc: Use image node_id 6 for calling a global function with example usage: sparse_sum(ind1, data1, ind2, data2) and returns: result_ind,  result_data