code: def mstump(
      T,
      m,
      include=None,
      discords=False,
      normalize=True,
      p=2.0,
      T_subseq_isconstant=None,
  ):
      """
      Compute the multi-dimensional z-normalized matrix profile
  
      This is a convenience wrapper around the Numba JIT-compiled parallelized
      `_mstump` function which computes the multi-dimensional matrix profile and
      multi-dimensional matrix profile index according to mSTOMP, a variant of
      mSTAMP. Note that only self-joins are supported.
  
      Parameters
      ----------
      T : numpy.ndarray
          The time series or sequence for which to compute the multi-dimensional
          matrix profile. Each row in `T` represents data from a different
          dimension while each column in `T` represents data from the same
          dimension.
  
      m : int
          Window size
  
      include : list, numpy.ndarray, default None
          A list of (zero-based) indices corresponding to the dimensions in `T` that
          must be included in the constrained multidimensional motif search.
          For more information, see Section IV D in:
  
          `DOI: 10.1109/ICDM.2017.66 \
          <https://www.cs.ucr.edu/~eamonn/Motif_Discovery_ICDM.pdf>`__
  
      discords : bool, default False
          When set to `True`, this reverses the distance matrix which results in a
          multi-dimensional matrix profile that favors larger matrix profile values
          (i.e., discords) rather than smaller values (i.e., motifs). Note that indices
          in `include` are still maintained and respected.
  
      normalize : bool, default True
          When set to `True`, this z-normalizes subsequences prior to computing distances.
          Otherwise, this function gets re-routed to its complementary non-normalized
          equivalent set in the `@core.non_normalized` function decorator.
  
      p : float, default 2.0
          The p-norm to apply for computing the Minkowski distance. Minkowski distance is
          typically used with `p` being 1 or 2, which correspond to the Manhattan distance
          and the Euclidean distance, respectively. This parameter is ignored when
          `normalize == True`.
  
      T_subseq_isconstant : numpy.ndarray, function, or list, default None
          A parameter that is used to show whether a subsequence of a time series in `T`
          is constant (True) or not. T_subseq_isconstant can be a 2D boolean numpy.ndarry
          or a function that can be applied to each time series in `T`. Alternatively, for
          maximum flexibility, a list (with length equal to the total number of time
          series) may also be used. In this case, T_subseq_isconstant[i] corresponds to
          the i-th time series T[i] and each element in the list can either be a 1D
          boolean np.ndarray, a function, or None.
  
      Returns
      -------
      P : numpy.ndarray
          The multi-dimensional matrix profile. Each row of the array corresponds
          to each matrix profile for a given dimension (i.e., the first row is
          the 1-D matrix profile and the second row is the 2-D matrix profile).
  
      I : numpy.ndarray
          The multi-dimensional matrix profile index where each row of the array
          corresponds to each matrix profile index for a given dimension.
  
      See Also
      --------
      stumpy.mstumped : Compute the multi-dimensional z-normalized matrix profile with
          a distributed dask cluster
      stumpy.subspace : Compute the k-dimensional matrix profile subspace for a given
          subsequence index and its nearest neighbor index
      stumpy.mdl : Compute the number of bits needed to compress one array with another
          using the minimum description length (MDL)
  
      Notes
      -----
      `DOI: 10.1109/ICDM.2017.66 \
      <https://www.cs.ucr.edu/~eamonn/Motif_Discovery_ICDM.pdf>`__
  
      See mSTAMP Algorithm
  
      Examples
      --------
      >>> stumpy.mstump(
      ...     np.array([[584., -11., 23., 79., 1001., 0., -19.],
      ...               [  1.,   2.,  4.,  8.,   16., 0.,  32.]]),
      ...     m=3)
      (array([[0.        , 1.43947142, 0.        , 2.69407392, 0.11633857],
              [0.777905  , 2.36179922, 1.50004632, 2.92246722, 0.777905  ]]),
       array([[2, 4, 0, 1, 0],
              [4, 4, 0, 1, 0]]))
      """
      T_A = T
      T_B = T_A
  
      T_A = core._preprocess(T_A)
      T_B = core._preprocess(T_B)
  
      T_A_subseq_isconstant = T_subseq_isconstant
      T_A_subseq_isconstant = core.process_isconstant(
          T_A, m, T_A_subseq_isconstant
      )
      T_B_subseq_isconstant = T_A_subseq_isconstant
  
      T_A, M_T, Σ_T, T_subseq_isconstant = core.preprocess(
          T_A, m, T_subseq_isconstant=T_A_subseq_isconstant
      )
      T_B, μ_Q, σ_Q, Q_subseq_isconstant = core.preprocess(
          T_B, m, T_subseq_isconstant=T_B_subseq_isconstant
      )
  
      if T_A.ndim <= 1:  # pragma: no cover
          err = f"T is {T_A.ndim}-dimensional and must be at least 1-dimensional"
          raise ValueError(f"{err}")
  
      core.check_window_size(
          m, max_size=min(T_A.shape[1], T_B.shape[1])
      )
  
      if include is not None:
          include = core._preprocess_include(include)
  
      d, n = T_B.shape
      l = n - m + 1
      excl_zone = int(
          np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM)
      )  # See Definition 3 and Figure 3
  
      P = np.empty((d, l), dtype=np.float64)
      I = np.empty((d, l), dtype=np.int64)
  
      start = 0
      stop = l
  
      P[:, start], I[:, start] = _get_first_mstump_profile(
          start,
          T_A,
          T_B,
          m,
          excl_zone,
          M_T,
          Σ_T,
          μ_Q,
          σ_Q,
          T_subseq_isconstant,
          Q_subseq_isconstant,
          include,
          discords,
      )
  
      QT, QT_first = _get_multi_QT(start, T_A, m)
  
      P[:, start + 1 : stop], I[:, start + 1 : stop] = _mstump(
          T_A,
          m,
          stop,
          excl_zone,
          M_T,
          Σ_T,
          QT,
          QT_first,
          μ_Q,
          σ_Q,
          T_subseq_isconstant,
          Q_subseq_isconstant,
          l,
          start + 1,
          include,
          discords,
      )
  
      return P, I
  
file_path: stumpy/stumpy/mstump.py
imports: from functools import lru_cache, partial
  import numpy
  from numba import njit, prange
  from scipy.stats import norm
  from .None import config, core
  from .maamp import maamp, maamp_mdl, maamp_multi_distance_profile, maamp_subspace
label_desc: Use image node_id 12 for calling a global function with example usage: mstump(T, m, include, discords, normalize, p, T_subseq_isconstant) and returns: P,  I