### Navigation

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

# numpy.ufunc.reduce

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

  Reduce applies the operator to all elements of the array.

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

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

  For example, add.reduce() is equivalent to sum().

  Parameters: | array : array_like The array to act on. axis : integer, optional The axis along which to apply the reduction. 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 : array_like, optional A location into which the result is stored. If not provided a freshly-allocated array is returned.
  Returns: | r : ndarray The reduced values. If out was supplied, r is equal to out.

  Examples

      >>> np.multiply.reduce([2,3,5])
      30

### Navigation

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