code: def _aamp(
      T_A,
      T_B,
      m,
      T_A_subseq_isfinite,
      T_B_subseq_isfinite,
      p,
      diags,
      ignore_trivial,
      k,
  ):
      """
      A Numba JIT-compiled version of AAMP for parallel computation of the matrix
      profile and matrix profile indices.
  
      Parameters
      ----------
      T_A : numpy.ndarray
          The time series or sequence for which to compute the matrix profile
  
      T_B : numpy.ndarray
          The time series or sequence that will be used to annotate T_A. For every
          subsequence in T_A, its nearest neighbor in T_B will be recorded.
  
      m : int
          Window size
  
      T_A_subseq_isfinite : numpy.ndarray
          A boolean array that indicates whether a subsequence in `T_A` contains a
          `np.nan`/`np.inf` value (False)
  
      T_B_subseq_isfinite : numpy.ndarray
          A boolean array that indicates whether a subsequence in `T_B` contains a
          `np.nan`/`np.inf` value (False)
  
      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.
  
      diags : numpy.ndarray
          The diag of diagonals to process and compute
  
      ignore_trivial : bool
          Set to `True` if this is a self-join. Otherwise, for AB-join, set this to
          `False`. Default is `True`.
  
      k : int
          The number of top `k` smallest distances used to construct the matrix profile.
          Note that this will increase the total computational time and memory usage
          when k > 1.
  
      Returns
      -------
      out1 : numpy.ndarray
          The (top-k) matrix profile
  
      out2 : numpy.ndarray
          The (top-1) left matrix profile
  
      out3 : numpy.ndarray
          The (top-1) right matrix profile
  
      out4 : numpy.ndarray
          The (top-k) matrix profile indices
  
      out5 : numpy.ndarray
          The (top-1) left matrix profile indices
  
      out6 : numpy.ndarray
          The (top-1) right matrix profile indices
  
      Notes
      -----
      `DOI: 10.1109/ICDM.2018.00099 \
      <https://www.cs.ucr.edu/~eamonn/SCRIMP_ICDM_camera_ready_updated.pdf>`__
  
      See Algorithm 1
      """
      n_A = T_A.shape[0]
      n_B = T_B.shape[0]
      l = n_A - m + 1
      n_threads = numba.config.NUMBA_NUM_THREADS
  
      P = np.full((n_threads, l, k), np.inf, dtype=np.float64)
      I = np.full((n_threads, l, k), -1, dtype=np.int64)
  
      PL = np.full((n_threads, l), np.inf, dtype=np.float64)
      IL = np.full((n_threads, l), -1, dtype=np.int64)
  
      PR = np.full((n_threads, l), np.inf, dtype=np.float64)
      IR = np.full((n_threads, l), -1, dtype=np.int64)
  
      ndist_counts = core._count_diagonal_ndist(diags, m, n_A, n_B)
      diags_ranges = core._get_array_ranges(
          ndist_counts, n_threads, False
      )
  
      for thread_idx in prange(n_threads):
          # Compute and update P, I within a single thread while avoiding race conditions
          _compute_diagonal(
              T_A,
              T_B,
              m,
              T_A_subseq_isfinite,
              T_B_subseq_isfinite,
              p,
              diags,
              diags_ranges[thread_idx, 0],
              diags_ranges[thread_idx, 1],
              thread_idx,
              P,
              PL,
              PR,
              I,
              IL,
              IR,
              ignore_trivial,
          )
  
      # Reduction of results from all threads
      for thread_idx in range(1, n_threads):
          # update top-k arrays
          core._merge_topk_PI(P[0], P[thread_idx], I[0], I[thread_idx])
  
          # update left matrix profile and matrix profile indices
          mask = PL[0] > PL[thread_idx]
          PL[0][mask] = PL[thread_idx][mask]
          IL[0][mask] = IL[thread_idx][mask]
  
          # update right matrix profile and matrix profile indices
          mask = PR[0] > PR[thread_idx]
          PR[0][mask] = PR[thread_idx][mask]
          IR[0][mask] = IR[thread_idx][mask]
  
      return (
          np.power(P[0], 1.0 / p),
          np.power(PL[0], 1.0 / p),
          np.power(PR[0], 1.0 / p),
          I[0],
          IL[0],
          IR[0],
      )
  
imports: import numba
  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: _aamp(T_A, T_B, m, T_A_subseq_isfinite, T_B_subseq_isfinite, p, diags, ignore_trivial, k) and returns: np,  np,  np,  I,  IL,  IR