code: def _discrete_fourier_transform(
      series,
      dft_length,
      norm,
      inverse_sqrt_win_size,
      lower_bounding,
      apply_normalising_factor=True,
      cut_start_if_norm=True,
  ):
      """Perform a discrete fourier transform using standard O(n^2) transform.
  
      if self.norm is True, then the first term of the DFT is ignored
  
      Input
      -------
      X : The training input samples.  array-like or sparse matrix of
      shape = [n_samps, num_atts]
  
      Returns
      -------
      1D array of fourier term, real_0,imag_0, real_1, imag_1 etc, length
      num_atts or
      num_atts-2 if if self.norm is True
      """
      start = 2 if norm else 0
      output_length = start + dft_length
  
      if cut_start_if_norm:
          c = int(start / 2)
      else:
          c = 0
          start = 0
  
      dft = np.zeros(output_length - start)
      for i in range(c, int(output_length / 2)):
          for n in range(len(series)):
              dft[(i - c) * 2] += series[n] * math.cos(
                  2 * math.pi * n * i / len(series)
              )
              dft[(i - c) * 2 + 1] += -series[n] * math.sin(
                  2 * math.pi * n * i / len(series)
              )
  
      if apply_normalising_factor:
          if lower_bounding:
              dft[1::2] = dft[1::2] * -1  # lower bounding
  
          std = np.std(series)
          if std == 0:
              std = 1
          dft *= inverse_sqrt_win_size / std
  
      return dft
  
file_path: sktime/sktime/transformations/panel/dictionary_based/_sfa_numba.py
imports: import math
  import numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 1 for calling a global function with example usage: _discrete_fourier_transform(series, dft_length, norm, inverse_sqrt_win_size, lower_bounding, apply_normalising_factor, cut_start_if_norm) and returns: dft