### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Universal functions (`ufunc`) »

# numpy.ufunc.accumulate

`ufunc.``accumulate`(array, axis=None, dtype=None, out=None)

  Accumulate the result of applying the operator to all elements.

  For a one-dimensional array, accumulate produces results equivalent to:

      r = np.empty(len(A))
      t = op.identity
      for i in xrange(len(A)):
         t = op(t,A[i])
         r[i] = t
      return r

  For example, add.accumulate() is equivalent to cumsum().

  Parameters: | array : array_like The array to act on. axis : int, optional The axis along which to apply the accumulation. dtype : data-type-code, optional The type used to represent the intermediate results. Defaults to the data type of the output array if this is provided, or the data type of the input array if no output array is provided. out : ndarray, optional A location into which the result is stored. If not provided a freshly-allocated array is returned.
  Returns: | r : ndarray The accumulated values. If out was supplied, r is equal to out.

  Examples

      >>> np.multiply.accumulate([2,3,5])
      array([2,6,30])

### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Universal functions (`ufunc`) »