code: def _deg2_column(d, i, j, interaction_only):
      """Compute the index of the column for a degree 2 expansion
  
      d is the dimensionality of the input data, i and j are the indices
      for the columns involved in the expansion.
      """
      if interaction_only:
          return int(d * i - (i**2 + 3 * i) / 2 - 1 + j)
      else:
          return int(d * i - (i**2 + i) / 2 + j)
  
file_path: cuml/python/cuml/thirdparty_adapters/sparsefuncs_fast.py
imports: from math import ceil
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 9 for calling a global function with example usage: _deg2_column(d, i, j, interaction_only) and returns: int, int