code: def _mpdist_vect(
      Q,
      T,
      m,
      μ_Q,
      σ_Q,
      M_T,
      Σ_T,
      Q_subseq_isconstant,
      T_subseq_isconstant,
      percentage=0.05,
      k=None,
      custom_func=None,
      query_idx=None,
  ):
      """
      Compute the matrix profile distance measure vector between `Q` and each subsequence,
      `T[i : i + len(Q)]`, within `T`.
  
      Parameters
      ----------
      Q : numpy.ndarray
          Query array
  
      T : numpy.ndarray
          Time series or sequence
  
      m : int
          Window size that will be used for calculating the mpdist between Q and
          any subsequence in T (of size `len(Q)`)
  
      μ_Q : numpy.ndarray
          Sliding mean of `Q`
  
      σ_Q : numpy.ndarray
          Sliding standard deviation of `Q`
  
      M_T : numpy.ndarray
          Sliding mean of `T`
  
      Σ_T : numpy.ndarray
          Sliding standard deviation of `T`
  
      Q_subseq_isconstant : numpy.ndarray
          A boolean array that indicates whether the subsequence in `Q` is constant (True)
  
      T_subseq_isconstant : numpy.ndarray
          A boolean array that indicates whether a subsequence in `T` is constant (True)
  
      percentage : float, 0.05
          The percentage of distances that will be used to report `mpdist`. The value
          is between 0.0 and 1.0. This parameter is ignored when `k` is not `None` or when
          `custom_func` is not None.
  
      k : int, default None
          Specify the `k`th value in the concatenated matrix profiles to return. When `k`
          is not `None`, then the `percentage` parameter is ignored. This parameter is
          ignored when `custom_func` is not None.
  
      custom_func : function, default None
          A custom user defined function for selecting the desired value from the
          unsorted `P_ABBA` array. This function may need to leverage `functools.partial`
          and should take `P_ABBA` as its only input parameter and return a single
          `MPdist` value. The `percentage` and `k` parameters are ignored when
          `custom_func` is not None.
  
      query_idx : int, default None
          This is the index position along the time series, `T`, where the query
          subsequence, `Q`, is located. `query_idx` should be set to None if `Q`
          is not a subsequence of `T`. If `Q` is a subsequence of `T`, provding
          this argument is optional. If provided, the precision of computation
          can be slightly improved.
  
      Returns
      -------
      MPdist_vect : numpy.ndarray
          The mpdist-based distance profile of `Q` with `T`. It is a 1D array of
          size `len(T) - len(Q) + 1`. MPdist_vect[i] is the mpdist distance between
          `Q` and subsequence `T[i : i + len(Q)]`.
      """
      j = Q.shape[0] - m + 1  # `k` is reserved for `P_ABBA` selection
      l = T.shape[0] - m + 1
      MPdist_vect = np.empty(
          T.shape[0] - Q.shape[0] + 1, dtype=np.float64
      )
      distance_matrix = np.full((j, l), np.inf, dtype=np.float64)
      P_ABBA = np.empty(2 * j, dtype=np.float64)
  
      if k is None:
          percentage = np.clip(percentage, 0.0, 1.0)
          k = min(math.ceil(percentage * (2 * Q.shape[0])), 2 * j - 1)
  
      k = min(int(k), P_ABBA.shape[0] - 1)
  
      core._mass_distance_matrix(
          Q,
          T,
          m,
          distance_matrix,
          μ_Q,
          σ_Q,
          M_T,
          Σ_T,
          Q_subseq_isconstant,
          T_subseq_isconstant,
          query_idx=query_idx,
      )
  
      rolling_row_min = core.rolling_nanmin(distance_matrix, j)
      col_min = np.nanmin(distance_matrix, axis=0)
  
      for i in range(MPdist_vect.shape[0]):
          P_ABBA[:j] = rolling_row_min[:, i]
          P_ABBA[j:] = col_min[i : i + j]
          MPdist_vect[i] = core._select_P_ABBA_value(
              P_ABBA, k, custom_func
          )
  
      return MPdist_vect
  
file_path: stumpy/stumpy/mpdist.py
imports: import functools
  import math
  import numpy
  from .None import core
  from .aampdist import aampdist, aampdisted
  from .stump import stump
  from .stumped import stumped
label_desc: Use image node_id 1 for calling a global function with example usage: _mpdist_vect(Q, T, m, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant, percentage, k, custom_func, query_idx) and returns: MPdist_vect