original_docstring:  Calculates the exponential moving average over a vector. Will fail for large inputs.
  
          The result is processed in place into the array passed to the `out` parameter
  
          Parameters
          ----------
          data: :class:`numpy.ndarray`
              A 1 dimensional numpy array to obtain smoothed data for
          out: :class:`numpy.ndarray`
              A location into which the result is stored. It must have the same shape and dtype as
              the input data
          offset: float, optional
              The offset for the moving average, scalar. Default: the value held in data[0].
          
docstring: Calculates the exponential moving average over a vector. Will fail for large inputs.
  The result is processed in place into the array passed to the `out` parameter
  
  Parameters
  
  
docstring_tokens: Calculates the exponential moving average over a vector . Will fail for large inputs . The result is processed in place into the array passed to the ` out ` parameter Parameters
code: def _ewma_vectorized(self, data, out, offset=None):
          """ Calculates the exponential moving average over a vector. Will fail for large inputs.
  
          The result is processed in place into the array passed to the `out` parameter
  
          Parameters
          ----------
          data: :class:`numpy.ndarray`
              A 1 dimensional numpy array to obtain smoothed data for
          out: :class:`numpy.ndarray`
              A location into which the result is stored. It must have the same shape and dtype as
              the input data
          offset: float, optional
              The offset for the moving average, scalar. Default: the value held in data[0].
          """
          if data.size < 1:  # empty input, return empty array
              return
  
          offset = data[0] if offset is None else offset
  
          # scaling_factors -> 0 as len(data) gets large. This leads to divide-by-zeros below
          scaling_factors = np.power(1. - self._alpha, np.arange(data.size + 1, dtype=self._dtype),
                                     dtype=self._dtype)
          # create cumulative sum array
          np.multiply(data, (self._alpha * scaling_factors[-2]) / scaling_factors[:-1],
                      dtype=self._dtype, out=out)
          np.cumsum(out, dtype=self._dtype, out=out)
  
          out /= scaling_factors[-2::-1]  # cumulative sums / scaling
  
          if offset != 0:
              offset = np.array(offset, copy=False).astype(self._dtype, copy=False)
              out += offset * scaling_factors[1:]
code_tokens: def _ewma_vectorized ( self , data , out , offset = None ) : if data . size < 1 : return offset = data [ 0 ] if offset is None else offset scaling_factors = np . power ( 1. - self . _alpha , np . arange ( data . size + 1 , dtype = self . _dtype ) , dtype = self . _dtype ) np . multiply ( data , ( self . _alpha * scaling_factors [ - 2 ] ) / scaling_factors [ : - 1 ] , dtype = self . _dtype , out = out ) np . cumsum ( out , dtype = self . _dtype , out = out ) out /= scaling_factors [ - 2 : : - 1 ] if offset != 0 : offset = np . array ( offset , copy = False ) . astype ( self . _dtype , copy = False ) out += offset * scaling_factors [ 1 : ]
short_docstring: Calculates the exponential moving average over a vector.
short_docstring_tokens: Calculates the exponential moving average over a vector .
comment: """ Calculates the exponential moving average over a vector. Will fail for large inputs.
  
          The result is processed in place into the array passed to the `out` parameter
  
          Parameters
          ----------
          data: :class:`numpy.ndarray`
              A 1 dimensional numpy array to obtain smoothed data for
          out: :class:`numpy.ndarray`
              A location into which the result is stored. It must have the same shape and dtype as
              the input data
          offset: float, optional
              The offset for the moving average, scalar. Default: the value held in data[0].
          """$SEP$# empty input, return empty array$SEP$# scaling_factors -> 0 as len(data) gets large. This leads to divide-by-zeros below$SEP$# create cumulative sum array$SEP$# cumulative sums / scaling