code: def _dtw_fast(
      x,
      y,
      dist="square",
      radius=0,
      return_cost=False,
      return_accumulated=False,
      return_path=False,
  ):
      """Fast Dynamic Time Warping distance.
  
      This version of DTW builds an adaptive constraint region. The constraint
      region is created recursively by downsampling the time series, computing
      the optimal path and projecting it to a higher resolution. This process
      is repeated until the resolution matches the original resolution.
  
      Options
      -------
      radius : int (default = 0)
          The radius used to expand the constraint region. The optimal path
          computed at the resolution level is expanded with `radius` cells to the
          top, bottom, left and right of every cell belonging to the optimal
          path. It is computed at the resolution level.
  
      References
      ----------
      .. [1] S. Salvador ans P. Chan, "FastDTW: Toward Accurate Dynamic Time
             Warping in Linear Time and Space". KDD Workshop on Mining Temporal
             and Sequential Data, 70–80 (2004).
  
      """
      (
          x,
          y,
          precomputed_cost,
          n_timestamps_1,
          n_timestamps_2,
      ) = _check_input_dtw(
          x, y, precomputed_cost=None, dist=dist, method="fast"
      )
      region = _fast_region(x, y, dist, radius=radius)
      cost_mat = cost_matrix(x, y, dist=dist, region=region)
      acc_cost_mat = accumulated_cost_matrix(cost_mat, region=region)
      dtw_dist = acc_cost_mat[-1, -1]
      if dist == "square":
          dtw_dist = sqrt(dtw_dist)
  
      res = _return_results(
          dtw_dist,
          cost_mat,
          acc_cost_mat,
          return_cost,
          return_accumulated,
          return_path,
      )
      return res
  
imports: import numpy
  from math import ceil, log2, sqrt
  from numba import njit, prange
  from sklearn.utils import check_array
label_desc: Use image node_id 28 for calling a global function with example usage: _dtw_fast(x, y, dist, radius, return_cost, return_accumulated, return_path) and returns: res