code: def massStomp(query, ts, dot_first, dot_prev, index, mean, std):
      """
      Calculates Mueen's ultra-fast Algorithm for Similarity Search (MASS) between a query and timeseries using the STOMP dot product speedup. Note that we are returning the square of MASS.
  
      Parameters
      ----------
      query: Time series snippet to evaluate. Note that, for STOMP, the query must be a subset of ts.
      ts: Time series to compare against query.
      dot_first: The dot product between ts and the beginning query (QT1,1 in Zhu et.al).
      dot_prev: The dot product between ts and the query starting at index-1.
      index: The location of the first point in the query.
      mean: Array containing the mean of every subsequence in ts.
      std: Array containing the standard deviation of every subsequence in ts.
      """
      m = len(query)
      dot = DotProductStomp(ts, m, dot_first, dot_prev, index)
  
      # Return both the MASS calcuation and the dot product
      res = (
          2
          * m
          * (
              1
              - (dot - m * mean[index] * mean) / (m * std[index] * std)
          )
      )
  
      return res, dot
  
file_path: matrixprofile-ts/matrixprofile/utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import numpy.fft
label_desc: Use image node_id 8 for calling a global function with example usage: massStomp(query, ts, dot_first, dot_prev, index, mean, std) and returns: res,  dot