code: def convolution(
      a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None
  ):
      """
      Performs convolution by determining the type of desired
      convolution using hints.
  
      Exactly one of ``dps``, ``prime``, ``dyadic``, ``subset`` arguments
      should be specified explicitly for identifying the type of convolution,
      and the argument ``cycle`` can be specified optionally.
  
      For the default arguments, linear convolution is performed using **FFT**.
  
      Parameters
      ==========
  
      a, b : iterables
          The sequences for which convolution is performed.
      cycle : Integer
          Specifies the length for doing cyclic convolution.
      dps : Integer
          Specifies the number of decimal digits for precision for
          performing **FFT** on the sequence.
      prime : Integer
          Prime modulus of the form `(m 2^k + 1)` to be used for
          performing **NTT** on the sequence.
      dyadic : bool
          Identifies the convolution type as dyadic (*bitwise-XOR*)
          convolution, which is performed using **FWHT**.
      subset : bool
          Identifies the convolution type as subset convolution.
  
      Examples
      ========
  
      >>> from sympy import convolution, symbols, S, I
      >>> u, v, w, x, y, z = symbols('u v w x y z')
  
      >>> convolution([1 + 2*I, 4 + 3*I], [S(5)/4, 6], dps=3)
      [1.25 + 2.5*I, 11.0 + 15.8*I, 24.0 + 18.0*I]
      >>> convolution([1, 2, 3], [4, 5, 6], cycle=3)
      [31, 31, 28]
  
      >>> convolution([111, 777], [888, 444], prime=19*2**10 + 1)
      [1283, 19351, 14219]
      >>> convolution([111, 777], [888, 444], prime=19*2**10 + 1, cycle=2)
      [15502, 19351]
  
      >>> convolution([u, v], [x, y, z], dyadic=True)
      [u*x + v*y, u*y + v*x, u*z, v*z]
      >>> convolution([u, v], [x, y, z], dyadic=True, cycle=2)
      [u*x + u*z + v*y, u*y + v*x + v*z]
  
      >>> convolution([u, v, w], [x, y, z], subset=True)
      [u*x, u*y + v*x, u*z + w*x, v*z + w*y]
      >>> convolution([u, v, w], [x, y, z], subset=True, cycle=3)
      [u*x + v*z + w*y, u*y + v*x, u*z + w*x]
  
      """
  
      c = as_int(cycle)
      if c < 0:
          raise ValueError(
              "The length for cyclic convolution "
              "must be non-negative"
          )
  
      dyadic = True if dyadic else None
      subset = True if subset else None
      if sum(x is not None for x in (prime, dps, dyadic, subset)) > 1:
          raise TypeError(
              "Ambiguity in determining the type of convolution"
          )
  
      if prime is not None:
          ls = convolution_ntt(a, b, prime=prime)
          return (
              ls if not c else [sum(ls[i::c]) % prime for i in range(c)]
          )
  
      if dyadic:
          ls = convolution_fwht(a, b)
      elif subset:
          ls = convolution_subset(a, b)
      else:
  
          def loop(a):
              dens = []
              for i in a:
                  if isinstance(i, Rational) and i.q - 1:
                      dens.append(i.q)
                  elif not isinstance(i, int):
                      return
              if dens:
                  l = lcm(*dens)
                  return [
                      i * l if type(i) is int else i.p * (l // i.q)
                      for i in a
                  ], l
              # no lcm of den to deal with
              return a, 1
  
          ls = None
          da = loop(a)
          if da is not None:
              db = loop(b)
              if db is not None:
                  (ia, ma), (ib, mb) = da, db
                  den = ma * mb
                  ls = convolution_int(ia, ib)
                  if den != 1:
                      ls = [Rational(i, den) for i in ls]
          if ls is None:
              ls = convolution_fft(a, b, dps)
  
      return ls if not c else [sum(ls[i::c]) for i in range(c)]
  
file_path: sympy/sympy/discrete/convolutions.py
imports: from sympy.core import S, sympify, Rational
  from sympy.core.function import expand_mul
  from sympy.discrete.transforms import fft, ifft, ntt, intt, fwht, ifwht, mobius_transform, inverse_mobius_transform
  from sympy.external.gmpy import MPZ, lcm
  from sympy.utilities.iterables import iterable
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 1 for calling a global function with example usage: convolution(a, b, cycle, dps, prime, dyadic, subset) and returns: unknown, unknown, a,  int, unknown,  l