code: def full2sparse_clipped(vec, topn, eps=1e-9):
      """Like :func:`~gensim.matutils.full2sparse`, but only return the `topn` elements of the greatest magnitude (abs).
  
      This is more efficient that sorting a vector and then taking the greatest values, especially
      where `len(vec) >> topn`.
  
      Parameters
      ----------
      vec : numpy.ndarray
          Input dense vector
      topn : int
          Number of greatest (abs) elements that will be presented in result.
      eps : float
          Threshold value, if coordinate in `vec` < eps, this will not be presented in result.
  
      Returns
      -------
      list of (int, float)
          Clipped vector in BoW format.
  
      See Also
      --------
      :func:`~gensim.matutils.full2sparse`
          Convert dense array to gensim bag-of-words format.
  
      """
      # use np.argpartition/argsort and only form tuples that are actually returned.
      # this is about 40x faster than explicitly forming all 2-tuples to run sort() or heapq.nlargest() on.
      if topn <= 0:
          return []
      vec = np.asarray(vec, dtype=float)
      nnz = np.nonzero(abs(vec) > eps)[0]
      biggest = nnz.take(
          argsort(abs(vec).take(nnz), topn, reverse=True)
      )
      return list(zip(biggest, vec.take(biggest)))
  
imports: from __future__ import with_statement
  import logging
  import math
  from gensim import utils
  import numpy
  import scipy.sparse
  from scipy.stats import entropy
  from scipy.linalg import get_blas_funcs, triu
  from scipy.linalg.lapack import get_lapack_funcs
  from scipy.special import psi
label_desc: Use image node_id 12 for calling a global function with example usage: full2sparse_clipped(vec, topn, eps) and returns: list, list