code: def maamp_subspace(
      T,
      m,
      subseq_idx,
      nn_idx,
      k,
      include=None,
      discords=False,
      discretize_func=None,
      n_bit=8,
      p=2.0,
  ):
      """
      Compute the k-dimensional matrix profile subspace for a given subsequence index and
      its nearest neighbor index
  
      Parameters
      ----------
      T : numpy.ndarray
          The time series or sequence for which the multi-dimensional matrix profile,
          multi-dimensional matrix profile indices were computed
  
      m : int
          Window size
  
      subseq_idx : int
          The subsequence index in T
  
      nn_idx : int
          The nearest neighbor index in T
  
      k : int
          The subset number of dimensions out of `D = T.shape[0]`-dimensions to return
          the subspace for
  
      include : 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 profile to favor discords rather
          than motifs. Note that indices in `include` are still maintained and respected.
  
      discretize_func : func, default None
          A function for discretizing each input array. When this is `None`, an
          appropriate discretization function (based on the `normalize` parameter) will
          be applied.
  
      n_bit : int, default 8
          The number of bits used for discretization. For more information on an
          appropriate value, see Figure 4 in:
  
          `DOI: 10.1109/ICDM.2016.0069 \
          <https://www.cs.ucr.edu/~eamonn/PID4481999_Matrix%20Profile_III.pdf>`__
  
          and Figure 2 in:
  
          `DOI: 10.1109/ICDM.2011.54 \
          <https://www.cs.ucr.edu/~eamonn/ICDM_mdl.pdf>`__
  
      p : float
          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.
  
      Returns
      -------
      S : numpy.ndarray
          An array of that contains the (singular) `k`th-dimensional subspace for the
          subsequence with index equal to `subseq_idx`. Note that `k+1` rows will be
          returned.
      """
      T = core._preprocess(T)
      core.check_window_size(m, max_size=T.shape[-1])
  
      subseqs, _ = core.preprocess_non_normalized(
          T[:, subseq_idx : subseq_idx + m], m
      )
      neighbors, _ = core.preprocess_non_normalized(
          T[:, nn_idx : nn_idx + m], m
      )
  
      if discretize_func is None:
          T_isfinite = np.isfinite(T)
          T_min = T[T_isfinite].min()
          T_max = T[T_isfinite].max()
          discretize_func = partial(
              _maamp_discretize, a_min=T_min, a_max=T_max, n_bit=n_bit
          )
  
      disc_subseqs = discretize_func(subseqs)
      disc_neighbors = discretize_func(neighbors)
  
      D = np.linalg.norm(disc_subseqs - disc_neighbors, axis=1, ord=p)
  
      S = core._subspace(D, k, include=include, discords=discords)
  
      return S
  
file_path: stumpy/stumpy/maamp.py
imports: from functools import partial
  import numpy
  from numba import njit, prange
  from .None import config, core
label_desc: Use image node_id 2 for calling a global function with example usage: maamp_subspace(T, m, subseq_idx, nn_idx, k, include, discords, discretize_func, n_bit, p) and returns: S