docs: def correlate(h1, h2): # 31 us @array, 55 us @list \w 100 bins
      r"""
      Correlation between two histograms.
      
      The histogram correlation between two histograms :math:`H` and :math:`H'` of size :math:`m`
      is defined as:
      
      .. math::
      
          d_{corr}(H, H') = 
          \frac{
              \sum_{m=1}^M (H_m-\bar{H}) \cdot (H'_m-\bar{H'})
          }{
              \sqrt{\sum_{m=1}^M (H_m-\bar{H})^2 \cdot \sum_{m=1}^M (H'_m-\bar{H'})^2}
          }
      
      with :math:`\bar{H}` and :math:`\bar{H'}` being the mean values of :math:`H` resp. :math:`H'`
          
      *Attributes:*
  
      - not a metric, a similarity
      
      *Attributes for normalized histograms:*
  
      - :math:`d(H, H')\in[-1, 1]`
      - :math:`d(H, H) = 1`
      - :math:`d(H, H') = d(H', H)`
      
      *Attributes for not-normalized histograms:*
  
      - :math:`d(H, H')\in[-1, 1]`
      - :math:`d(H, H) = 1`
      - :math:`d(H, H') = d(H', H)`
      
      *Attributes for not-equal histograms:*
  
      - not applicable
      
      Parameters
      ----------
      h1 : sequence
          The first histogram.
      h2 : sequence
          The second histogram, same bins as ``h1``.
      
      Returns
      -------
      correlate : float
          Correlation between the histograms.
          
      Notes
      -----
      Returns 0 if one of h1 or h2 contain only zeros.
      
      """
      h1, h2 = __prepare_histogram(h1, h2)
      h1m = h1 - scipy.sum(h1) / float(h1.size)
      h2m = h2 - scipy.sum(h2) / float(h2.size)
      a = scipy.sum(scipy.multiply(h1m, h2m))
      b = math.sqrt(scipy.sum(scipy.square(h1m)) * scipy.sum(scipy.square(h2m)))
      return 0 if 0 == b else a / b