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
axis : integer, optional
dtype : data-type-code, optional
out : array_like, optional
|
---|---|
Returns: | r : ndarray
|
Examples
>>> np.multiply.reduce([2,3,5])
30