code: def calculate_gains_sparse(dtypes, parallel, fastmath, cache):
      @njit(sdtypes, parallel=parallel, fastmath=fastmath, cache=cache)
      def calculate_gains_sparse_(
          X_data,
          X_indices,
          X_indptr,
          gains,
          current_values,
          threshold,
          idxs,
      ):
          for i in prange(idxs.shape[0]):
              idx = idxs[i]
              start = X_indptr[idx]
              end = X_indptr[idx + 1]
  
              for j in range(start, end):
                  k = X_indices[j]
                  gains[i] += (
                      min(X_data[j] + current_values[k], threshold)
                      - current_values[k]
                  )
  
      return calculate_gains_sparse_
  
file_path: apricot/apricot/functions/maxCoverage.py
imports: import numpy
  from .base import BaseSelection
  from ..optimizers import LazyGreedy
  from ..optimizers import ApproximateLazyGreedy
  from ..optimizers import SieveGreedy
  from numba import njit
  from numba import prange
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_gains_sparse(dtypes, parallel, fastmath, cache) and returns: calculate_gains_sparse_