class_docstr: Compute an approximate non-normalized (i.e., without z-normalization) matrix profile
  
  This is a convenience wrapper around the Numba JIT-compiled parallelized
  `_aamp` function which computes the non-normalized (i.e., without z-normalization)
  matrix profile according to SCRIMP.
  
  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
  
  ignore_trivial : bool
      Set to `True` if this is a self-join. Otherwise, for AB-join, set this to
      `False`. Default is `True`.
  
  percentage : float
      Approximate percentage completed. The value is between 0.0 and 1.0.
  
  pre_scraamp : bool
      A flag for whether or not to perform the PreSCRIMP calculation prior to
      computing SCRIMP. If set to `True`, this is equivalent to computing
      SCRIMP++ and may lead to faster convergence
  
  s : int
      The size of the PreSCRIMP fixed interval. If `pre_scraamp=True` and `s=None`,
      then `s` will automatically be set to
      `s=int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))`, the size of the exclusion
      zone.
  
  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.
  
  k : int, default 1
      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.
  
  Attributes
  ----------
  P_ : numpy.ndarray
      The updated (top-k) matrix profile. When `k=1` (default), this output is
      a 1D array consisting of the matrix profile. When `k > 1`, the output
      is a 2D array that has exactly `k` columns consisting of the top-k matrix
      profile.
  
  I_ : numpy.ndarray
      The updated (top-k) matrix profile indices. When `k=1` (default), this output is
      a 1D array consisting of the matrix profile indices. When `k > 1`, the output
      is a 2D array that has exactly `k` columns consisting of the top-k matrix
      profile indiecs.
  
  left_I_ : numpy.ndarray
      The updated left (top-1) matrix profile indices
  
  right_I_ : numpy.ndarray
      The updated right (top-1) matrix profile indices
  
  Methods
  -------
  update()
      Update the matrix profile and the matrix profile indices by computing
      additional new distances (limited by `percentage`) that make up the full
      distance matrix. It updates the (top-k) matrix profile, (top-1) left
      matrix profile, (top-1) right matrix profile, (top-k) matrix profile indices,
      (top-1) left matrix profile indices, and (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 and Algorithm 2
docstr: Initialize the `scraamp` object
  
  Parameters
  ----------
  T_A : numpy.ndarray
      The time series or sequence for which to compute the matrix profile
  
  m : int
      Window size
  
  T_B : numpy.ndarray, default None
      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.
  
  ignore_trivial : bool, default True
      Set to `True` if this is a self-join. Otherwise, for AB-join, set this to
      `False`. Default is `True`.
  
  percentage : float, default 0.01
      Approximate percentage completed. The value is between 0.0 and 1.0.
  
  pre_scraamp : bool, default False
      A flag for whether or not to perform the PreSCRIMP calculation prior to
      computing SCRIMP. If set to `True`, this is equivalent to computing
      SCRIMP++
  
  s : int, default None
      The size of the PreSCRIMP fixed interval. If `pre_scraamp=True` and
      `s=None`, then `s` will automatically be set to
      `s=int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))`, the
      size of the exclusion zone.
  
  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.
  
  k : int, default 1
      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.
docstr_tok: ["Initialize","the","`","scraamp","`","object","Parameters","--","--","--","--","--","T_A",":","numpy.ndarray","The","time","series","or","sequence","for","which","to","compute","the","matrix","profile","m",":","int","Window","size","T_B",":","numpy.ndarray",",","default","None","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",".","ignore_trivial",":","bool",",","default","True","Set","to","`","True","`","if","this","is","a","self-join",".","Otherwise",",","for","AB-join",",","set","this","to","`","False","`",".","Default","is","`","True","`",".","percentage",":","float",",","default","0.01","Approximate","percentage","completed",".","The","value","is","between","0.0","and","1.0.","pre_scraamp",":","bool",",","default","False","A","flag","for","whether","or","not","to","perform","the","PreSCRIMP","calculation","prior","to","computing","SCRIMP",".","If","set","to","`","True","`",",","this","is","equivalent","to","computing","SCRIMP++","s",":","int",",","default","None","The","size","of","the","PreSCRIMP","fixed","interval",".","If","`","pre_scraamp=True","`","and","`","s=None","`",",","then","`","s","`","will","automatically","be","set","to","`","s=int","(","np.ceil","(","m","\/","config.STUMPY_EXCL_ZONE_DENOM",")",")","`",",","the","size","of","the","exclusion","zone",".","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",".","k",":","int",",","default","1","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","."]
code: def __init__(
      self,
      T_A,
      m,
      T_B=None,
      ignore_trivial=True,
      percentage=0.01,
      pre_scraamp=False,
      s=None,
      p=2.0,
      k=1,
  ):
      """
      Initialize the `scraamp` object
  
      Parameters
      ----------
      T_A : numpy.ndarray
          The time series or sequence for which to compute the matrix profile
  
      m : int
          Window size
  
      T_B : numpy.ndarray, default None
          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.
  
      ignore_trivial : bool, default True
          Set to `True` if this is a self-join. Otherwise, for AB-join, set this to
          `False`. Default is `True`.
  
      percentage : float, default 0.01
          Approximate percentage completed. The value is between 0.0 and 1.0.
  
      pre_scraamp : bool, default False
          A flag for whether or not to perform the PreSCRIMP calculation prior to
          computing SCRIMP. If set to `True`, this is equivalent to computing
          SCRIMP++
  
      s : int, default None
          The size of the PreSCRIMP fixed interval. If `pre_scraamp=True` and
          `s=None`, then `s` will automatically be set to
          `s=int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))`, the
          size of the exclusion zone.
  
      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.
  
      k : int, default 1
          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.
      """
      self._ignore_trivial = ignore_trivial
      self._p = p
  
      if T_B is None:
          T_B = T_A
          self._ignore_trivial = True
  
      self._m = m
  
      (
          self._T_A,
          self._T_A_subseq_isfinite,
      ) = core.preprocess_non_normalized(T_A, self._m)
      (
          self._T_B,
          self._T_B_subseq_isfinite,
      ) = core.preprocess_non_normalized(T_B, self._m)
  
      if self._T_A.ndim != 1:  # pragma: no cover
          raise ValueError(
              f"T_A is {self._T_A.ndim}-dimensional and must be 1-dimensional. "
              "For multidimensional STUMP use `stumpy.mstump` or `stumpy.mstumped`"
          )
  
      if self._T_B.ndim != 1:  # pragma: no cover
          raise ValueError(
              f"T_B is {self._T_B.ndim}-dimensional and must be 1-dimensional. "
              "For multidimensional STUMP use `stumpy.mstump` or `stumpy.mstumped`"
          )
  
      core.check_window_size(
          m, max_size=min(T_A.shape[0], T_B.shape[0])
      )
      self._ignore_trivial = core.check_ignore_trivial(
          self._T_A, self._T_B, self._ignore_trivial
      )
  
      self._n_A = self._T_A.shape[0]
      self._n_B = self._T_B.shape[0]
      self._l = self._n_A - self._m + 1
      self._k = k
  
      self._P = np.full((self._l, self._k), np.inf, dtype=np.float64)
      self._PL = np.full(self._l, np.inf, dtype=np.float64)
      self._PR = np.full(self._l, np.inf, dtype=np.float64)
  
      self._I = np.full((self._l, self._k), -1, dtype=np.int64)
      self._IL = np.full(self._l, -1, dtype=np.int64)
      self._IR = np.full(self._l, -1, dtype=np.int64)
  
      self._excl_zone = int(
          np.ceil(self._m / config.STUMPY_EXCL_ZONE_DENOM)
      )
      if s is None:
          if self._excl_zone is not None:  # self-join
              s = self._excl_zone
          else:  # pragma: no cover  # AB-join
              s = int(np.ceil(self._m / config.STUMPY_EXCL_ZONE_DENOM))
  
      if pre_scraamp:
          if self._ignore_trivial:
              (
                  T_A,
                  T_B,
                  T_A_subseq_isfinite,
                  T_B_subseq_isfinite,
                  indices,
                  s,
                  excl_zone,
              ) = _preprocess_prescraamp(T_A, m, s=s)
          else:
              (
                  T_A,
                  T_B,
                  T_A_subseq_isfinite,
                  T_B_subseq_isfinite,
                  indices,
                  s,
                  excl_zone,
              ) = _preprocess_prescraamp(T_A, m, T_B=T_B, s=s)
  
          P, I = _prescraamp(
              T_A,
              T_B,
              m,
              T_A_subseq_isfinite,
              T_B_subseq_isfinite,
              p,
              indices,
              s,
              excl_zone,
              k,
          )
          core._merge_topk_PI(self._P, P, self._I, I)
  
      if self._ignore_trivial:
          self._diags = np.random.permutation(
              range(self._excl_zone + 1, self._n_A - self._m + 1)
          ).astype(np.int64)
          if self._diags.shape[0] == 0:  # pragma: no cover
              max_m = core.get_max_window_size(self._T_A.shape[0])
              raise ValueError(
                  f"The window size, `m = {self._m}`, is too long for a self join. "
                  f"Please try a value of `m <= {max_m}`"
              )
      else:
          self._diags = np.random.permutation(
              range(
                  -(self._n_A - self._m + 1) + 1,
                  self._n_B - self._m + 1,
              )
          ).astype(np.int64)
  
      self._n_threads = numba.config.NUMBA_NUM_THREADS
      self._percentage = np.clip(percentage, 0.0, 1.0)
      self._n_chunks = int(np.ceil(1.0 / percentage))
      self._ndist_counts = core._count_diagonal_ndist(
          self._diags, self._m, self._n_A, self._n_B
      )
      self._chunk_diags_ranges = core._get_array_ranges(
          self._ndist_counts, self._n_chunks, True
      )
      self._n_chunks = self._chunk_diags_ranges.shape[0]
      self._chunk_idx = 0
  
file_path: stumpy/stumpy/scraamp.py
imports: import numba
  import numpy
  from numba import njit, prange
  from .None import config, core
  from .aamp import _aamp
label_desc: Use image node_id 1 to create a new scraamp object  with example: obj = scraamp(T_A, m, T_B, ignore_trivial, percentage, pre_scraamp, s, p, k)